freebsd-dev/sys/i386
Alfred Perlstein 85f190e4d1 Fixes to make select/poll mpsafe.
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
2002-03-14 01:32:30 +00:00
..
acpica Fix typo in function name. 2002-01-10 03:26:46 +00:00
apm Add generalized power profile code. 2002-03-04 18:46:13 +00:00
bios Add generalized power profile code. 2002-03-04 18:46:13 +00:00
compile Don't need the .keep_me files. Obrien and I committed past each other. 2001-07-01 23:35:44 +00:00
conf Add commented out GEOM line to NOTES 2002-03-11 08:27:23 +00:00
i386 Export a (machine dependent) kernel variable bootdev as 2002-03-10 20:08:44 +00:00
ibcs2 Fix warnings (prototype for nonexisting static function) 2002-02-28 03:12:00 +00:00
include o Don't require long long support in bswap64() functions. 2002-03-09 21:02:16 +00:00
isa Fixes to make select/poll mpsafe. 2002-03-14 01:32:30 +00:00
linux Fix format warning. 2002-02-27 23:21:46 +00:00
pci The Libretto L series has no $PIR table, but does have a _PIR table. 2002-01-20 03:28:29 +00:00
svr4 Clear the single-step flag for signal handlers. This fixes bogus trace 2002-01-10 11:49:55 +00:00
Makefile Update pathnames for creation of tags file. 2001-12-05 01:23:21 +00:00