freebsd-dev/sys/kern
Attilio Rao 248bb9379f Fix a deadlock in the shutdown code:
When performing a smp_rendezvous() or more likely, on amd64 and i386,
a smp_tlb_shootdown() the caller will end up with the smp_ipi_mtx
spinlock held, busy-waiting for other CPUs to acknowledge the operation.
As long as CPUs are suspended (via cpu_reset()) between the active mask
read and IPI sending there can be a deadlock where the caller will wait
forever for a dead CPU to acknowledge the operation.
Please note that on CPU0 that is going to be someway heavier because of
the spinlocks being disabled earlier than quitting the machine.

Fix this bug by calling cpu_reset() with the smp_ipi_mtx held.
Note that it is very likely that a saner offline/online CPUs mechanism
will help heavilly in fixing similar cases as it is likely more bugs
of this type may arise in the future.

Reported by:	rwatson
Discussed with:	jhb
Tested by:	rnoland, Giovanni Trematerra
		<giovanni dot trematerra at gmail dot com>
MFC:		2 weeks

Special deciation to:	anyone who made possible to have 16-ways machines
			in Netperf
2010-04-19 23:27:54 +00:00
..
bus_if.m Add a facility for associating optional descriptions with active interrupt 2009-10-15 14:54:35 +00:00
clock_if.m
cpufreq_if.m
device_if.m
genassym.sh
imgact_aout.c
imgact_elf32.c
imgact_elf64.c
imgact_elf.c Add the ELF relocation base to struct image_params. This will be 2010-03-25 14:31:26 +00:00
imgact_gzip.c
imgact_shell.c
inflate.c
init_main.c Initialize the virtual memory-related resource limits in a single place. 2010-04-11 16:26:07 +00:00
init_sysent.c Regenerate 2009-10-27 11:01:15 +00:00
kern_acct.c
kern_alq.c The ALQ should not be considered drained until it has been made inactive. 2010-04-01 01:27:10 +00:00
kern_clock.c - Introduce a blessed list for sxlocks that prevents the deadlkres to 2010-04-11 16:06:09 +00:00
kern_condvar.c
kern_conf.c Fix several style issues. 2010-02-27 15:26:36 +00:00
kern_cons.c
kern_context.c In r197963, a race with thread being selected for signal delivery 2009-10-27 10:47:58 +00:00
kern_cpu.c Free allocated sbufs before returning ENOMEM. 2010-01-08 22:58:50 +00:00
kern_cpuset.c Another nit that both I and ispell missed. 2009-10-26 18:32:06 +00:00
kern_ctf.c
kern_descrip.c On the return path from F_RDAHEAD and F_READAHEAD fcntls, do not 2009-11-20 22:22:53 +00:00
kern_dtrace.c
kern_environment.c Merge change r198561 from projects/mips to head: 2010-01-10 22:34:18 +00:00
kern_event.c Defer freeing a kevent list until after dropping kqueue locks. 2010-03-30 18:31:55 +00:00
kern_exec.c Add the ELF relocation base to struct image_params. This will be 2010-03-25 14:31:26 +00:00
kern_exit.c Let access overriding to TTYs depend on the cdev_priv, not the vnode. 2009-12-19 18:42:12 +00:00
kern_fail.c Remove extraneous semicolons, no functional changes. 2010-01-07 21:01:37 +00:00
kern_fork.c
kern_gzio.c Merge projects/enhanced_coredumps (r204346) into HEAD: 2010-03-02 06:58:58 +00:00
kern_idle.c Split P_NOLOAD into a per-thread flag (TDF_NOLOAD). 2009-11-03 16:46:52 +00:00
kern_intr.c KASSERT that return value of interrupt filter complies with contract 2010-01-27 09:59:08 +00:00
kern_jail.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_kthread.c Use the cached value within comparison. 2010-02-19 15:10:05 +00:00
kern_ktr.c Change the semantics of the debug.ktr.alq_enable control so that when you 2010-04-14 21:42:29 +00:00
kern_ktrace.c - Fix several off-by-one errors when using MAXCOMLEN. The p_comm[] and 2009-10-23 15:14:54 +00:00
kern_linker.c - Unbreak build with KLD_DEBUG defined 2009-11-17 21:56:12 +00:00
kern_lock.c Fix typos. 2010-01-07 01:24:09 +00:00
kern_lockf.c
kern_lockstat.c
kern_malloc.c
kern_mbuf.c
kern_mib.c Declare the kern.ngroups sysctl to be read-only, but tunable at boot for 2010-01-12 18:20:20 +00:00
kern_module.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_mtxpool.c
kern_mutex.c - Fix a race in sched_switch() of sched_4bsd. 2010-01-23 15:54:21 +00:00
kern_ntptime.c
kern_osd.c
kern_physio.c
kern_pmc.c
kern_poll.c
kern_priv.c
kern_proc.c For kinfo_proc in kp->ki_siglist, return the set of the signals pending 2010-02-27 15:32:49 +00:00
kern_prot.c Only allocate the space we need before calling kern_getgroups instead 2010-01-15 07:18:46 +00:00
kern_resource.c sched_getparam was just plain broke for time-share 2010-03-03 21:46:51 +00:00
kern_rmlock.c Remove extra spaces (no functional change). 2009-12-25 21:14:05 +00:00
kern_rwlock.c Print the pointer to the lock with the panic message. The previous 2010-03-24 19:21:26 +00:00
kern_sdt.c
kern_sema.c
kern_shutdown.c Fix a deadlock in the shutdown code: 2010-04-19 23:27:54 +00:00
kern_sig.c When OOM searches for a process to kill, ignore the processes already 2010-04-06 10:43:01 +00:00
kern_switch.c
kern_sx.c In current code, threads performing an interruptible sleep (on both 2009-12-12 21:31:07 +00:00
kern_synch.c
kern_syscalls.c Introduce SYSCALL_INIT_HELPER and SYSCALL32_INIT_HELPER macros and 2010-03-19 10:56:30 +00:00
kern_sysctl.c
kern_tc.c
kern_thr.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_thread.c Inform hwpmc(4) of a thread's impending demise prior to invoking sched_throw(). 2009-10-25 04:34:47 +00:00
kern_time.c
kern_timeout.c Properly fix callout handling by putting all the per-cpu info in 2009-12-14 12:23:46 +00:00
kern_umtx.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
kern_uuid.c
kern_xxx.c
ksched.c sched_getparam was just plain broke for time-share 2010-03-03 21:46:51 +00:00
link_elf_obj.c Kernel module support for mips. 2010-02-18 05:49:52 +00:00
link_elf.c
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh Remove unused LIBCOMPAT keyword from syscalls.master. 2010-02-08 10:02:01 +00:00
md4c.c
md5c.c
p1003_1b.c
posix4_mib.c
sched_4bsd.c Split out an invariant in order to better check that newtd, when 2010-01-24 18:16:38 +00:00
sched_ule.c - Fix a race in sched_switch() of sched_4bsd. 2010-01-23 15:54:21 +00:00
serdev_if.m
stack_protector.c Random number generator initialization cleanup: 2009-10-20 16:36:51 +00:00
subr_acl_nfs4.c Fix comments. 2010-01-04 12:39:42 +00:00
subr_acl_posix1e.c Now that all the callers seem to be fixed, add KASSERTs to make sure VAPPEND 2009-12-26 11:36:10 +00:00
subr_autoconf.c
subr_blist.c
subr_bufring.c
subr_bus.c Spelling nit 2010-02-07 18:00:13 +00:00
subr_clock.c
subr_devstat.c Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
subr_disk.c
subr_eventhandler.c Split eventhandler_register() into an internal part and a wrapper function 2010-03-19 19:51:03 +00:00
subr_fattime.c
subr_firmware.c Bump up the firmware_table from 30 to 50. bwn needs more than 30, it 2010-03-07 22:37:35 +00:00
subr_hash.c Decompose the most lousy named file in sys/kern; kern_subr.c. 2010-02-21 19:53:33 +00:00
subr_hints.c
subr_kdb.c
subr_kobj.c
subr_lock.c
subr_log.c Make /dev/klog and kern.msgbuf* MPSAFE. 2009-11-03 21:06:19 +00:00
subr_mbpool.c
subr_mchain.c
subr_module.c
subr_msgbuf.c
subr_param.c Document the VM detection type and sysctl a bit better. 2010-03-02 23:57:42 +00:00
subr_pcpu.c
subr_power.c
subr_prf.c Make /dev/klog and kern.msgbuf* MPSAFE. 2009-11-03 21:06:19 +00:00
subr_prof.c
subr_rman.c
subr_rtc.c
subr_sbuf.c
subr_scanf.c
subr_sglist.c
subr_sleepqueue.c Introduce the new kernel thread called "deadlock resolver". 2010-01-09 01:46:38 +00:00
subr_smp.c Remove forward_roundrobin(), it is unused for quite some time. 2009-09-21 13:09:56 +00:00
subr_stack.c
subr_taskqueue.c - Fix several off-by-one errors when using MAXCOMLEN. The p_comm[] and 2009-10-23 15:14:54 +00:00
subr_trap.c Current pselect(3) is implemented in usermode and thus vulnerable to 2009-10-27 10:55:34 +00:00
subr_turnstile.c Introduce the new kernel thread called "deadlock resolver". 2010-01-09 01:46:38 +00:00
subr_uio.c Decompose the most lousy named file in sys/kern; kern_subr.c. 2010-02-21 19:53:33 +00:00
subr_unit.c
subr_witness.c SLIP is gone; remove its mutex from witness. 2009-12-29 08:45:27 +00:00
sys_generic.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
sys_pipe.c Rename st_*timespec fields to st_*tim for POSIX 2008 compliance. 2010-03-28 13:13:22 +00:00
sys_process.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
sys_socket.c
syscalls.c Regenerate 2009-10-27 11:01:15 +00:00
syscalls.master Remove unused LIBCOMPAT keyword from syscalls.master. 2010-02-08 10:02:01 +00:00
systrace_args.c Regenerate 2009-10-27 11:01:15 +00:00
sysv_ipc.c Move SysV IPC freebsd32 compat shims helpers from freebsd32_misc.c to 2010-03-19 11:01:51 +00:00
sysv_msg.c Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding 2010-03-19 11:04:42 +00:00
sysv_sem.c Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding 2010-03-19 11:04:42 +00:00
sysv_shm.c Move SysV IPC freebsd32 compat shims from freebsd32_misc.c to corresponding 2010-03-19 11:04:42 +00:00
tty_compat.c Make TIOCSTI work again. 2010-01-04 20:59:52 +00:00
tty_info.c
tty_inq.c Remove statistics from the TTY queues. 2010-02-07 15:42:15 +00:00
tty_outq.c Remove statistics from the TTY queues. 2010-02-07 15:42:15 +00:00
tty_pts.c Do not leak master pty or ptmx vnode. 2010-04-08 08:58:18 +00:00
tty_tty.c
tty_ttydisc.c Print backspaces after echoing an EOF. 2009-10-17 08:59:41 +00:00
tty.c Make TIOCSTI work again. 2010-01-04 20:59:52 +00:00
uipc_accf.c (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument. 2009-12-28 22:56:30 +00:00
uipc_cow.c
uipc_debug.c
uipc_domain.c
uipc_mbuf2.c
uipc_mbuf.c
uipc_mqueue.c Rename st_*timespec fields to st_*tim for POSIX 2008 compliance. 2010-03-28 13:13:22 +00:00
uipc_sem.c Rename st_*timespec fields to st_*tim for POSIX 2008 compliance. 2010-03-28 13:13:22 +00:00
uipc_shm.c Rename st_*timespec fields to st_*tim for POSIX 2008 compliance. 2010-03-28 13:13:22 +00:00
uipc_sockbuf.c
uipc_socket.c Provide groundwork for 32-bit binary compatibility on non-x86 platforms, 2010-03-11 14:49:06 +00:00
uipc_syscalls.c Properly handle compat32 calls to sctp generic sendmsd/recvmsg functions that 2010-03-19 10:46:54 +00:00
uipc_usrreq.c Fix build on amd64, where sysctl arg1 is a pointer. 2009-10-05 22:23:12 +00:00
vfs_acl.c Add change that was somehow missed in r192586. It could manifest by 2009-12-03 13:29:24 +00:00
vfs_aio.c Convert aio syscall registration to SYSCALL_INIT_HELPER. 2010-03-19 11:11:34 +00:00
vfs_bio.c bo_bsize: revert r205860 and take an alternative approch in getblk 2010-04-02 15:12:31 +00:00
vfs_cache.c Fix typo. 2010-04-15 17:17:02 +00:00
vfs_cluster.c
vfs_default.c Supply default implementation of VOP_RENAME() that does neccessary 2010-04-02 14:03:43 +00:00
vfs_export.c Set the prison in NFS anon and GSS SVC creds. 2009-09-28 18:07:16 +00:00
vfs_extattr.c
vfs_hash.c
vfs_init.c
vfs_lookup.c Support only LOOKUP operation for "/" in relookup() because lookup() 2010-03-26 11:33:12 +00:00
vfs_mount.c - Reduce scope of vnode lock. vfs_mount_alloc() doesn't need vnode to be 2010-02-18 22:22:45 +00:00
vfs_subr.c Add missing MNT_NFS4ACLS. 2010-04-04 14:48:43 +00:00
vfs_syscalls.c Handle a case in kern_openat() when vn_open() change file type from 2010-04-13 08:52:20 +00:00
vfs_vnops.c vn_stat: take into account va_blocksize when setting st_blksize 2010-04-03 08:39:00 +00:00
vnode_if.src