freebsd-dev/sys/kern
Mike Makonnen 994599d782 Fix umtx locking, for libthr, in the kernel.
1. There was a race condition between a thread unlocking
   a umtx and the thread contesting it. If the unlocking
   thread won the race it may try to wakeup a thread that
   was not yet in msleep(). The contesting thread would then
   go to sleep to await a wakeup that would never come. It's
   not possible to close the race by using a lock because
   calls to casuptr() may have to fault a page in from swap.
   Instead, the race was closed by introducing a flag that
   the unlocking thread will set when waking up a thread.
   The contesting thread will check for this flag before
   going to sleep. For now the flag is kept in td_flags,
   but it may be better to use some other member or create
   a new one because of the possible performance/contention
   issues of having to own sched_lock. Thanks to jhb for
   pointing me in the right direction on this one.

2. Once a umtx was contested all future locks and unlocks
   were happening in the kernel, regardless of whether it
   was contested or not. To prevent this from happening,
   when a thread locks a umtx it checks the queue for that
   umtx and unsets the contested bit if there are no other
   threads waiting on it. Again, this is slightly more
   complicated than it needs to be because we can't hold
   a lock across casuptr(). So, the thread has to check
   the queue again after unseting the bit, and reset the
   contested bit if it finds that another thread has put
   itself on the queue in the mean time.

3. Remove the if... block for unlocking an uncontested
   umtx, and replace it with a KASSERT. The _only_ time
   a thread should be unlocking a umtx in the kernel is
   if it is contested.
