1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00
freebsd/lib
Konstantin Belousov 2a339d9e3d 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
..
atf Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
clang Limit Options.inc generation to desired targets 2016-05-05 21:20:09 +00:00
csu Don't reset CC away from full-pathed gcc. 2016-03-24 21:48:10 +00:00
lib80211
libalias
libarchive MFV r299425: 2016-05-12 10:16:16 +00:00
libauditd
libbegemot
libblocksruntime
libbluetooth Improve performance and functionality of the bitstring(3) api 2016-05-04 22:34:11 +00:00
libbsdstat Fix off by one error in index limit calculation 2016-05-16 15:42:59 +00:00
libbsm
libbsnmp Remove NO_WERROR from libbsnmp/Makefile.inc 2016-05-13 21:17:49 +00:00
libbz2
libc Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
libc_nonshared
libc++
libcalendar
libcam Fix va_list handling 2016-04-28 18:41:55 +00:00
libcasper MFH 2016-04-16 02:32:12 +00:00
libclang_rt Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally. 2016-03-26 03:46:12 +00:00
libcom_err
libcompat rexec(3): use NULL instead of zero for pointers. 2016-04-18 14:37:26 +00:00
libcompiler_rt
libcrypt Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
libcuse libcuse: make more use of the howmany() macro when available. 2016-04-26 01:20:16 +00:00
libcxxrt MFH 2016-04-04 23:55:32 +00:00
libdevctl Add 'devctl delete' that calls device_delete_child(). 2016-04-27 16:33:17 +00:00
libdevinfo MFH 2016-04-04 23:55:32 +00:00
libdevstat
libdpv
libdwarf elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree 2016-04-21 12:58:29 +00:00
libedit lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libefi
libelf elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree 2016-04-21 12:58:29 +00:00
libelftc elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree 2016-04-21 12:58:29 +00:00
libevent
libexecinfo
libexpat
libfetch Use strlcpy() instead of strncpy() to copy the string returned by 2016-05-12 06:39:13 +00:00
libfigpar
libgeom
libgpio Use GPIOTOGGLE to toggle the pin state instead of read, modify and write. 2016-04-19 15:18:31 +00:00
libgssapi lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libiconv_modules
libipsec libipsec: use NULL instead of zero for pointers. 2016-04-18 15:08:31 +00:00
libjail
libkiconv lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libkvm lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libldns
liblzma
libmagic MFV r299716: file 5.27 2016-05-14 08:52:37 +00:00
libmd
libmemstat
libmilter
libmp libmp: Fix trivial buffer overrun 2016-05-12 03:53:20 +00:00
libmt
libnandfs
libnetbsd
libnetgraph
libngatm
libnv Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
libopenbsd
libopie
libpam Set retval in the empty password case to avoid a path through the 2016-05-16 15:32:02 +00:00
libpcap
libpe
libpjdlog
libpmc lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libproc Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
libprocstat
libradius
librpcsec_gss librpcsec_gss: remove redundant code. 2016-05-11 14:37:33 +00:00
librpcsvc
librt Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
librtld_db
libsbuf
libsdp lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libsm
libsmb
libsmdb
libsmutil
libsqlite3
libstand libstand: make more use of the howmany() macro when available. 2016-04-26 01:19:36 +00:00
libstdbuf
libstdthreads
libsysdecode MFH 2016-04-04 23:55:32 +00:00
libtacplus
libtelnet
libthr Add implementation of robust mutexes, hopefully close enough to the 2016-05-17 09:56:22 +00:00
libthread_db
libucl
libufs
libugidfw
libulog
libunbound
libusb lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libusbhid MFH 2016-04-11 15:24:59 +00:00
libutil Use strlcpy() instead of strncpy() to ensure that qf->fsname is NUL 2016-05-13 00:26:14 +00:00
libvgl MFH 2016-04-13 16:19:50 +00:00
libvmmapi lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libwrap
libxo Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
liby
libypclnt MFH 2016-04-16 02:32:12 +00:00
libz MFH 2016-04-04 23:55:32 +00:00
msun Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
ncurses DIRDEPS_BUILD: Run the staged bootstrap-tools version of build-tools. 2016-05-09 22:21:09 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
Makefile
Makefile.inc