about summary refs log tree commit diff
path: root/nptl
Commit message (Collapse)AuthorAgeFilesLines
* Generate .test-result files for tests with special rules.Joseph Myers2014-02-212-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch, an updated version of <https://sourceware.org/ml/libc-alpha/2014-01/msg00194.html> now proposed for inclusion in glibc, extends the generation of PASS and FAIL status in .test-result files for individual tests to cover tests with their own custom makefile rules. This is just adding $(evaluate-test) calls to all such rules, since tests with multiple commands were previously split into separate tests. Note that the tests the makefiles expect to fail (posix/annexc and conformtest) currently get FAIL listed in the .test-result file, rather than XFAIL; a subsequent patch will introduce a better XFAIL mechanism. Tested x86_64. * Makefile ($(objpfx)c++-types-check.out): Use $(evaluate-test). ($(objpfx)check-local-headers.out): Likewise. ($(objpfx)begin-end-check.out): Likewise. * Makerules (check-abi-%.out): Likewise. * catgets/Makefile ($(objpfx)test1.cat): Likewise. ($(objpfx)test2.cat): Likewise. ($(objpfx)de/libc.cat): Likewise. ($(objpfx)test-gencat.out): Likewise. * conform/Makefile ($(objpfx)run-conformtest.out): Likewise. * elf/Makefile ($(objpfx)order-cmp.out): Likewise. ($(objpfx)noload-mem): Likewise. ($(objpfx)tst-pathopt.out): Likewise. ($(objpfx)tst-rtld-load-self.out): Likewise. ($(objpfx)tst-array1-cmp.out): Likewise. ($(objpfx)tst-array1-static-cmp.out): Likewise. ($(objpfx)tst-array2-cmp.out): Likewise. ($(objpfx)tst-array3-cmp.out): Likewise. ($(objpfx)tst-array4-cmp.out): Likewise. ($(objpfx)tst-array5-cmp.out): Likewise. ($(objpfx)tst-array5-static-cmp.out): Likewise. ($(objpfx)check-textrel.out): Likewise. ($(objpfx)check-execstack.out): Likewise. ($(objpfx)check-localplt.out): Likewise. ($(objpfx)order2-cmp.out): Likewise. ($(objpfx)tst-leaks1-mem): Likewise. ($(objpfx)tst-leaks1-static-mem): Likewise. ($(objpfx)tst-initorder-cmp.out): Likewise. ($(objpfx)tst-initorder2-cmp.out): Likewise. ($(objpfx)tst-unused-dep.out): Likewise. ($(objpfx)tst-unused-dep-cmp.out): Likewise. * grp/Makefile ($(objpfx)tst_fgetgrent.out): Likewise. * iconv/Makefile (test-iconvconfig): Likewise. * iconvdata/Makefile ($(objpfx)mtrace-tst-loading): Likewise. ($(objpfx)iconv-test.out): Likewise. ($(objpfx)tst-tables.out): Likewise. * intl/Makefile ($(objpfx)mtrace-tst-gettext): Likewise. ($(objpfx)tst-gettext.out): Likewise. ($(objpfx)tst-translit.out): Likewise. ($(objpfx)tst-gettext2.out): Likewise. ($(objpfx)tst-gettext4.out): Likewise. ($(objpfx)tst-gettext6.out): Likewise. * io/Makefile ($(objpfx)ftwtest.out): Likewise. * libio/Makefile ($(objpfx)test-freopen.out): Likewise. ($(objpfx)tst-fopenloc-cmp.out): Likewise. ($(objpfx)tst-fopenloc-mem.out): Likewise. * malloc/Makefile ($(objpfx)tst-mtrace.out): Likewise. * misc/Makefile ($(objpfx)tst-error1-mem): Likewise. * posix/Makefile ($(objpfx)globtest.out): Likewise. ($(objpfx)wordexp-tst.out): Likewise. ($(objpfx)annexc.out): Likewise. ($(objpfx)tst-fnmatch-mem): Likewise. ($(objpfx)bug-regex2-mem): Likewise. ($(objpfx)bug-regex14-mem): Likewise. ($(objpfx)bug-regex21-mem): Likewise. ($(objpfx)bug-regex31-mem): Likewise. ($(objpfx)tst-vfork3-mem): Likewise. ($(objpfx)tst-rxspencer-no-utf8-mem): Likewise. ($(objpfx)tst-pcre-mem): Likewise. ($(objpfx)tst-boost-mem): Likewise. ($(objpfx)tst-getconf.out): Likewise. ($(objpfx)bug-ga2-mem): Likewise. ($(objpfx)bug-glob2-mem): Likewise. * resolv/Makefile ($(objpfx)mtrace-tst-leaks): Likewise. ($(objpfx)mtrace-tst-leaks2): Likewise. * stdio-common/Makefile ($(objpfx)tst-unbputc.out): Likewise. ($(objpfx)tst-printf.out): Likewise. ($(objpfx)tst-setvbuf1.out): Likewise. ($(objpfx)tst-setvbuf1-cmp.out): Likewise. * stdlib/Makefile ($(objpfx)isomac.out): Likewise. ($(objpfx)tst-fmtmsg.out): Likewise. * string/Makefile ($(objpfx)tst-svc-cmp.out): Likewise. * sysdeps/x86/Makefile ($(objpfx)tst-xmmymm.out): Likewise. localedata: * Makefile ($(objpfx)sort-test.out): Use $(evaluate-test). ($(objpfx)tst-fmon.out): Likewise. ($(objpfx)tst-numeric.out): Likewise. ($(objpfx)tst-locale.out): Likewise. ($(objpfx)tst-rpmatch.out): Likewise. ($(objpfx)tst-trans.out): Likewise. ($(objpfx)tst-mbswcs.out): Likewise. ($(objpfx)tst-ctype.out): Likewise. ($(objpfx)tst-wctype.out): Likewise. ($(objpfx)tst-langinfo.out): Likewise. ($(objpfx)mtrace-tst-leaks): Likewise. nptl: * Makefile ($(objpfx)tst-stack3-mem): Use $(evaluate-test). ($(objpfx)tst-tls6.out): Likewise. ($(objpfx)tst-cleanup0.out): Likewise. ($(objpfx)tst-cleanup0-cmp.out): Likewise. ($(objpfx)tst-cancel-wrappers.out): Likewise. ($(objpfx)tst-oddstacklimit.out): Likewise. nptl_db: * Makefile ($(objpfx)db-symbols.out): Use $(evaluate-test).
* Split up rules for tests that compare output with baselines.Joseph Myers2014-02-142-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch splits makefile rules that generate a file then run cmp to check the contents of that file into separate rules to generate and compare the file. This simplifies making those tests generate PASS / FAIL results, by removing the need to insert && between commands in the test so that a $(evaluate-test) call is reached. It also avoids the oddity of the .out file being an intermediate file rather than the final result generated, as noted for some of these tests in <https://sourceware.org/ml/libc-alpha/2012-10/msg00894.html>. In many cases, the rule to run the program was no longer needed because the default rules for running test programs on the host to generate a .out file sufficed. (I'm not asserting the commands run after this patch are *exactly* the same as before, simply that the rules did nothing special that appeared deliberate or relevant to anything about what the tests were testing. In cases where the rules redirected stderr as well as stdout, I left the existing rule's redirection in place to avoid changing what gets compared with the expected results.) It's clear there is a lot in common between the various -cmp.out rules and it might be possible in future to refactor them into more generic support for the case of comparing test output against a baseline. (Some baselines are *.exp, some *.expect, some directly embedded in the makefiles, and nptl/tst-cleanupx0.expect appears unused.) Tested x86_64. * elf/Makefile ($(objpfx)order.out): Remove rule. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)order-cmp.out. ($(objpfx)order-cmp.out): New rule. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)tst-array1-cmp.out, $(objpfx)tst-array1-static-cmp.out, $(objpfx)tst-array2-cmp.out, $(objpfx)tst-array3-cmp.out, $(objpfx)tst-array4-cmp.out, $(objpfx)tst-array5-cmp.out and $(objpfx)tst-array5-static-cmp.out. ($(objpfx)tst-array1.out): Remove rule. ($(objpfx)tst-array1-cmp.out): New rule. ($(objpfx)tst-array1-static.out): Remove rule. ($(objpfx)tst-array1-static-cmp.out): New rule. ($(objpfx)tst-array2.out): Remove rule. ($(objpfx)tst-array2-cmp.out): New rule. ($(objpfx)tst-array3.out): Remove rule. ($(objpfx)tst-array3-cmp.out): New rule. ($(objpfx)tst-array4.out): Remove rule. ($(objpfx)tst-array4-cmp.out): New rule. ($(objpfx)tst-array5.out): Remove rule. ($(objpfx)tst-array5-cmp.out): New rule. ($(objpfx)tst-array5-static.out): Remove rule. ($(objpfx)tst-array5-static-cmp.out): New rule. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)order2-cmp.out. ($(objpfx)order2.out): Remove rule. ($(objpfx)order2-cmp.out): New rule. ($(objpfx)tst-initorder.out): Remove rule. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)tst-initorder-cmp.out. ($(objpfx)tst-initorder-cmp.out): New rule. ($(objpfx)tst-initorder2.out): Remove rule. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)tst-initorder2-cmp.out. ($(objpfx)tst-initorder2-cmp.out): New rule. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)tst-unused-dep-cmp.out. ($(objpfx)tst-unused-dep-cmp.out): Do not run cmp. ($(objpfx)tst-unused-dep-cmp.out): New rule. * stdio-common/Makefile [$(run-built-tests) = yes] (tests): Depend on $(objpfx)tst-setvbuf1-cmp.out. ($(objpfx)tst-setvbuf1.out): Do not run cmp. ($(objpfx)tst-setvbuf1-cmp.out): New rule. * string/Makefile [$(run-built-tests) = yes] (tests): Depend $(objpfx)tst-svc-cmp.out instead of $(objpfx)tst-svc.out. ($(objpfx)tst-svc.out): Remove rule. ($(objpfx)tst-svc-cmp.out): New rule. nptl: * Makefile ($(objpfx)tst-cleanup0.out): Do not run cmp. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)tst-cleanup0-cmp.out. ($(objpfx)tst-cleanup0-cmp.out): New rule.
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-1054-129/+202
|
* sem_open: allow RAMFS_MAGIC for mount pointsMike Frysinger2014-02-082-2/+8
| | | | | | | A ramfs mount supports the same requirements as a tmpfs, so accept that as a magic type too. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Revert "Patch 3/4 of the effort to make TLS access async-signal-safe."Allan McRae2014-02-061-1/+5
| | | | This reverts commit 35e8f7ab94c910659de9d507aa0f3e1f8973d914.
* Revert "Async-signal safe TLS."Allan McRae2014-02-065-210/+7
| | | | | | | | | This reverts commit 7f507ee17aee720fa423fa38502bc3caa0dd03d7. Conflicts: ChangeLog nptl/tst-tls7.c nptl/tst-tls7mod.c
* Fix tst-setgetname for Linux kernels < 2.6.33.Carlos O'Donell2014-02-052-0/+20
| | | | | | | | Support for /proc/self/task/$tid/comm as added in Linux 2.6.33, therefore since the test tst-setgetname relies on this functionality to operate we must skip the test in kernels < 2.6.33. We wrap the checks with __ASSUME_PROC_PID_TASK_COMM such that in the future when we move arch_minimum_kernel to 2.6.33 we can remove this code.
* PowerPC: Change powerpc64le start ABI to 2.17.Adhemerval Zanella2014-02-041-1/+1
|
* S/390: Increase tst-tls7 test case timeoutStefan Liebler2014-01-232-1/+5
| | | | | | | | TLS in a dlopened object works fine when accessed from a signal handler. The default kernel scheduling parameters prevents the testcase to finish within the 4 seconds. Tested the bigger timeout on s390 and s390x.
* Don't check asynchronous cancellation on systemH.J. Lu2014-01-182-1/+5
| | | | | | | | | | | | | | | | | | | | Since asynchronous cancellation was removed from system by commit c4dd57c300aa05ab2f957d571c321237a58d0368 Author: Ondřej Bílka <neleai@seznam.cz> Date: Tue Jan 14 16:07:50 2014 +0100 Do not enable asynchronous cancellation in system. Fixes bug 14782. We needlessly enabled thread cancellation before it was necessary. As only call that needs to be guarded is waitpid which is cancellation point we could remove cancellation altogether. we shouldn't check asynchronous cancellation on system. [BZ #14782] * tst-cancel-wrappers.sh: Remove system.
* Fix a race in tst-tls7, which caused crashes on ppc32.Paul Pluzhnikov2014-01-113-5/+31
|
* S/390: Make jmp_buf extendible.Andreas Krebbel2014-01-072-0/+68
|
* Async-signal safe TLS.Andrew Hunter2014-01-035-7/+190
| | | | | | | | | | | | | | | | | | | | | | ChangeLog: 2014-01-03 Andrew Hunter <ahh@google.com> * elf/dl-open.c (): New comment. * elf/dl-reloc.c (_dl_try_allocate_static_tls): Use atomic_compare_and_exchange_bool_acq (_dl_allocate_static_tls): Block signals. * elf/dl-tls.c (allocate_and_init): Return void. (_dl_update_slotinfo): Block signals, use atomic update. nptl/ChangeLog: 2014-01-03 Andrew Hunter <ahh@google.com> * nptl/Makefile (tst-tls7): New test. * nptl/tst-tls7.c: New file. * nptl/tst-tls7mod.c: New file. * nptl/allocatestack.c (init_one_static_tls): Use atomic barrier.
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-01664-664/+664
|
* Patch 3/4 of the effort to make TLS access async-signal-safe.Paul Pluzhnikov2013-12-181-5/+1
| | | | | | | | | | | Factor out _dl_clear_dtv. 2013-12-18 Andrew Hunter <ahh@google.com> * elf/Versions (ld): Add _dl_clear_dtv. * sysdeps/generic/ldsodefs.h (_dl_clear_dtv): New prototype. * elf/dl-tls.c (_dl_clear_dtv): New function. * nptl/allocatestack.c (get_cached_stack): Call _dl_clear_dtv.
* PowerPC: Add DSO and TAR fields to TLSAdhemerval Zanella2013-12-123-0/+13
|
* Add test case for pthread_[sg]etname_np.Carlos O'Donell2013-12-123-0/+307
| | | | | | | | | This commit adds a testcase for pthread_setname_np and pthread_getname_np. The testcase itself has four tests to validate that these functions work as expected. The test is only enabled for Linux since it requires access to an alternate method for validating the functions work.
* ChangeLog whitespace fix.Roland McGrath2013-12-111-0/+1
|
* Fix CFI annotations in pthread_cond_timedwait for i486+Andreas Schwab2013-12-092-2/+8
|
* PowerPC64 ELFv2 ABI 4/6: Stack frame layout changesUlrich Weigand2013-12-042-26/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates glibc for the changes in the ELFv2 relating to the stack frame layout. These are described in more detail here: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html Specifically, the "compiler and linker doublewords" were removed, which has the effect that the save slot for the TOC register is now at offset 24 rather than 40 to the stack pointer. In addition, a function may now no longer necessarily assume that its caller has set up a 64-byte register save area its use. To address the first change, the patch goes through all assembler files and replaces immediate offsets in instructions accessing the ABI-defined stack slots by symbolic offsets. Those already were defined in ucontext_i.sym and used in some of the context routines, but that doesn't really seem like the right place for those defines. The patch instead defines those symbolic offsets in sysdeps.h, in two variants for the old and new ABI, and uses them systematically in all assembler files, not just the context routines. The second change only affected a few assembler files that used the save area to temporarily store some registers. In those cases where this happens within a leaf function, this patch changes the code to store those registers to the "red zone" below the stack pointer. Otherwise, the functions already allocate a stack frame, and the patch changes them to add extra space in these frames as temporary space for the ELFv2 ABI.
* PowerPC64: Add __private_ss field to TCB headerUlrich Weigand2013-12-041-0/+2
| | | | | | | | | | | | | | | The TCB header on Intel contains a field __private_ss that is used to efficiently implement the -fsplit-stack GCC feature. In order to prepare for a possible future implementation of that feature on powerpc64, we'd like to reserve a similar field in the TCB header as well. (It would be good if this went in with or before the ELFv2 patches to ensure that this field will be available always in the ELFv2 environment.) The field needs to be added at the front of tcbhead_t structure to avoid changing the ABI; see the recent discussion when adding the EBB fields.
* Use __glibc_reserved instead __unused.Ondřej Bílka2013-11-263-3/+7
|
* Fix intermittent failure in tst-getpid2.Paul Pluzhnikov2013-11-252-0/+10
| | | | | | | 2013-11-25 Paul Pluzhnikov <ppluzhnikov@google.com> [BZ #11214] * Makefile (tst-getpid2-ENV): New variable.
* Fix missing > on email.Paul Pluzhnikov2013-11-201-1/+1
|
* Fix failure in tst-cleanup2 and tst-cleanupx2 with gcc-4.9Paul Pluzhnikov2013-11-202-0/+8
| | | | | | | | gcc (GCC) 4.9.0 20131114 (experimental) 2013-11-20 Paul Pluzhnikov <ppluzhnikov@google.com * Makefile (tst-cleanup2, tst-cleanupx2): Add -fno-builtin
* Revert "Fix failure in nptl/tst-cleanup when building with"Paul Pluzhnikov2013-11-201-6/+0
| | | | | | This reverts commit 78271fa91a1e6902222e892068750059ec21f396. Actually, a different fix is needed.
* Fix failure in nptl/tst-cleanup when building withPaul Pluzhnikov2013-11-201-0/+6
| | | | | | | | gcc (GCC) 4.9.0 20131114 (experimental) 2013-11-20 Paul Pluzhnikov <ppluzhnikov@google.com> * nptl/tst-cleanup2.c (do_test): Handle SIGILL as well.
* rename configure.in to configure.acMike Frysinger2013-10-305-2/+11
| | | | | | | Autoconf has been deprecating configure.in for quite a long time. Rename all our configure.in and preconfigure.in files to .ac. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* nptl: tst-mutex8.c: Handle ENOTSUP PI mutex failureMaciej W. Rozycki2013-10-052-2/+15
|
* PowerPC LE configuryAlan Modra2013-10-041-0/+1
| | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00096.html This adds the basic configury bits for powerpc64le and powerpcle. * configure.in: Map powerpc64le and powerpcle to base_machine/machine. * configure: Regenerate. * nptl/shlib-versions: Powerpc*le starts at 2.18. * shlib-versions: Likewise.
* PowerPC ugly symbol versioningAlan Modra2013-10-041-9/+4
| | | | | | | | | | | | | | | | | | | | | | | http://sourceware.org/ml/libc-alpha/2013-08/msg00090.html This patch fixes symbol versioning in setjmp/longjmp. The existing code uses raw versions, which results in wrong symbol versioning when you want to build glibc with a base version of 2.19 for LE. Note that the merging the 64-bit and 32-bit versions in novmx-lonjmp.c and pt-longjmp.c doesn't result in GLIBC_2.0 versions for 64-bit, due to the base in shlib_versions. * sysdeps/powerpc/longjmp.c: Use proper symbol versioning macros. * sysdeps/powerpc/novmx-longjmp.c: Likewise. * sysdeps/powerpc/powerpc32/bsd-_setjmp.S: Likewise. * sysdeps/powerpc/powerpc32/bsd-setjmp.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/__longjmp.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/setjmp.S: Likewise. * sysdeps/powerpc/powerpc32/mcount.c: Likewise. * sysdeps/powerpc/powerpc32/setjmp.S: Likewise. * sysdeps/powerpc/powerpc64/setjmp.S: Likewise. * nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c: Likewise.
* Fix PI mutex check in pthread_cond_broadcast and pthread_cond_signalSiddhesh Poyarekar2013-10-013-10/+11
| | | | | | | | Fixes BZ #15988. The check had a typo - it checked for PTHREAD_MUTEX_ROBUST_NP instead of PTHREAD_MUTEX_ROBUST_NORMAL_NP. It has now been replaced by the already existing convenience macro USE_REQUEUE_PI.
* Move ChangeLog entrySiddhesh Poyarekar2013-09-271-0/+8
|
* Use the mutex member of the argumen in __libc_lock_*_recursiveSiddhesh Poyarekar2013-09-271-3/+3
|
* Remove --disable-versioning.Joseph Myers2013-09-042-1/+7
|
* Mark success return value as volatile to work around reschedulingSiddhesh Poyarekar2013-09-032-1/+13
| | | | | | | | | | | | | Resolves #15921 The test case nptl/tst-cleanup2 fails on s390x and power6 due to instruction sheduling in gcc. This was reported in gcc: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58034 but it was concluded that gcc is allowed to assume that the first argument to sprintf is a character array - NULL not being a valid character array.
* Fix typos.Ondřej Bílka2013-08-304-4/+10
|
* Fix typos.Ondřej Bílka2013-08-213-2/+7
|
* Remove Linux kernel version ambiguity in comment added by previous commit.David S. Miller2013-07-232-2/+6
| | | | * tst-cancel4.c (WRITE_BUFFER_SIZE): Adjust comment.
* Increase nptl test case buffer size so we really block on current Linux kernels.David S. Miller2013-07-232-1/+28
| | | | * tst-cancel4.c (WRITE_BUFFER_SIZE): Increase to 16384.
* Clean up whitespace in lock elision patches.Dominik Vogt2013-07-1915-31/+52
| | | | Signed-off-by: Carlos O'Donell <carlos@redhat.com>
* Remove remains of rwlock elision which is not implemented yet.Dominik Vogt2013-07-193-11/+8
| | | | | | | | | | | | | | | Signed-off-by: Carlos O'Donell <carlos@redhat.com> --- nptl/ 2013-07-19 Dominik Vogt <vogt@de.ibm.com> * sysdeps/unix/sysv/linux/x86/elision-conf.c: Remove __rwlock_rtm_enabled and __rwlock_rtm_read_retries. (elision_init): Don't set __rwlock_rtm_enabled. * sysdeps/unix/sysv/linux/x86/elision-conf.h: Remove __rwlock_rtm_enabled.
* Add x86 init-arch to nptlH.J. Lu2013-07-033-0/+7
|
* Add a configure option to enable lock elision and disable by defaultAndi Kleen2013-07-022-0/+8
| | | | Can be enabled with --enable-lock-elision=yes at configure time.
* Disable elision for any pthread_mutexattr_settype callAndi Kleen2013-07-022-0/+10
| | | | | | | | | | PTHREAD_MUTEX_NORMAL requires deadlock for nesting, DEFAULT does not. Since glibc uses the same value (0) disable elision for any call to pthread_mutexattr_settype() with a 0 value. This implies that a program can disable elision by doing pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL) Based on a original proposal by Rich Felker.
* Add elision to pthread_mutex_{try,timed,un}lockAndi Kleen2013-07-0214-24/+267
| | | | | | | | | | | | | | | | | | | | | | | Add elision paths to the basic mutex locks. The normal path has a check for RTM and upgrades the lock to RTM when available. Trylocks cannot automatically upgrade, so they check for elision every time. We use a 4 byte value in the mutex to store the lock elision adaptation state. This is separate from the adaptive spin state and uses a separate field. Condition variables currently do not support elision. Recursive mutexes and condition variables may be supported at some point, but are not in the current implementation. Also "trylock" will not automatically enable elision unless some other lock call has been already called on the lock. This version does not use IFUNC, so it means every lock has one additional check for elision. Benchmarking showed the overhead to be negligible.
* Add minimal test suite changes for elision enabled kernelsAndi Kleen2013-07-023-1/+28
| | | | | | tst-mutex5 and 8 test some behaviour not required by POSIX, that elision changes. This changes these tests to not check this when elision is enabled at configure time.
* Add new internal mutex type flags for elision.Andi Kleen2013-07-023-9/+43
| | | | | | | | | | Add Enable/disable flags used internally Extend the mutex initializers to have the fields needed for elision. The layout stays the same, and this is not visible to programs. These changes are not exposed outside pthread
* Add the low level infrastructure for pthreads lock elision with TSXAndi Kleen2013-07-0212-0/+502
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lock elision using TSX is a technique to optimize lock scaling It allows to run locks in parallel using hardware support for a transactional execution mode in 4th generation Intel Core CPUs. See http://www.intel.com/software/tsx for more Information. This patch implements a simple adaptive lock elision algorithm based on RTM. It enables elision for the pthread mutexes and rwlocks. The algorithm keeps track whether a mutex successfully elides or not, and stops eliding for some time when it is not. When the CPU supports RTM the elision path is automatically tried, otherwise any elision is disabled. The adaptation algorithm and its tuning is currently preliminary. The code adds some checks to the lock fast paths. Micro-benchmarks show little to no difference without RTM. This patch implements the low level "lll_" code for lock elision. Followon patches hook this into the pthread implementation Changes with the RTM mutexes: ----------------------------- Lock elision in pthreads is generally compatible with existing programs. There are some obscure exceptions, which are expected to be uncommon. See the manual for more details. - A broken program that unlocks a free lock will crash. There are ways around this with some tradeoffs (more code in hot paths) I'm still undecided on what approach to take here; have to wait for testing reports. - pthread_mutex_destroy of a lock mutex will not return EBUSY but 0. - There's also a similar situation with trylock outside the mutex, "knowing" that the mutex must be held due to some other condition. In this case an assert failure cannot be recovered. This situation is usually an existing bug in the program. - Same applies to the rwlocks. Some of the return values changes (for example there is no EDEADLK for an elided lock, unless it aborts. However when elided it will also never deadlock of course) - Timing changes, so broken programs that make assumptions about specific timing may expose already existing latent problems. Note that these broken programs will break in other situations too (loaded system, new faster hardware, compiler optimizations etc.) - Programs with non recursive mutexes that take them recursively in a thread and which would always deadlock without elision may not always see a deadlock. The deadlock will only happen on an early or delayed abort (which typically happens at some point) This only happens for mutexes not explicitely set to PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_ADAPTIVE_NP. PTHREAD_MUTEX_NORMAL mutexes do not elide. The elision default can be set at configure time. This patch implements the basic infrastructure for elision.
* BZ #12310: pthread_exit in static app. segfaultsVladimir Nikulichev2013-06-242-0/+9
| | | | | | | | | | | | | | | | Static applications that call pthread_exit on the main thread segfault. This is because after a thread terminates __libc_start_main decrements __nptl_nthreads which is only defined in pthread_create. Therefore the right solution is to add a requirement to pthread_create from pthread_exit. ~~~ nptl/ 2013-06-24 Vladimir Nikulichev <v.nikulichev@gmail.com> [BZ #12310] * pthread_exit.c: Add reference to pthread_create.