85f190e4d1
Problem: selwakeup required calling pfind which would cause lock order reversals with the allproc_lock and the per-process filedesc lock. Solution: Instead of recording the pid of the select()'ing process into the selinfo structure, actually record a pointer to the thread. To avoid dereferencing a bad address all the selinfo structures that are in use by a thread are kept in a list hung off the thread (protected by sellock). When a selwakeup occurs the selinfo is removed from that threads list, it is also removed on the way out of select or poll where the thread will traverse its list removing all the selinfos from its own list. Problem: Previously the PROC_LOCK was used to provide the mutual exclusion needed to ensure proper locking, this couldn't work because there was a single condvar used for select and poll and condvars can only be used with a single mutex. Solution: Introduce a global mutex 'sellock' which is used to provide mutual exclusion when recording events to wait on as well as performing notification when an event occurs. Interesting note: schedlock is required to manipulate the per-thread TDF_SELECT flag, however if given its own field it would not need schedlock, also because TDF_SELECT is only manipulated under sellock one doesn't actually use schedlock for syncronization, only to protect against corruption. Proc locks are no longer used in select/poll. Portions contributed by: davidc |
||
---|---|---|
.. | ||
devlist2h.awk | ||
dsbr100io.h | ||
FILES | ||
hid.c | ||
hid.h | ||
if_aue.c | ||
if_auereg.h | ||
if_cue.c | ||
if_cuereg.h | ||
if_kue.c | ||
if_kuereg.h | ||
kue_fw.h | ||
Makefile.usbdevs | ||
ohci_pci.c | ||
ohci.c | ||
ohcireg.h | ||
ohcivar.h | ||
rio500_usb.h | ||
udbp.c | ||
udbp.h | ||
ufm.c | ||
ugen.c | ||
uhci_pci.c | ||
uhci.c | ||
uhcireg.h | ||
uhcivar.h | ||
uhid.c | ||
uhub.c | ||
ukbd.c | ||
ulpt.c | ||
umass.c | ||
umodem.c | ||
ums.c | ||
urio.c | ||
usb_ethersubr.c | ||
usb_ethersubr.h | ||
usb_if.m | ||
usb_mem.h | ||
usb_port.h | ||
usb_quirks.c | ||
usb_quirks.h | ||
usb_subr.c | ||
usb.c | ||
usb.h | ||
usbcdc.h | ||
usbdevs | ||
usbdevs_data.h | ||
usbdevs.h | ||
usbdi_util.c | ||
usbdi_util.h | ||
usbdi.c | ||
usbdi.h | ||
usbdivar.h | ||
usbhid.h | ||
uscanner.c |