2003-07-17 11:06:40 +00:00
..
bus_if.m Give print_child a default method. 2003-03-25 04:32:52 +00:00
clock_if.m
device_if.m
genassym.sh
imgact_aout.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
imgact_elf32.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
imgact_elf64.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
imgact_elf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
imgact_gzip.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
imgact_shell.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
inflate.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
init_main.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
init_sysent.c Regen from syscalls.master:1.149, addition of extended attribute 2003-06-04 03:50:20 +00:00
kern_acct.c Change the style of the english used to print accounting enabled 2003-07-16 13:20:10 +00:00
kern_acl.c Add a f_vnode field to struct file. 2003-06-22 08:41:43 +00:00
kern_alq.c Add an explicit credential argument to alq_open() to allow the caller to 2003-06-22 22:28:56 +00:00
kern_clock.c Fix this to build on alpha. Build test successful. 2003-06-27 08:35:05 +00:00
kern_condvar.c Allow SA process unblocks a thread blocked in condition variable. 2003-07-02 01:19:15 +00:00
kern_conf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_context.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_descrip.c Extend the mutex pool implementation to permit the creation and use of 2003-07-13 01:22:21 +00:00
kern_environment.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_event.c Initialize struct fileops with C99 sparse initialization. 2003-06-18 18:16:40 +00:00
kern_exec.c Rename P_THREADED to P_SA. P_SA means a process is using scheduler 2003-06-15 00:31:24 +00:00
kern_exit.c Rename P_THREADED to P_SA. P_SA means a process is using scheduler 2003-06-15 00:31:24 +00:00
kern_fork.c Add a ratelimited message of the form 2003-06-19 05:57:25 +00:00
kern_idle.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_intr.c Make swi_vm be INTR_MPSAFE. On all platforms, it is only used to activate 2003-07-01 16:00:38 +00:00
kern_jail.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_kse.c If initial thread is still a bound thread, don't change its signal mask. 2003-07-15 14:04:38 +00:00
kern_kthread.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_ktr.c Add an explicit credential argument to alq_open() to allow the caller to 2003-06-22 22:28:56 +00:00
kern_ktrace.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_linker.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_lock.c Rearrange the SYSINIT order to call lockmgr_init() earlier so that 2003-07-16 01:00:39 +00:00
kern_lockf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_mac.c Redesign the externalization APIs from the MAC Framework to 2003-06-23 01:26:34 +00:00
kern_malloc.c Add init_param3() to subr_param. This function is called 2003-07-11 00:01:03 +00:00
kern_mib.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_module.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_mtxpool.c Rearrange the SYSINIT order to call lockmgr_init() earlier so that 2003-07-16 01:00:39 +00:00
kern_mutex.c - Add comments about the maintenance of the per-thread list of contested 2003-07-02 16:14:09 +00:00
kern_ntptime.c During a positive leap second, the tai_time offset should be 2003-06-25 20:56:40 +00:00
kern_physio.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_poll.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_proc.c Make the system call vector name of a process accessible to user 2003-07-12 02:00:16 +00:00
kern_prot.c Extend the mutex pool implementation to permit the creation and use of 2003-07-13 01:22:21 +00:00
kern_resource.c Extend the mutex pool implementation to permit the creation and use of 2003-07-13 01:22:21 +00:00
kern_sema.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_shutdown.c Don't overwrite the static panicstr buffer for secondary and further 2003-06-15 11:43:00 +00:00
kern_sig.c Rename thread_siginfo to cpu_thread_siginfo 2003-07-15 04:26:26 +00:00
kern_subr.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_switch.c Rename P_THREADED to P_SA. P_SA means a process is using scheduler 2003-06-15 00:31:24 +00:00
kern_sx.c Extend the mutex pool implementation to permit the creation and use of 2003-07-13 01:22:21 +00:00
kern_synch.c unifdef -DLAZY_SWITCH and start to tidy up the associated glue. 2003-07-10 01:02:59 +00:00
kern_syscalls.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_sysctl.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_tc.c typo fix in comment. 2003-07-02 08:01:52 +00:00
kern_thr.c style(9) 2003-07-04 06:59:28 +00:00
kern_thread.c If initial thread is still a bound thread, don't change its signal mask. 2003-07-15 14:04:38 +00:00
kern_time.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_timeout.c Don't put callout_lock under #ifdef DIAGNOSTIC despite the fact that it 2003-06-20 08:39:04 +00:00
kern_umtx.c Fix umtx locking, for libthr, in the kernel. 2003-07-17 11:06:40 +00:00
kern_uuid.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
kern_xxx.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
ksched.c Use __FBSDID(). 2003-06-11 06:34:30 +00:00
link_elf_obj.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
link_elf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
linker_if.m
Make.tags.inc Finish driving a stake through the heart of netns and the associated 2003-03-05 19:24:24 +00:00
Makefile Finish driving a stake through the heart of netns and the associated 2003-03-05 19:24:24 +00:00
makesyscalls.sh - Include umtx.h in files generated by makesyscalls.sh 2003-04-01 01:12:24 +00:00
md4c.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
md5c.c Use le32dec() instead of le32toh() because we are not guaranteed to have 2003-05-05 07:22:35 +00:00
p1003_1b.c Use __FBSDID(). 2003-06-11 06:34:30 +00:00
posix4_mib.c Use __FBSDID(). 2003-06-11 06:34:30 +00:00
sched_4bsd.c Rename P_THREADED to P_SA. P_SA means a process is using scheduler 2003-06-15 00:31:24 +00:00
sched_ule.c - When stealing a kse in kseq_move() ignore the current kseq's min nice 2003-07-08 06:19:40 +00:00
subr_acl_posix1e.c Add a f_vnode field to struct file. 2003-06-22 08:41:43 +00:00
subr_autoconf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_blist.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_bus.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_clist.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_clock.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_devstat.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_disk.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_eventhandler.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_hints.c Add a resource_disabled() helper function that returns true (non-zero) if 2003-07-02 16:01:38 +00:00
subr_kobj.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_log.c Replace the code for reading and writing the kernel message buffer 2003-06-22 02:18:31 +00:00
subr_mbpool.c Add a facility for devices, specifically network interfaces, that require 2003-07-15 08:59:38 +00:00
subr_mbuf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_mchain.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_module.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_msgbuf.c Replace the code for reading and writing the kernel message buffer 2003-06-22 02:18:31 +00:00
subr_param.c Add init_param3() to subr_param. This function is called 2003-07-11 00:01:03 +00:00
subr_pcpu.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_power.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_prf.c When DDB is active, always send printf() output directly to the 2003-06-22 03:20:24 +00:00
subr_prof.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_rman.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_rtc.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_sbuf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_scanf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_smp.c Document some sysctl variables. 2003-06-12 19:46:51 +00:00
subr_taskqueue.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
subr_trap.c o Change kse_thr_interrupt to allow send a signal to a specified thread, 2003-06-28 08:29:05 +00:00
subr_turnstile.c - Add comments about the maintenance of the per-thread list of contested 2003-07-02 16:14:09 +00:00
subr_witness.c unifdef -DLAZY_SWITCH and start to tidy up the associated glue. 2003-07-10 01:02:59 +00:00
subr_xxx.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
sys_generic.c Introduce a new flag on a file descriptor: DFLAG_SEEKABLE and use that 2003-06-18 19:53:59 +00:00
sys_pipe.c A few minor changes: 2003-07-09 21:59:48 +00:00
sys_process.c Add vm object locking. 2003-06-11 06:43:48 +00:00
sys_socket.c Initialize struct fileops with C99 sparse initialization. 2003-06-18 18:16:40 +00:00
syscalls.c Regen from syscalls.master:1.149, addition of extended attribute 2003-06-04 03:50:20 +00:00
syscalls.master o Change kse_thr_interrupt to allow send a signal to a specified thread, 2003-06-28 08:29:05 +00:00
sysv_ipc.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
sysv_msg.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
sysv_sem.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
sysv_shm.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
tty_compat.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
tty_conf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
tty_cons.c Use a new message buffer `consmsgbuf' to forward messages to a 2003-06-22 02:54:33 +00:00
tty_pty.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
tty_subr.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
tty_tty.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
tty.c Use a new message buffer `consmsgbuf' to forward messages to a 2003-06-22 02:54:33 +00:00
uipc_accf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_cow.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_domain.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_jumbo.c Lock the vm object when removing a page. 2003-06-11 21:23:04 +00:00
uipc_mbuf2.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_mbuf.c Hide the m_defrag* statistics under MBUF_STRESS_TEST, there seems 2003-06-17 02:34:40 +00:00
uipc_proto.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_sem.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_sockbuf.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_socket2.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
uipc_socket.c Rev 1.121 meant to pass the value 1 to soalloc() to indicate waitok. 2003-07-14 20:39:22 +00:00
uipc_syscalls.c VOP_GETVOBJECT() wants to be called with the vnode lock held. 2003-06-19 03:55:01 +00:00
uipc_usrreq.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
vfs_acl.c Add a f_vnode field to struct file. 2003-06-22 08:41:43 +00:00
vfs_aio.c Add a f_vnode field to struct file. 2003-06-22 08:41:43 +00:00
vfs_bio.c Initialize b_saveaddr when we hand out buffers 2003-06-20 08:26:38 +00:00
vfs_cache.c Make the VFS cache use zones instead of malloc(9). This results in a 2003-06-13 08:46:13 +00:00
vfs_cluster.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
vfs_default.c I have not had any reports of trouble for a long time, so remove the 2003-06-15 19:49:14 +00:00
vfs_export.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
vfs_extattr.c Use the f_vnode field to tell which file descriptors have a vnode. 2003-07-04 12:20:27 +00:00
vfs_init.c Initialize struct vfsops C99-sparsely. 2003-06-12 20:48:38 +00:00
vfs_lookup.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
vfs_mount.c Add a new mount flag MNT_BYFSID that can be used to unmount a file 2003-07-01 17:40:23 +00:00
vfs_subr.c Use __FBSDID(). 2003-06-11 00:56:59 +00:00
vfs_syscalls.c Use the f_vnode field to tell which file descriptors have a vnode. 2003-07-04 12:20:27 +00:00
vfs_vnops.c Prefer the vop_rmextattr() vnode operation for removing extended 2003-06-22 23:03:07 +00:00
vnode_if.src Expose vop_rmextattr as an explicit operation at the vnode operation 2003-06-22 22:45:24 +00:00