freebsd-skq/share/man/man3
kib 8da898f26c Add implementation of robust mutexes, hopefully close enough to the
intention of the POSIX IEEE Std 1003.1TM-2008/Cor 1-2013.

A robust mutex is guaranteed to be cleared by the system upon either
thread or process owner termination while the mutex is held.  The next
mutex locker is then notified about inconsistent mutex state and can
execute (or abandon) corrective actions.

The patch mostly consists of small changes here and there, adding
neccessary checks for the inconsistent and abandoned conditions into
existing paths.  Additionally, the thread exit handler was extended to
iterate over the userspace-maintained list of owned robust mutexes,
unlocking and marking as terminated each of them.

The list of owned robust mutexes cannot be maintained atomically
synchronous with the mutex lock state (it is possible in kernel, but
is too expensive).  Instead, for the duration of lock or unlock
operation, the current mutex is remembered in a special slot that is
also checked by the kernel at thread termination.

Kernel must be aware about the per-thread location of the heads of
robust mutex lists and the current active mutex slot.  When a thread
touches a robust mutex for the first time, a new umtx op syscall is
issued which informs about location of lists heads.

The umtx sleep queues for PP and PI mutexes are split between
non-robust and robust.

Somewhat unrelated changes in the patch:
1. Style.
2. The fix for proper tdfind() call use in umtxq_sleep_pi() for shared
   pi mutexes.
3. Removal of the userspace struct pthread_mutex m_owner field.
4. The sysctl kern.ipc.umtx_vnode_persistent is added, which controls
   the lifetime of the shared mutex associated with a vnode' page.

Reviewed by:	jilles (previous version, supposedly the objection was fixed)
Discussed with:	brooks, Martin Simmons <martin@lispworks.com> (some aspects)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2016-05-17 09:56:22 +00:00
..
assert.3 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
ATOMIC_VAR_INIT.3 Escape Ed to prevent mandoc to avoid confusion with the mdoc's Ed macros 2014-12-26 21:11:33 +00:00
bitstring.3 Improve performance and functionality of the bitstring(3) api 2016-05-04 22:34:11 +00:00
end.3 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
fpgetround.3 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
intro.3 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
makedev.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
Makefile Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
Makefile.depend Add META_MODE support. 2015-06-13 19:20:56 +00:00
offsetof.3 Silence mandoc lint. 2014-07-29 19:41:00 +00:00
pthread_affinity_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_atfork.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_attr_affinity_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_attr_get_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_attr_setcreatesuspend_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_attr.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_barrier_destroy.3
pthread_barrierattr.3
pthread_cancel.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_cleanup_pop.3 Correct a typo: this is the manpage for pthread_cleanup_pop, not push. 2014-10-27 15:45:37 +00:00
pthread_cleanup_push.3 Clarify that pthread_cleanup_push()/pop() are implemented as macros that 2014-10-25 19:31:34 +00:00
pthread_cond_broadcast.3
pthread_cond_destroy.3
pthread_cond_init.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_cond_signal.3
pthread_cond_timedwait.3
pthread_cond_wait.3 Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
pthread_condattr.3
pthread_create.3 Xref pthread_cancel... 2014-03-16 01:17:09 +00:00
pthread_detach.3
pthread_equal.3
pthread_exit.3 Xref pthread_cancel... 2014-03-16 01:17:09 +00:00
pthread_getconcurrency.3 Fixing a typo. 2013-04-15 03:02:55 +00:00
pthread_getcpuclockid.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_getspecific.3 Added description of POSIX-specified behavior when invoked on a key from within that key's destructor. 2015-05-19 02:24:55 +00:00
pthread_getthreadid_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_join.3
pthread_key_create.3
pthread_key_delete.3
pthread_kill.3
pthread_main_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_multi_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_mutex_consistent.3 Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
pthread_mutex_destroy.3
pthread_mutex_init.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_mutex_lock.3 Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
pthread_mutex_timedlock.3 Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
pthread_mutex_trylock.3 Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
pthread_mutex_unlock.3 Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
pthread_mutexattr_getkind_np.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_mutexattr.3 Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
pthread_once.3
pthread_resume_all_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_resume_np.3 Warn about consequences of suspending threads in arbitrary state of 2016-05-05 10:22:19 +00:00
pthread_rwlock_destroy.3
pthread_rwlock_init.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_rwlock_rdlock.3
pthread_rwlock_timedrdlock.3
pthread_rwlock_timedwrlock.3
pthread_rwlock_unlock.3
pthread_rwlock_wrlock.3
pthread_rwlockattr_destroy.3
pthread_rwlockattr_getpshared.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_rwlockattr_init.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_rwlockattr_setpshared.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
pthread_schedparam.3
pthread_self.3
pthread_set_name_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_setspecific.3 Provide an unambiguous description of the potential hazard in calling 2015-05-28 16:18:41 +00:00
pthread_sigmask.3
pthread_spin_init.3
pthread_spin_lock.3
pthread_suspend_all_np.3 Warn about consequences of suspending threads in arbitrary state of 2016-05-05 10:22:19 +00:00
pthread_suspend_np.3 Warn about consequences of suspending threads in arbitrary state of 2016-05-05 10:22:19 +00:00
pthread_switch_add_np.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
pthread_testcancel.3 Make wait6(2), waitid(3) and ppoll(2) cancellation points. The 2015-04-18 21:35:41 +00:00
pthread_yield.3
pthread.3 sort SEE ALSO 2014-12-26 22:41:10 +00:00
queue.3 Make the system queue header file fully usable within C++ programs by 2015-06-28 21:06:45 +00:00
siginfo.3 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
stdarg.3 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
sysexits.3 Bump date missed in r202756 2012-09-14 17:50:42 +00:00
tgmath.3 Fix a typographical error. 2015-01-06 23:04:41 +00:00
timeradd.3
tree.3 Provide individual prototype and generate macros for the red-black tree. 2015-01-24 12:43:36 +00:00