freebsd-dev/sys
Bruce Evans 90adad104b The log message for the previous commit didn't mention the most the
important detail that sc_cngetc() now opens and closes the keyboard
on every call again.  This was moved from sc_cngetc() to scn_cngrab/
ungrab() in r228644, but the change wasn't quite complete.  After
fixes for nesting in kbdd_poll() in ukbd and kbdmux, these opens
and closes should have no significant effect if done while grabbed.
They fix unusual cases when cngetc() is called while not grabbed.

This commit is the main fix for screen locking in sc_cnputc():
detect deadlock or likely-deadlock and handle it by buffering the
output atomically and printing it later if the deadlock condition
clears (and sc_cnputc() is called).

The most common deadlock is when the screen lock is held by ourself.
Then it would be safe to acquire the lock recursively if the console
driver is calling printf() in a safe context, but we don't know when
that is.  It is not safe to ignore the lock even in kdb or panic mode.
But ignore it in panic mode.  The only other known case of deadlock
is when another thread holds the lock but is running on a stopped CPU.
Detect that case approximately by using trylock and retrying for 1000
usec.  On a 4 GHz CPU, 100 usec is almost long enough -- screen switches
take slightly longer than that.  Not retrying at all is good enough
except for stress tests, and planned future versions will extend the
timeout so that the stress tests work better.

To see the behaviour when deadlock is detected, single step through
sctty_outwakeup() (or sc_puts() to start with deadlock).  Another
(serial) console is needed to the buffered-only output, but the
keyboard works in this context to continue or step out of the
deadlocked region.  The buffer is not large enough to hold all the
output for this.
2016-09-01 19:18:26 +00:00
..
amd64 As an optimization to the machine-independent layer, change the machine- 2016-09-01 15:57:44 +00:00
arm All the TI platforms are FDT based and it is not necessary to enumerate 2016-08-31 19:37:10 +00:00
arm64 Fix arm64 superpages bugs in pmap_enter: 2016-09-01 10:26:06 +00:00
boot o Separate rtc and timecmp registers: they are different across 2016-09-01 14:58:11 +00:00
bsm
cam Decode some new ATA commands found in ACS-3. 2016-08-27 19:51:37 +00:00
cddl MFV r304158: 2016-09-01 18:37:11 +00:00
compat Add missing header dependency. 2016-08-24 09:57:19 +00:00
conf Add cnv API. 2016-08-27 13:37:30 +00:00
contrib Update VCHIQ driver to upstream version 4eda74f2 2016-08-31 01:04:57 +00:00
crypto Connect the SHA-512t256 and Skein hashing algorithms to ZFS 2016-05-31 04:12:14 +00:00
ddb Expand error messages: print symbol names, parentheses and shift tokens, 2016-08-28 19:33:09 +00:00
dev The log message for the previous commit didn't mention the most the 2016-09-01 19:18:26 +00:00
fs Implement VOP_FDATASYNC() for msdosfs. 2016-08-15 19:17:00 +00:00
gdb
geom Do not invoke resize event if initial disk size is zero. Some disks 2016-08-01 20:54:54 +00:00
gnu Revert changes for local testing, inadvertantly commited in r300811. 2016-05-26 23:59:42 +00:00
i386 As an optimization to the machine-independent layer, change the machine- 2016-09-01 15:57:44 +00:00
isa
kern allow kern.proc.nfds sysctl in capability mode 2016-09-01 02:51:50 +00:00
kgssapi
libkern
mips [mips] move AR91XX_BASE to std.AR91XX. 2016-08-28 04:10:23 +00:00
modules Use both the MACHINE and MACHINE_CPUARCH directories for finding sources. 2016-08-29 07:48:35 +00:00
net net/rndis: Define types for RNDIS pktinfo rm_type field. 2016-09-01 07:17:06 +00:00
net80211 [net80211] correctly lock the ifp before accessing the lladdr. 2016-08-18 01:25:12 +00:00
netgraph Avoid panic from ng_uncallout when unpluggin ethernet cable with active 2016-08-08 19:31:01 +00:00
netinet Adjust TCP module fastpath after r304803's cc_ack_received() changes. 2016-08-26 19:23:17 +00:00
netinet6 Fix L2 caching for UDP over IPv6 2016-08-24 00:52:30 +00:00
netipsec Remove redundant sanity checks from ipsec[46]_common_input_cb(). 2016-08-31 11:51:52 +00:00
netnatm
netpfil Try to fix gcc compilation errors (which are right). 2016-08-18 10:26:15 +00:00
netsmb
nfs Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
nfsclient
nfsserver
nlm When sleeping waiting for either local or remote advisory lock, 2016-06-26 20:08:42 +00:00
ofed Do not free an uninitialized pointer on soaccept failure in the iWARP 2016-08-26 08:25:28 +00:00
opencrypto opencrypto AES-ICM: Fix heap corruption typo 2016-08-01 22:57:03 +00:00
pc98 Remove the ie(4) driver for Intel 82586 ISA Ethernet adapters. 2016-08-20 00:49:29 +00:00
powerpc Attach and LAW problems to fix 2016-08-30 02:09:40 +00:00
riscv o Separate rtc and timecmp registers: they are different across 2016-09-01 14:58:11 +00:00
rpc Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
security Audit the accepted (or rejected) username argument to setlogin(2). 2016-08-20 20:28:08 +00:00
sparc64 Remove the wds(4) driver for the WD700 ISA SCSI HBA. 2016-08-19 21:51:42 +00:00
sys fd: effectively revert r305091 2016-08-31 12:29:04 +00:00
teken
tests
tools Consider CROSS_BINUTILS_PREFIX environment variable so we use correct 2016-08-10 13:49:17 +00:00
ufs Bug 211013 reports that a write error to a UFS filesystem running 2016-08-16 21:02:30 +00:00
vm Make swapoff reliable. 2016-08-31 14:49:58 +00:00
x86 Fix build for !SMP kernels after the Xen MSIX workaround. 2016-08-22 21:23:17 +00:00
xdr
xen xen: Correct typo in #undef for symbol NBPL 2016-06-06 14:55:46 +00:00
Makefile