freebsd-nq/sys/dev/kbd
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
..
atkbd.c Return consistent key action codes at key press and release 2001-07-20 13:05:57 +00:00
atkbdc.c Convert more malloc+bzero to malloc+M_ZERO. 2000-12-08 21:51:06 +00:00
atkbdcreg.h Refine ACPI/PnP BIOS probe/attach routines a bit. 2001-09-15 04:38:20 +00:00
atkbdreg.h
kbd.c Fixes to make select/poll mpsafe. 2002-03-14 01:32:30 +00:00
kbdreg.h Fix typo; the meaning of the 3rd parameter to genkbd_keyaction() is 2001-07-20 14:49:54 +00:00
kbdtables.h Update default keyboard (PREV, PASTE) 2001-03-12 00:00:22 +00:00