0f6f5adb50
The code in this module was derived from the one in driver/tty. However, the driver uses a shared lock between the master and slave side of a TTY, and this was changed to use two separate locks. The approach with two locks does not work. It seems the change was unfinished and the second TTY was never locked. But attempting to lock it will result in lock inversion problems, unless we do complicated things (try to find which of the two TTY is the master side, and lock that first, for example). It is simpler to restore the shared lock as used in the driver. To set up the shared lock, I modified the tty_create function to take a pointer to the master TTY when creating the slave. Maybe it makes more sense to create both sides in the same call, create_tty_pair? However, this does not work as easily as I wanted, because there is some recursion going on: at least in one case, the tty_control function is calling the driver's tty_service function, which in turns attempts to call back into tty_control for the "other side" TTY. To handle this case, replace the mutex with a recursive_lock. Fixes #17091, where the root problem was access to other_tty->select_pool without locking. This was also made unconvenient to debug because select_pool objects are self-deleting, when the last item in the pool is removed. As a result, the code accessing it without log would suddenly find out that the data it was accessing had been freed and erased. This also makes the TTY code in driver/tty and generic/tty a bit more similar than it was before, and brings us one step closer to merging the two together. There are still two main differences and I don't know enough about TTY to decide if they are important, and which version should be kept: - The driver has extra code for "background" read and write. I don't know what this is used for. - The driver has a single "settings" instance shared by a master and slave TTY, while the module has two separate instances, but seems to copy one to the other. I'm not sure which approach is correct. Change-Id: Ie2daddd027859ce32ba395af76b4f109f8b984b0 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4604 Reviewed-by: waddlesplash <waddlesplash@gmail.com> |
||
---|---|---|
.. | ||
bus | ||
pcmcia | ||
tty | ||
usb | ||
ACPI.h | ||
bios.h | ||
bus_manager.h | ||
config_manager.h | ||
cpufreq.h | ||
cpuidle.h | ||
device_manager.h | ||
disk_device_manager.h | ||
dpc.h | ||
driver_settings.h | ||
Drivers.h | ||
fs_cache.h | ||
fs_interface.h | ||
interrupt_controller.h | ||
io_requests.h | ||
ISA.h | ||
isapnp.h | ||
KernelExport.h | ||
locked_pool.h | ||
midi_driver.h | ||
mime_table.h | ||
module.h | ||
PCI_x86.h | ||
PCI.h | ||
Select.h | ||
USB2.h | ||
USB3.h | ||
USB_isochronous.h | ||
USB_printer.h | ||
USB_rle.h | ||
USB_spec.h | ||
USB.h |