freebsd-nq/sys/dev
Andriy Gapon bc40a96992 ukbd: adjust for SCHEDULER_STOPPED() and overhaul locking code
This change is designed to let USB keyboard work in the panic context
with stop_scheduler_on_panic=1.  Most of change consists of removing
mtx_owned() checks where they can be easily avoided.  Some additional
lock cleanup is performed along the way.

A list of the smaller changes:
- newbus methods should be executed with Giant already held, just assert
  this
- kbd methods called in the non-polling context should be executed with
  Giant already held, just assert this
- Giant is recursive, so we should just take it where we must have it,
  without redundant checks if we already have it
- thanks to recent syscons changes we don't need to go through the hoops
  to detect if kernel is going to poll us; polling mode is now clearly
  separated from non-polling mode
- at present the polling mode can be entered by only one thread
- document special cases in greater detail

Please note that the ukbd code and underlying USB code still lve
dangerously in the kdb context by trying to obtain various locks
including the Giant.  If any of those locks are already held by the
stopped threads, then the things would blow up.
Another limitation of the ukbd driver is that it is detached before a
system enters the halt state.

With this commit we can enable kern.stop_scheduler_on_panic by default,
that should not introduce any regressions.

Reviewed by:	hselasky
MFC after:	3 months
X-MFC after:	r228424, r228760
2011-12-21 11:49:33 +00:00
..
aac - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
acpi_support - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
acpica Prevent a division by zero with some broken batteries 2011-11-26 13:43:50 +00:00
adb Add support for special keys (volume/brightness/eject) on Apple laptops with 2011-10-16 21:01:42 +00:00
adlink
advansys
ae To send a frame, controller requires a prepended TX header and 2011-11-11 19:15:32 +00:00
age Close a race where SIOCGIFMEDIA ioctl get inconsistent link status. 2011-10-17 19:49:00 +00:00
agp
aha
ahb
ahci Add hw.ahci.force tunable to control whether AHCI drivers should attach 2011-12-02 12:52:33 +00:00
aic
aic7xxx Add "%option noinput" to aicasm_scan.l and aicasm_macro_scan.l, so no 2011-12-16 00:04:28 +00:00
alc Close a race where SIOCGIFMEDIA ioctl get inconsistent link status. 2011-10-17 19:49:00 +00:00
ale Close a race where SIOCGIFMEDIA ioctl get inconsistent link status. 2011-10-17 19:49:00 +00:00
amdsbwd
amdtemp
amr - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
an Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
arcmsr - Just use cam_calc_geometry(9) on newer version of FreeBSD rather than 2011-11-23 21:43:51 +00:00
asmc
asr Merge from r225950: 2011-10-13 20:06:19 +00:00
ata Add PCI IDs for the Intel ICH9M SATA controllers. 2011-12-14 13:12:55 +00:00
ath Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
atkbdc Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
auxio
bce Rework link state tracking and remove superfluous link UP/DOWN 2011-12-13 18:11:25 +00:00
bfe - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
bge Destroy DMA tag for jumbo RX buffer in device detach. 2011-12-13 20:31:57 +00:00
bktr Remove a few bits of FreeBSD 2.x compatibility code. 2011-11-14 18:21:27 +00:00
bm - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
buslogic
bwi Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
bwn Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
bxe s/timout/timeout 2011-12-15 06:29:13 +00:00
cardbus Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
cas - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
ce
cesa - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
cfe kern cons: introduce infrastructure for console grabbing by kernel 2011-12-17 15:08:43 +00:00
cfi
ciss Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
cm Replace inline static' by static inline'. 2011-12-13 14:06:01 +00:00
cmx
coretemp
cp
cpuctl Add VIA microde update support to cpuctl(4) and cpucontrol(8). 2011-12-12 12:30:44 +00:00
cpufreq
cs Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
ct
ctau
cx
cxgb - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
cxgbe Many updates to cxgbe(4) 2011-12-16 02:09:51 +00:00
cy
dc Use DEVMETHOD_END. 2011-11-23 20:27:26 +00:00
dcons kern cons: introduce infrastructure for console grabbing by kernel 2011-12-17 15:08:43 +00:00
de Replace inline static' by static inline'. 2011-12-13 14:06:01 +00:00
digi
dpms
dpt
drm Fix format string Z --> z, since the former is a deprecated and (in FreeBSD) 2011-12-16 12:42:02 +00:00
e1000 Consistently use types in e1000 driver code: 2011-12-12 18:27:34 +00:00
ed Fix off by one error in mbuf access. Previously it caused panic. 2011-12-05 18:10:43 +00:00
eisa - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
en
ep
esp s/timout/timeout 2011-12-15 06:29:13 +00:00
et FreeBSD driver does not require arpcom structure in softc. 2011-12-09 23:37:55 +00:00
ex
exca
fatm
fb - Add support for ASCII art splash screens in TheDraw format 2011-12-12 21:12:07 +00:00
fdc Replace inline static' by static inline'. 2011-12-13 14:06:01 +00:00
fdt Fix OF_finddevice error return value in case of FDT. 2011-12-02 15:24:39 +00:00
fe
firewire - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
flash
fxp TCP header size is represented by number of 32bits words. 2011-12-19 19:00:34 +00:00
gem - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
glxiic
glxsb
gpio Fix broken locking that I introduced in the previous commit. 2011-12-20 03:25:11 +00:00
hatm
hifn - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
hme - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
hptiop - Just use cam_calc_geometry(9) on newer version of FreeBSD rather than 2011-11-23 21:43:51 +00:00
hptmv - Just use cam_calc_geometry(9) on newer version of FreeBSD rather than 2011-11-23 21:43:51 +00:00
hptrr - Just use cam_calc_geometry(9) on newer version of FreeBSD rather than 2011-11-23 21:43:51 +00:00
hwpmc There's a small set of events on Nehalem, that are not supported in 2011-12-12 13:12:55 +00:00
ic
ichsmb - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
ichwd
ida - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
ie
ieee488
if_ndis Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
iicbus IIC bitbang changes - prepare to make the bit delay configurable; debug print changes. 2011-12-20 02:49:01 +00:00
iir Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
io
ipmi Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
ips
ipw Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
iscsi/initiator Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
isp Fix few bugs in isp(4) target mode support: 2011-12-13 09:58:05 +00:00
ispfw
iwi Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
iwn Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
ixgb
ixgbe Consistently use types in ixgbe driver code: 2011-12-12 18:27:28 +00:00
jme
joy
kbd Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
kbdmux
ksyms Get rid of D_PSEUDO. 2011-10-18 08:09:44 +00:00
le
led
lge - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
lindev
lmc In r191367 the need for if_free_type() was removed and a new member 2011-11-11 22:57:52 +00:00
malo Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
mc146818
mca - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
mcd
md Document a large number of currently undocumented sysctls. While here 2011-12-13 00:38:50 +00:00
mem
mfi - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
mge
mii - In mii_attach(9) just set the driver for a newly added miibus(4) instance 2011-12-05 21:38:45 +00:00
mk48txx
mlx - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
mly
mmc Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
mn
mps - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
mpt Increase the IOC port initialization timeouts by ten times to what the 2011-11-01 18:28:33 +00:00
mse
msk Increase wait time for OP_TCPSTART command processing. It seems 2011-12-19 19:02:36 +00:00
mvs Rename device_delete_all_children() into device_delete_children(). 2011-11-22 21:56:55 +00:00
mwl Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
mxge
my
ncv
netmap Fix compilation on sparc64 by actually supplying the bus_dma_tag_t member 2011-12-18 17:48:54 +00:00
nfe - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
nge - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
nmdm Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
nsp
null
nve - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
nvram
nvram2env
nxge
ofw kern cons: introduce infrastructure for console grabbing by kernel 2011-12-17 15:08:43 +00:00
patm
pbio
pccard Replace inline static' by static inline'. 2011-12-13 14:06:01 +00:00
pccbb - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
pcf
pci Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls 2011-12-14 12:34:02 +00:00
pcn - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
pdq
powermac_nvram
ppbus Rename device_delete_all_children() into device_delete_children(). 2011-11-22 21:56:55 +00:00
ppc Rename device_delete_all_children() into device_delete_children(). 2011-11-22 21:56:55 +00:00
pst
pty
puc - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
qlxgb The maximum TSO frame size should be: 2011-11-16 02:00:55 +00:00
quicc - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
ral Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
random
rc
re add netmap support for "em", "lem", "igb" and "re". 2011-12-05 15:33:13 +00:00
rndtest Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
rp
rt - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
safe - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
sbni
scc - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
scd
sdhci Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
sec - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
sf - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
sfxge sfxge: Add $FreeBSD$ tags to common code files. 2011-11-28 17:19:05 +00:00
sge - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
si
siba Rename device_delete_all_children() into device_delete_children(). 2011-11-22 21:56:55 +00:00
siis Rename device_delete_all_children() into device_delete_children(). 2011-11-22 21:56:55 +00:00
sio kern cons: introduce infrastructure for console grabbing by kernel 2011-12-17 15:08:43 +00:00
sis - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
sk - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
smbus - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
smc - Import the common MII bitbang'ing code from NetBSD and convert drivers to 2011-11-01 16:13:59 +00:00
sn
snc
snp
sound Oops, list of IDs is not sequential. Have to list all of them expoicitly. 2011-12-20 02:42:53 +00:00
speaker Do not define bool/true/false if the symbols already exist. 2011-12-12 18:43:24 +00:00
spibus Replace inline static' by static inline'. 2011-12-13 14:06:01 +00:00
ste - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
stg
stge s,KOBJMETHOD_END,DEVMETHOD_END,g in order to fully hide the explicit mention 2011-11-22 21:55:40 +00:00
streams
sym
syscons syscons: provide a first iteration of cngrab/cnungrab implementation 2011-12-17 15:57:39 +00:00
tdfx Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
ti Eliminate vestiges of page coloring. 2011-12-15 05:07:16 +00:00
tl - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
tpm
trm
tsec - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
twa s/timout/timeout 2011-12-15 06:29:13 +00:00
twe - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
tws Do not define bool/true/false if the symbols already exist. 2011-12-12 18:43:24 +00:00
tx
txp
uart kern cons: introduce infrastructure for console grabbing by kernel 2011-12-17 15:08:43 +00:00
ubsec - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
usb ukbd: adjust for SCHEDULER_STOPPED() and overhaul locking code 2011-12-21 11:49:33 +00:00
utopia
vge - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
viawd Rework the attachement to probe directly on isab(4). 2011-12-14 15:39:51 +00:00
virtio Catch up with Bryan Venteicher's virtio Hg repo: 2011-12-06 06:28:32 +00:00
vkbd Get rid of D_PSEUDO. 2011-10-18 08:09:44 +00:00
vr Announce flow control capability to PHY drivers and enable flow 2011-11-28 19:03:59 +00:00
vte Remove unused variable mii. 2011-11-23 05:34:01 +00:00
vx
vxge Do not define bool/true/false if the symbols already exist. 2011-12-12 18:43:24 +00:00
watchdog
wb - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
wds
wi Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
wl
wpi Fix some net80211 enum nits: 2011-12-17 10:23:17 +00:00
xe Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
xen kern cons: introduce infrastructure for console grabbing by kernel 2011-12-17 15:08:43 +00:00
xl Use DEVMETHOD_END. 2011-11-23 20:27:26 +00:00