freebsd-dev/sys/kern
Bruce Evans d350ce61cf Less-quick fix for locking fixes in r172250. r172250 added a second
syscons spinlock for the output routine alone.  It is better to extend
the coverage of the first syscons spinlock added in r162285.  2 locks
might work with complicated juggling, but no juggling was done.  What
the 2 locks actually did was to cover some of the missing locking in
each other and deadlock less often against each other than a single
lock with larger coverage would against itself.  Races are preferable
to deadlocks here, but 2 locks are still worse since they are harder
to understand and fix.

Prefer deadlocks to races and merge the second lock into the first one.

Extend the scope of the spinlocking to all of sc_cnputc() instead of
just the sc_puts() part.  This further prefers deadlocks to races.

Extend the kdb_active hack from sc_puts() internals for the second lock
to all spinlocking.  This reduces deadlocks much more than the other
changes increases them.  The s/p,10* test in ddb gets much further now.
Hide this detail in the SC_VIDEO_LOCK() macro.  Add namespace pollution
in 1 nested #include and reduce namespace pollution in other nested
#includes to pay for this.

Move the first lock higher in the witness order.  The second lock was
unnaturally low and the first lock was unnaturally high.  The second
lock had to be above "sleepq chain" and/or "callout" to avoid spurious
LORs for visual bells in sc_puts().  Other console driver locks are
already even higher (but not adjacent like they should be) except when
they are missing from the table.  Audio bells also benefit from the
syscons lock being high so that audio mutexes have chance of being
lower.  Otherwise, console drviver locks should be as low as possible.
Non-spurious LORs now occur if the bell code calls printf() or is
interrupted (perhaps by an NMI) and the interrupt handler calls
printf().  Previous commits turned off many bells in console i/o but
missed ones done by the teken layer.
2016-08-25 13:46:52 +00:00
..
bus_if.m INTRNG: Rework handling with resources. Partially revert r301453. 2016-08-19 10:52:39 +00:00
capabilities.conf Remove unusedd and obsolete openbsd_poll system call. (Phase 1) 2016-08-18 10:50:40 +00:00
clock_if.m
cpufreq_if.m
device_if.m Import the 'iflib' API library for network drivers. From the author: 2016-05-18 04:35:58 +00:00
genassym.sh
imgact_aout.c
imgact_binmisc.c
imgact_elf32.c
imgact_elf64.c
imgact_elf.c imgact_elf: Rename the segment iterator to match reality 2016-07-20 22:51:33 +00:00
imgact_gzip.c
imgact_shell.c
inflate.c
init_main.c Remove assumptions in MI code that the BSP is CPU 0. 2016-07-11 21:25:28 +00:00
init_sysent.c Remove the obsolete and unused openbsd_poll system call. (Phase 2) 2016-08-18 10:54:39 +00:00
kern_acct.c Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
kern_alq.c
kern_clock.c Prevent parallel tc_windup() calls, both parallel top-level calls from 2016-07-27 11:49:41 +00:00
kern_clocksource.c Add an EARLY_AP_STARTUP option to start APs earlier during boot. 2016-05-14 18:22:52 +00:00
kern_condvar.c
kern_conf.c
kern_cons.c
kern_context.c
kern_cpu.c Add an EARLY_AP_STARTUP option to start APs earlier during boot. 2016-05-14 18:22:52 +00:00
kern_cpuset.c
kern_ctf.c
kern_descrip.c sigio: do a lockless check in funsetownlist 2016-08-10 15:24:15 +00:00
kern_dtrace.c
kern_dump.c
kern_environment.c
kern_et.c
kern_event.c Another issue reported on http://seclists.org/oss-sec/2016/q3/68 is 2016-07-16 13:24:58 +00:00
kern_exec.c Eliminate unneeded vm_page_xbusy() and vm_page_xunbusy() operations when 2016-08-14 22:00:45 +00:00
kern_exit.c When a debugger attaches to the process, SIGSTOP is sent to the 2016-07-28 08:41:13 +00:00
kern_fail.c Fix some cosmetic issues in kern_fail.c omitted from r296927. 2016-06-09 13:17:08 +00:00
kern_ffclock.c
kern_fork.c Don't set P2_PTRACE_FSTP in a process that invokes ptrace(PT_TRACE_ME). 2016-08-19 17:57:14 +00:00
kern_gzio.c
kern_hhook.c Get closer to a VIMAGE network stack teardown from top to bottom rather 2016-06-21 13:48:49 +00:00
kern_idle.c
kern_intr.c
kern_jail.c Move IPv4-specific jail functions to new file netinet/in_jail.c 2016-08-09 02:16:21 +00:00
kern_khelp.c
kern_kthread.c Re-schedule signals after kthread exits, since apparently there are 2016-08-10 13:47:12 +00:00
kern_ktr.c
kern_ktrace.c ktrace: do a lockless check on fork to see if tracing is enabled 2016-08-10 15:25:44 +00:00
kern_linker.c Add DDB command "kldstat" 2016-06-09 18:27:41 +00:00
kern_lock.c Microoptimize locking primitives by avoiding unnecessary atomic ops. 2016-06-01 18:32:20 +00:00
kern_lockf.c When sleeping waiting for either local or remote advisory lock, 2016-06-26 20:08:42 +00:00
kern_lockstat.c
kern_loginclass.c
kern_malloc.c Move IPv6 malloc tag definitions into the IPv6 code. 2016-05-20 04:45:08 +00:00
kern_mbuf.c Import the 'iflib' API library for network drivers. From the author: 2016-05-18 04:35:58 +00:00
kern_mib.c
kern_module.c
kern_mtxpool.c
kern_mutex.c locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case 2016-08-02 03:05:59 +00:00
kern_ntptime.c Fix a bug in r302252. 2016-07-27 11:40:06 +00:00
kern_numa.c
kern_osd.c
kern_physio.c
kern_pmc.c
kern_poll.c
kern_priv.c
kern_proc.c ANSIfy kern_proc.c and delete register keyword 2016-07-27 14:27:08 +00:00
kern_procctl.c
kern_prot.c Audit the accepted (or rejected) username argument to setlogin(2). 2016-08-20 20:28:08 +00:00
kern_racct.c
kern_rangelock.c
kern_rctl.c
kern_resource.c
kern_rmlock.c
kern_rwlock.c locks: fix compilation for KDTRACE_HOOKS && !ADAPTIVE_* case 2016-08-02 03:05:59 +00:00
kern_sdt.c
kern_sema.c
kern_sendfile.c
kern_sharedpage.c
kern_shutdown.c Compile in the kassert_panic() function with INVARIANT_SUPPORT 2016-07-05 18:34:34 +00:00
kern_sig.c Correct a check for P2_PTRACE_FSTP in ptracestop(). 2016-08-19 01:27:24 +00:00
kern_switch.c
kern_sx.c locks: fix sx compilation on mips after r303643 2016-08-03 09:15:10 +00:00
kern_synch.c Get rid of struct proc p_sched and struct thread td_sched pointers. 2016-06-05 17:04:03 +00:00
kern_syscalls.c
kern_sysctl.c Add support for boolean sysctl's. 2016-05-26 08:41:55 +00:00
kern_tc.c Implement userspace gettimeofday(2) with HPET timecounter. 2016-08-17 09:52:09 +00:00
kern_thr.c Add a mask of optional ptrace() events. 2016-07-15 15:32:09 +00:00
kern_thread.c Rewrite subr_sleepqueue.c use of callouts to not depend on the 2016-07-28 09:09:55 +00:00
kern_time.c Remove Giant from settime(), tc_setclock_mtx guards tc_windup() calls, 2016-07-27 11:54:24 +00:00
kern_timeout.c Fix a stupid typo (or copy/paste buffer malfunction). 2016-08-16 23:00:22 +00:00
kern_umtx.c sem_post(): wake up the sleeper only after adjusting has_waiters 2016-08-15 20:09:09 +00:00
kern_uuid.c
kern_xxx.c
ksched.c
link_elf_obj.c
link_elf.c
linker_if.m
Make.tags.inc
Makefile Don't create pointless backups of generated files in "make sysent". 2016-07-28 21:29:04 +00:00
makesyscalls.sh Still provide freebsd10_* symbols from libc for COMPAT10. 2016-08-04 19:14:18 +00:00
md4c.c crypto routines: Hint minimum buffer sizes to the compiler 2016-05-26 19:29:29 +00:00
md5c.c crypto routines: Hint minimum buffer sizes to the compiler 2016-05-26 19:29:29 +00:00
msi_if.m Introduce MSI and MSI-X support to intrng. This adds a new msi device 2016-05-16 09:11:40 +00:00
p1003_1b.c
pic_if.m INTRNG: Rework handling with resources. Partially revert r301453. 2016-08-19 10:52:39 +00:00
posix4_mib.c
sched_4bsd.c Don't treat NOCPU as a valid CPU to CPU_ISSET. 2016-07-29 20:19:14 +00:00
sched_ule.c Get rid of struct proc p_sched and struct thread td_sched pointers. 2016-06-05 17:04:03 +00:00
serdev_if.m
stack_protector.c
subr_acl_nfs4.c
subr_acl_posix1e.c
subr_autoconf.c
subr_blist.c
subr_bufring.c
subr_bus_dma.c
subr_bus.c INTRNG: Rework handling with resources. Partially revert r301453. 2016-08-19 10:52:39 +00:00
subr_busdma_bufalloc.c
subr_capability.c
subr_clock.c Do not use Giant to prevent parallel calls to CLOCK_SETTIME(). Use 2016-06-28 16:42:40 +00:00
subr_counter.c
subr_devmap.c Include machine/acle-compat.h in cdefs.h on arm if the compiler doesn't 2016-05-25 19:44:26 +00:00
subr_devstat.c Add support for managing Shingled Magnetic Recording (SMR) drives. 2016-05-19 14:08:36 +00:00
subr_disk.c
subr_dummy_vdso_tc.c
subr_eventhandler.c
subr_fattime.c
subr_firmware.c
subr_gtaskqueue.c Update iflib to support more NIC designs 2016-08-12 21:29:44 +00:00
subr_hash.c
subr_hints.c
subr_intr.c INTRNG: Rework handling with resources. Partially revert r301453. 2016-08-19 10:52:39 +00:00
subr_kdb.c
subr_kobj.c
subr_lock.c Implement trivial backoff for locking primitives. 2016-08-01 21:48:37 +00:00
subr_log.c
subr_mbpool.c
subr_mchain.c
subr_module.c
subr_msgbuf.c
subr_param.c Add explicit detection of KVM hypervisor 2016-07-13 19:19:18 +00:00
subr_pcpu.c Print the tid of curthread in "show pcpu" in ddb. 2016-08-14 15:52:00 +00:00
subr_pctrie.c
subr_power.c
subr_prf.c Hide counted_warning(9) under #ifdef _KERNEL braces, to allow building 2016-07-21 17:59:30 +00:00
subr_prof.c
subr_rman.c Add new bus methods for mapping resources. 2016-05-20 17:57:47 +00:00
subr_rtc.c Reduce the resettodr_lock scope to only CLOCK_SETTIME() call. 2016-07-27 11:34:25 +00:00
subr_sbuf.c
subr_scanf.c
subr_sfbuf.c
subr_sglist.c Add sglist functions for working with arrays of VM pages. 2016-05-20 23:28:43 +00:00
subr_sleepqueue.c Rewrite subr_sleepqueue.c use of callouts to not depend on the 2016-07-28 09:09:55 +00:00
subr_smp.c
subr_stack.c
subr_syscall.c Add PTRACE_VFORK to trace vfork events. 2016-07-18 14:53:55 +00:00
subr_taskqueue.c Update iflib to support more NIC designs 2016-08-12 21:29:44 +00:00
subr_terminal.c
subr_trap.c The assertion re-added in r302614 was triggered when stopping signal 2016-07-18 10:53:47 +00:00
subr_turnstile.c
subr_uio.c
subr_unit.c Fix build of kern/subr_unit.c, broken by r300539 2016-05-24 00:14:58 +00:00
subr_vmem.c
subr_witness.c Less-quick fix for locking fixes in r172250. r172250 added a second 2016-08-25 13:46:52 +00:00
sys_capability.c
sys_generic.c Remove unusedd and obsolete openbsd_poll system call. (Phase 1) 2016-08-18 10:50:40 +00:00
sys_pipe.c Generate syscall tables and update pipe() implementation after r302094. 2016-06-22 21:18:19 +00:00
sys_procdesc.c Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
sys_process.c Don't set P2_PTRACE_FSTP in a process that invokes ptrace(PT_TRACE_ME). 2016-08-19 17:57:14 +00:00
sys_socket.c Account for AIO socket operations in thread/process resource usage. 2016-06-21 22:19:06 +00:00
syscalls.c Remove the obsolete and unused openbsd_poll system call. (Phase 2) 2016-08-18 10:54:39 +00:00
syscalls.master Remove unusedd and obsolete openbsd_poll system call. (Phase 1) 2016-08-18 10:50:40 +00:00
systrace_args.c Remove the obsolete and unused openbsd_poll system call. (Phase 2) 2016-08-18 10:54:39 +00:00
sysv_ipc.c
sysv_msg.c Remove a comment that was part of copied code, and is misleading in 2016-06-09 15:34:33 +00:00
sysv_sem.c
sysv_shm.c Add shmatt_t. 2016-07-26 17:23:49 +00:00
tty_compat.c
tty_info.c
tty_inq.c
tty_outq.c
tty_pts.c
tty_tty.c
tty_ttydisc.c
tty.c
uipc_accf.c
uipc_debug.c
uipc_domain.c The pr_destroy field does not allow us to run the teardown code in a 2016-06-01 10:14:04 +00:00
uipc_mbuf2.c
uipc_mbuf.c
uipc_mbufhash.c
uipc_mqueue.c
uipc_sem.c
uipc_shm.c Eliminate unneeded vm_page_xbusy() and vm_page_xunbusy() operations when 2016-08-14 22:00:45 +00:00
uipc_sockbuf.c
uipc_socket.c Fix typo introduced by me (not the submitter) when fixing typos 2016-05-22 13:10:48 +00:00
uipc_syscalls.c The SA-16:19 wouldn't have happened if the sockargs() had properly typed 2016-05-18 22:05:50 +00:00
uipc_usrreq.c Handle races with listening socket close when connecting a unix socket. 2016-08-08 20:25:04 +00:00
vfs_acl.c
vfs_aio.c Remove duplicated code. 2016-08-17 10:14:22 +00:00
vfs_bio.c Remove b_pin_count from struct buf. 2016-08-11 07:58:23 +00:00
vfs_cache.c
vfs_cluster.c Remove b_pin_count from struct buf. 2016-08-11 07:58:23 +00:00
vfs_default.c Implement VOP_FDATASYNC() for msdosfs. 2016-08-15 19:17:00 +00:00
vfs_export.c
vfs_extattr.c
vfs_hash.c
vfs_init.c
vfs_lookup.c Replace all remaining calls to vprint(9) with vn_printf(9), and remove 2016-08-10 16:12:31 +00:00
vfs_mount.c Replace all remaining calls to vprint(9) with vn_printf(9), and remove 2016-08-10 16:12:31 +00:00
vfs_mountroot.c
vfs_subr.c Print vnode details when vnode locking assertion gets triggered. 2016-08-12 22:20:52 +00:00
vfs_syscalls.c Eliminate use of sys_fsync() and sys_fdatasync(). 2016-08-15 20:11:52 +00:00
vfs_vnops.c Audit additional vnode information in the implementation of the 2016-08-20 18:51:48 +00:00
vnode_if.src Add an implementation of fdatasync(2). 2016-08-15 19:08:51 +00:00