Commit Graph

1999 Commits

Author SHA1 Message Date
Andi Kleen
b023e4ca99 Add new internal mutex type flags for elision.
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
2013-07-02 08:46:54 -07:00
Andi Kleen
1cdbe57948 Add the low level infrastructure for pthreads lock elision with TSX
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.
2013-07-02 08:46:54 -07:00
Vladimir Nikulichev
e1f0b2cfa1 BZ #12310: pthread_exit in static app. segfaults
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.
2013-06-24 17:12:30 -04:00
Joseph Myers
e781d7c58f Include <string.h> in nptl/pthread_setattr_default_np.c. 2013-06-22 19:32:50 +00:00
Adhemerval Zanella
e55a9b256d PowerPC: Reserve TCB space for EBB framework
This patch reserves four pointer to be used in future Event-Based
Branch framework for PowerPC.
2013-06-17 15:50:53 -05:00
Siddhesh Poyarekar
61dd6208fb New API to set default thread attributes
This patch introduces two new convenience functions to set the default
thread attributes used for creating threads.  This allows a programmer
to set the default thread attributes just once in a process and then
run pthread_create without additional attributes.
2013-06-15 12:24:15 +05:30
Siddhesh Poyarekar
5865a56bf4 Avoid access beyond memory bounds in pthread_attr_getaffinity_np
Resolves BZ #15618.

pthread_attr_getaffinity_np may write beyond bounds of the input
cpuset buffer if the size of the input buffer is smaller than the
buffer present in the input pthread attributes.  Fix is to copy to the
extent of the minimum of the source and the destination.
2013-06-14 01:20:06 +05:30
Carlos O'Donell
be11d71394 x86*: Return syscall error for lll_futex_wake.
It is very very possible that the futex syscall returns an
error and that the caller of lll_futex_wake may want to
look at that error and propagate the failure.

This patch allows a caller to see the syscall error.

There are no users of the syscall error at present, but
future cleanups are now be able to check for the error.

--

nplt/

2013-06-10  Carlos O'Donell  <carlos@redhat.com>

	* sysdeps/unix/sysv/linux/i386/lowlevellock.h
	(lll_futex_wake): Return syscall error.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
	(lll_futex_wake): Return syscall error.
2013-06-10 12:05:11 -04:00
Ondrej Bilka
416641e687 Fix previous commit. 2013-06-08 23:07:18 +02:00
Ondrej Bilka
e3f36662ee Silence warning: __inline is not at beginning of declaration. 2013-06-08 20:03:24 +02:00
Ondrej Bilka
350635a59a Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
Joseph Myers
c7afae94ca Remove trailing whitespace in nptl. 2013-06-06 12:06:15 +00:00
Joseph Myers
fab7ce3f5b Link extra-libs consistently with libc and ld.so. 2013-05-31 16:16:33 +00:00
Ryan S. Arnold
e054f49430 Add #include <stdint.h> for uint[32|64]_t usage (except installed headers). 2013-05-16 11:32:54 -05:00
Andreas Jaeger
ecbf434213 Reserve new TLS field for x86 and x86_64
[BZ #10686]
	* sysdeps/x86_64/tls.h (struct tcbhead_t): Add __private_ss
	field.
	* sysdeps/i386/tls.h (struct tcbhead_t): Likewise.
2013-05-15 20:20:54 +02:00
Andi Kleen
66c13581af Fix tst-mutexpi8
2013-05-09  Andi Kleen  <ak@linux.intel.com>

	* tst-mutex8.c (do_test): Check for ENABLE_PI.
2013-05-09 16:15:50 +02:00
Siddhesh Poyarekar
da1304bcc8 Consolidate pthread_attr value validation
Define inline functions that wrap around validation for each of the
pthread attributes to reduce duplication in code.
2013-04-22 10:28:31 +05:30
Andreas Schwab
4f682b2ae9 Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout 2013-04-11 10:40:39 +02:00
Carlos O'Donell
96497bb806 sem_post.c: Include atomic.h.
The sem_post.c file uses atomic functions without including
atomic.h. Add `#include <atomic.h>' to the file to prevent
any compile time warnings when other headers change and
atomic.h isn't implicitly included.

---
nptl/

2013-04-07  Carlos O'Donell  <carlos@redhat.com>

	* sysdeps/unix/sysv/linux/sem_post.c: Include atomic.h.
2013-04-07 16:13:02 -04:00
Siddhesh Poyarekar
9ac3b5047e Fix static build when configured with --disable-hidden-plt
Fixes BZ #15337.

Static builds fail with the following warning:

/home/tools/glibc/glibc/nptl/../nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S:80:
undefined reference to `__GI___pthread_unwind'

When the source is configured with --disable-hidden-plt.  This is
because the preprocessor conditional in cancellation.S only checks if
the build is for SHARED, whereas hidden_def is defined appropriately
only for a SHARED build that will have symbol versioning *and* hidden
defs are enabled.  The last case is false here.
2013-04-04 19:43:56 +05:30
Roland McGrath
e57b0c6100 Avoid unconditional __call_tls_dtors calls in static linking. 2013-03-28 16:52:57 -07:00
Siddhesh Poyarekar
5cebee5db0 Fix up ChangeLog
I forgot to fix up the ChangeLog after renaming __default_attr to
__default_pthread_attr in code.
2013-03-19 15:00:08 +05:30
Siddhesh Poyarekar
e903a7138b Move __default_stacksize into __default_pthread_attr
Make __default_pthread_attr object to store default attribute values
for threads.
2013-03-19 14:34:13 +05:30
Siddhesh Poyarekar
69854bb5e9 Rename some static variables
Rename some static variables to give them unique names.
2013-03-18 13:44:05 +05:30
Carlos O'Donell
05087fbb0d Include atomic.h in generic lowlevellock.c. 2013-03-12 23:27:24 -04:00
Roland McGrath
b43769a3f5 Rejigger i386 dl-sysdep.h files. 2013-03-04 09:40:25 -08:00
Carlos O'Donell
4e9b599577 Revert GLIBC_PTHREAD_DEFAULT_STACKSIZE changes.
This reverts the change that allows the POSIX Thread default stack size
to be changed by the environment variable
GLIBC_PTHREAD_DEFAULT_STACKSIZE. It has been requested that more
discussion happen before this change goes into 2.18.
2013-03-01 16:18:08 -05:00
Siddhesh Poyarekar
ace4acc8ac Fix build warning 2013-03-01 20:45:17 +05:30
Siddhesh Poyarekar
e23872c8db Set default stack size from program environment
New environment variable GLIBC_PTHREAD_DEFAULT_STACKSIZE to do this.
2013-03-01 14:15:39 +05:30
David S. Miller
2b7ae1b27f Add priority inheritance futex support on sparc.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h
	(FUTEX_WAIT_REQUEUE_PI): Define.
	(FUTEX_CMP_REQUEUE_PI): Likewise.
	(lll_futex_wait_requeue_pi): Likewise.
	(lll_futex_timed_wait_requeue_pi): Likewise.
	(lll_futex_cmp_requeue_pi): Likewise.
2013-02-21 15:20:27 -08:00
Carlos O'Donell
9bf95cbc35 nptl: Fix comment typo in fork.c. 2013-02-21 09:36:43 -05:00
Siddhesh Poyarekar
f4804ca2bb Fix ChangeLogs 2013-02-18 21:41:34 +05:30
Siddhesh Poyarekar
ba384f6ed9 C++11 thread_local destructors support
This feature is specifically for the C++ compiler to offload calling
thread_local object destructors on thread program exit, to glibc.
This is to overcome the possible complication of destructors of
thread_local objects getting called after the DSO in which they're
defined is unloaded by the dynamic linker.  The DSO is marked as
'unloadable' if it has a constructed thread_local object and marked as
'unloadable' again when all the constructed thread_local objects
defined in it are destroyed.
2013-02-18 19:08:21 +05:30
Siddhesh Poyarekar
ffaa74cf68 Fix build warnings in some test cases
Include stdlib.h to get declaration of exit(3)
2013-02-18 18:17:05 +05:30
Siddhesh Poyarekar
8313cb997d FUTEX_*_REQUEUE_PI support for non-x86 code
Add FUTEX_*_REQUEUE_PI support for the default C code and also add
implementations for s-390 and ppc.
2013-02-18 16:07:10 +05:30
Joseph Myers
daaa7713e9 Remove bounded-pointers build system support. 2013-02-15 15:07:54 +00:00
Joseph Myers
e97ed6ddbe Remove bp-sym.h and BP_SYM uses from C code. 2013-02-14 13:12:02 +00:00
Andreas Schwab
903ae060db Don't use GLIBC_PRIVATE errno outside of libraries 2013-02-04 10:01:54 +01:00
Andreas Schwab
cfa8054fbb Hide reference to mktemp in libpthread 2013-01-16 15:57:11 +01:00
Carlos O'Donell
c0609c5c5e Remove unnecessary assert on attr in allocate_stack(). 2013-01-11 20:52:05 -05:00
H.J. Lu
740b3dbee8 Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
Andreas Schwab
e3f45e2bbe Revert "Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout"
This reverts commit 1bd57044e9.
2013-01-10 10:44:05 +01:00
Andreas Schwab
1bd57044e9 Extend i486 pthread_cond_timedwait to use futex syscall with absolute timeout
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
	(__pthread_cond_timedwait): If possible use FUTEX_WAIT_BITSET to
	directly use absolute timeout.
2013-01-10 09:59:58 +01:00
Joseph Myers
568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Joseph Myers
f4cf5f2d8b Add script to update copyright notices and reformat some to facilitate its use. 2013-01-01 16:29:10 +00:00
Andi Kleen
c93c5dec54 Convert pthread_rwlock_try(rd/wr)lock to prototypes
2012-12-28  Andi Kleen  <ak@linux.intel.com>

        * pthread_rwlock_tryrdlock.c (__pthread_rwlock_tryrdlock):
        * Convert
	to prototype.
        * pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock):
	Likewise.
2012-12-28 21:25:07 +01:00
David S. Miller
9c7595bda2 Add sparc implementation of lll_futex_timed_wait_bitset
nptl/

	* sysdeps/unix/sysv/linux/sparc/lowlevellock.h
	(lll_futex_timed_wait_bitset): New macro.
2012-12-27 08:20:46 -08:00
Siddhesh Poyarekar
8ebac7785b [s390] Replace lll_futex_* assembly code with INTERNAL_SYSCALL 2012-12-27 20:43:02 +05:30
Siddhesh Poyarekar
56e7d3ad5c Fix some build warnings on s390x 2012-12-08 13:03:24 +05:30
Joseph Myers
d39b954531 Remove unused variable from powerpc sem_post.c. 2012-12-04 21:39:04 +00:00
Allan McRae
e30907c3a4 Remove unneeded linking in nptl testsuite 2012-12-03 13:56:07 +10:00
H.J. Lu
c515fb5148 Cast to __intptr_t before casting pointer to int64 2012-11-26 16:45:36 -08:00
Joseph Myers
09e958ed42 Remove unused variable from sem_post.c. 2012-11-21 20:00:52 +00:00
Joseph Myers
fac9916c96 Remove unused variable from pthread_cond_timedwait.c. 2012-11-21 20:00:11 +00:00
Marcus Shawcroft
c485e4d2cc Adding missing -fexception CFLAGS 2012-11-14 12:35:10 +00:00
Chris Metcalf
91e0d40e89 Bump timeouts on some new nptl tests to support tilepro. 2012-11-06 13:10:19 -05:00
Siddhesh Poyarekar
8f861542dd [S390,PPC] Implement FUTEX_WAIT_BITSET for timedwait functions
Since the FUTEX_WAIT operation takes a relative timeout, the
pthread_cond_timedwait and other timed function implementations have
to get a relative timeout from the absolute timeout parameter it gets
before it makes the futex syscall.  This value is then converted back
into an absolute timeout within the kernel.  This is a waste and has
hence been improved upon by a FUTEX_WAIT_BITSET operation (OR'd with
FUTEX_CLOCK_REALTIME to make the kernel use the realtime clock instead
of the default monotonic clock).  This was implemented only in the x86
and sh assembly code and not in the C code.  This patch implements
support for FUTEX_WAIT_BITSET whenever available (since linux-2.6.29)
for s390 and powerpc.
2012-11-05 21:12:52 +05:30
David S. Miller
d3bd58cf0a Fix coding style in sparc lowlevellock.h
nptl/

	* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (BUSY_WAIT_NOP):
	Add missing spaces.
	(__cpu_relax): Likewise.
2012-11-03 15:25:55 -07:00
H.J. Lu
f62c8abcfb Compile x86 rtld with -mno-sse -mno-mmx 2012-11-02 18:43:27 -07:00
Aurelien Jarno
a9879fee34 Fix nptl/tst-cancel7 for non-bash shells. 2012-10-30 16:32:26 +00:00
David S. Miller
19f1dd5f2d Define a BUSY_WAIT_NOP for sparc.
nptl/

	* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (BUSY_WAIT_NOP):
	Define when we have v9 instructions available.
	* sysdeps/unix/sysv/linux/sparc/sparc64/cpu_relax.S: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/cpu_relax.S: New
	file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/Makefile: New
	file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: Add cpu_relax
	to libpthread-routines.
2012-10-28 23:19:00 -07:00
Roland McGrath
b9473651bc Fix build breakage in tst-cond-except.c. 2012-10-25 17:02:51 -07:00
Joseph Myers
6a345e4261 Use bash to run nptl/tst-tls6.sh. 2012-10-25 21:59:14 +00:00
Roland McGrath
c0a1472e22 Fix compiler warnings in some NPTL tests. 2012-10-25 14:43:10 -07:00
Joseph Myers
cc1290d07e Support cross-testing. 2012-10-24 21:59:01 +00:00
Roland McGrath
6e6249d0b4 BZ#14743: Move clock_* symbols from librt to libc. 2012-10-24 14:50:46 -07:00
Joseph Myers
0bf57f872c Don't set resource limits in tst-oddstacklimit-ENV. 2012-10-24 17:13:24 +00:00
Joseph Myers
03ac099f6b Define and use $(run-built-tests). 2012-10-24 00:08:46 +00:00
Jim Blandy
166bca2480 Add and use $(host-built-program-cmd). 2012-10-23 22:49:59 +00:00
Jim Blandy
aba759841b Use $(NM) not nm in tst-cancel-wrappers. 2012-10-21 22:38:34 +00:00
Siddhesh Poyarekar
370539fb64 Fix typo in nptl/ChangeLog 2012-10-17 21:05:29 +05:30
Siddhesh Poyarekar
37785907d5 Don't check error return for pthread_cancel in tst-cond25 2012-10-17 21:02:56 +05:30
Siddhesh Poyarekar
9485a40444 Adjust mutex lock in condvar_cleanup if we got it from requeue_pi
This completes the fix to bz #14652.
2012-10-16 14:23:35 +05:30
Carlos O'Donell
54a417345e Fixup nptl/ChangeLog for last commit. 2012-10-10 23:34:38 -04:00
Carlos O'Donell
0d522f6417 Fix formatting in nptl/sysdeps/pthread/pthread.h.
The macro pthread_cleanup_push_defer_np in pthread.h has a misaligned
line continuation marker. This marker was previously aligned, but
recent changes have moved it out of alignment. This change realigns
the marker. This also reduces the diff against the hppa version of
pthread.h where the marker is aligned.
2012-10-10 23:28:52 -04:00
Siddhesh Poyarekar
0e3b5d6a68 Take lock in pthread_cond_wait cleanup handler only when needed
[BZ #14652]
When a thread waiting in pthread_cond_wait with a PI mutex is
cancelled after it has returned successfully from the futex syscall
but just before async cancellation is disabled, it enters its
cancellation handler with the mutex held and simply calling a
mutex_lock again will result in a deadlock.  Hence, it is necessary to
see if the thread owns the lock and try to lock it only if it doesn't.
2012-10-10 12:52:56 +05:30
Roland McGrath
b8493de0ec Add missing magic to GLIBC_PROVIDES. 2012-10-09 15:41:30 -07:00
David S. Miller
f076216468 Correct libthreadb register access for 64-bit sparc.
[BZ #14568]
	* sysdeps/sparc/tls.h (DB_THREAD_SELF_INCLUDE): Delete.
	(DB_THREAD_SELF): Use constants for the register offsets.  Correct
	the case of a 64-bit debugger with a 32-bit inferior.
2012-10-05 21:22:41 -07:00
H.J. Lu
1d1b34df90 Add test cases for BZ #14557 2012-10-05 10:23:58 -07:00
Siddhesh Poyarekar
c30e8edf7c Unlock mutex before going back to waiting for PI mutexes
[BZ #14417]
A futex call with FUTEX_WAIT_REQUEUE_PI returns with the mutex locked
on success.  If such a successful thread is pipped to the cond_lock by
another spuriously woken waiter, it could be sent back to wait on the
futex with the mutex lock held, thus causing a deadlock.  So it is
necessary that the thread relinquishes the mutex before going back to
sleep.
2012-10-05 18:52:36 +05:30
Roland McGrath
9043e2288e Name space hygeine for madvise. 2012-10-04 16:31:43 -07:00
H.J. Lu
b2f80a478e Update copyright years 2012-10-02 16:50:47 -07:00
Siddhesh Poyarekar
adcdc775e1 Fix clone flag name in comment to CLONE_CHILD_CLEARTID. 2012-10-02 08:52:55 +05:30
Siddhesh Poyarekar
55a051c985 Fix exception table for i386 pthread_cond_wait
[BZ #14477]
Add an additional entry in the exception table to jump to
__condvar_w_cleanup2 instead of __condvar_w_cleanup for PI mutexes
when %ebx contains the address of the futex instead of the condition
variable.
2012-10-01 23:21:39 +05:30
Alan Modra
7e2fca8dd2 Fix bugs in powerpc pthread_once.
Ref gcc.gnu.org/bugzilla/show_bug.cgi?id=52839#c10

Release barriers are needed to ensure that any memory written by
init_routine is seen by other threads before *once_control changes.
In the case of clear_once_control we need to flush any partially
written state.
2012-09-25 16:30:06 -05:00
Dmitry V. Levin
57c69bef13 Set "fail on error" mode directly in testsuite shell scripts 2012-09-25 02:48:31 +00:00
Dmitry V. Levin
9a9028b1fe Add copyright notices to testsuite shell scripts 2012-09-25 02:48:13 +00:00
H.J. Lu
620f3d2670 Add "()" when casting to uint64_t for 64-bit store 2012-09-24 09:11:12 -07:00
H.J. Lu
ae30640a32 Cast to uint64_t for 64-bit store 2012-09-19 06:12:37 -07:00
Jeff Law
97bc38d7a5 [BZ #14583]
* sysdeps/pthread/pthread.h: Fix prototype of __sigsetjmp.
2012-09-14 14:31:29 -06:00
H.J. Lu
9503345f12 Remove unused __rtld_lock_init_recursive macro 2012-09-13 09:58:58 -07:00
H.J. Lu
70d37fe0b5 Fix a typo in ChangeLog 2012-09-10 05:18:44 -07:00
H.J. Lu
e9ceaf254c Rename LDFLAGS-XXX to LDLIBS-XXX for -lstdc++ 2012-09-07 14:11:47 -07:00
H.J. Lu
f5fce0629a Add tst-cancel21-static.c 2012-09-06 11:50:21 -07:00
Joseph Myers
26889eacc2 Remove __ASSUME_POSIX_CPU_TIMERS. 2012-09-01 21:32:04 +00:00
Joseph Myers
033d54a2d4 Fix sem_post race (bug 14532). 2012-08-31 19:49:31 +00:00
Roland McGrath
b2e1c56272 Make libio compile without _IO_MTSAFE_IO. 2012-08-17 09:35:36 -07:00
Roland McGrath
c75ccd4c3a Clean up definition of _LIBC_REENTRANT and _IO_MTSAFE_IO. 2012-08-17 09:35:15 -07:00
Joseph Myers
93a78ac437 Remove __ASSUME_POSIX_TIMERS. 2012-08-16 14:03:43 +00:00
Maxim Kuvyrkov
309becf120 Optimize __libc_lock_lock and __libc_lock_trylock for MIPS. 2012-08-15 16:44:30 -07:00
Maxim Kuvyrkov
ef4009734b Add generic versions of pthread_spin_lock and pthread_spin_trylock. 2012-08-15 16:29:06 -07:00
Joseph Myers
b36137f1d6 Remove __ASSUME_TGKILL. 2012-08-08 23:22:53 +00:00
Joseph Myers
93df14eee8 Remove some pre-2.6.16 Linux kernel conditionals. 2012-08-07 23:03:35 +00:00
Joseph Myers
85fe199795 Remove some pre-2.6.0 Linux kernel conditionals. 2012-08-03 19:54:08 +00:00
Siddhesh Poyarekar
fc56c5bbc1 Fix tst-pthread-getattr test case
Get the tst-pthread-getattr fix back with further improvements so that
it does not fail on targets that use the user stack to save
context.
2012-07-28 13:25:01 +05:30
Andreas Schwab
842a39cd1a Remove unused pseudo_end label 2012-07-25 21:58:17 +02:00
Siddhesh Poyarekar
77b32274e9 Revert fix to tst-pthread-getattr since it fails on sparc 2012-07-25 20:43:55 +05:30
Siddhesh Poyarekar
b2ae49dab8 Fix tst-pthread-getattr test case
In some cases, the compiler would optimize out the call to
allocate_and_test and thus result in a false positive for the test
case. Another problem was the fact that the compiler could in some
cases generate additional shifting of the stack pointer, resulting in
alloca moving the stack pointer beyond what is allowed by the
rlimit. Hence, accessing the stackaddr returned by pthread_getattr_np
is safer than relying on the alloca'd result.

Another problem is when RLIMIT may be very large, which may result in
violation of other resource limits. Hence we cap the max stack size to
8M for this test.
2012-07-20 23:28:34 +05:30
Siddhesh Poyarekar
a98430587c Fix comment that describes sighandler_setxid 2012-07-19 07:04:24 +05:30
Thomas Schwinge
4b2c8da708 SH: __lll_robust_timedlock_wait: Simplify CFI directives. 2012-06-23 12:17:44 +02:00
Siddhesh Poyarekar
18b5e737de Account for the extra stack size when rlimit is small enough
When rlimit is small enough to be used as the stacksize to be returned
in pthread_getattr_np, cases where a stack is made executable due to a
DSO load get stack size that is larger than what the kernel
allows. This is because in such a case the stack size does not account
for the pages that have auxv and program arguments.

Additionally, the stacksize for the process derived from this should
be truncated to align to page size to avoid going beyond rlimit.
2012-06-20 15:08:22 +05:30
Carlos Sánchez de La Lama
24a6dbed9b Fix build on non-v9 sparc32.
nptl/

	[BZ #14205]
	* sysdeps/sparc/sparc32/pthread_spin_lock.S: Do not use v9
	branches.
2012-06-07 11:57:09 -07:00
Siddhesh Poyarekar
4af3879c26 Wrap __builtin_expect in pthread.h
[BZ #14188]
This fixes compilation of programs using pthread_cleanup_push built
with non-gcc compilers and older gcc compilers.
2012-06-04 11:53:57 +05:30
H.J. Lu
0e20515a17 Use x86-64 bits/pthreadtypes.h/semaphore.h for i386/x86-64 2012-05-30 17:29:22 -07:00
Andreas Schwab
865eac65c2 Move CL entry 2012-05-30 08:49:59 +02:00
Andreas Schwab
4d17e68350 Remove use of INTDEF/INTUSE in nptl 2012-05-30 00:45:53 +02:00
Chung-Lin Tang
d701a1abe2 SH: Add CFI directives. 2012-05-28 00:47:07 +02:00
Chung-Lin Tang
65a4de4e06 SH: Add CFI directives. 2012-05-28 00:11:06 +02:00
Siddhesh Poyarekar
9c6ea9facb Fix stack size and address inconsistency due to executable stack
When a stack is marked executable due to loading a DSO that requires
an executable stack, the logic tends to leave out a portion of stack
after the first frame, thus causing a difference in the value returned
by pthread_getattr_np before and after the stack is marked
executable. It ought to be possible to fix this by marking the rest of
the stack as executable too, but in the interest of marking as less of
the stack as executable as possible, the path this fix takes is to
make pthread_getattr_np also look at the first frame as the underflow
end of the stack and compute size and stack top accordingly.

The above happens only for the main process stack. NPTL thread stacks
are not affected by this change.
2012-05-26 09:48:26 +05:30
Rayson Ho
1755728208 i386 port of the pthread SystemTap probes 2012-05-25 13:41:04 -07:00
Roland McGrath
5acf7263d5 Add systemtap static probe points in generic and x86_64 pthread code. 2012-05-25 13:41:03 -07:00
Roland McGrath
3a097cc7a1 Add --enable-systemtap configuration to define static probe points. 2012-05-25 13:40:20 -07:00
Andreas Jaeger
de7f5ce7c5 Fix warnings on Linux/i686
Fixes:
../sysdeps/i386/dl-machine.h:336:30: warning: unused variable ‘refsym’ [-Wunused-variable]
rtld.c:1435:3: warning: implicit declaration of function ‘_dl_discover_osversion’ [-Wimplicit-function-declaration]
2012-05-17 20:17:53 +02:00
Joseph Myers
048073995f Remove fallback definitions of __NR_set_robust_list. 2012-05-15 23:36:35 +00:00
Joseph Myers
a9538892ad Split up stackguard-macros.h into sysdeps directories. 2012-05-15 23:34:30 +00:00
H.J. Lu
f16af74217 Use R*_LP to load pointer and operate on stack 2012-05-15 14:25:31 -07:00
H.J. Lu
d9754f5572 Use LP_OP(cmp) and RCX_LP on dep_mutex pointer 2012-05-15 13:39:25 -07:00
H.J. Lu
dde05f0093 Use LP_OP(op), LP_SIZE and ASM_ADDR in sem_wait.S 2012-05-15 12:48:26 -07:00
H.J. Lu
9dba3b5c0a se LP_OP(op), LP_SIZE and ASM_ADDR in sem_timedwait.S 2012-05-15 12:47:31 -07:00
H.J. Lu
5f658cf147 Use LP_OP(cmp) on NWAITERS 2012-05-15 10:25:51 -07:00
H.J. Lu
6cae4b26ca Use LP_SIZE and ASM_ADDR in pthread_once.S 2012-05-15 10:24:19 -07:00
H.J. Lu
592f90e6ec Use LP_OP(cmp), R*_LP, LP_SIZE and ASM_ADDR 2012-05-15 10:23:22 -07:00
H.J. Lu
0e8860ad21 Use LP_OP(cmp), R*_LP, LP_SIZE and ASM_ADDR 2012-05-15 10:21:32 -07:00
H.J. Lu
30996e9369 Use LP_OP(cmp) and RCX_LP on dep_mutex pointer 2012-05-15 10:20:15 -07:00
H.J. Lu
289ac4352a Use LP_OP(mov) and RDI_LP on pointer 2012-05-15 10:19:11 -07:00
H.J. Lu
10f74fbcde Use LP_SIZE and load timeout pointer into RDX_LP 2012-05-15 10:03:56 -07:00
Siddhesh Poyarekar
439bf404b8 Allow a single-threaded program to cancel itself
There is nothing in the POSIX specification to disallow a
single-threaded program from cancelling itself, so we forcibly enable
multiple_threads to allow the next available cancellation point in the
thread to run.

Also added additional tests to cover various cancellation scenarios.
2012-05-15 09:41:57 +05:30
H.J. Lu
2949684c16 Add x32 support to tcbhead_t 2012-05-14 20:58:24 -07:00
H.J. Lu
245a11d7bd Add __PTHREAD_RWLOCK_INT_FLAGS_SHARED 2012-05-14 16:48:59 -07:00
H.J. Lu
0b254d8f3d Add sysdeps/x86_64/{64,x32}/shlib-versions 2012-05-14 16:23:57 -07:00
H.J. Lu
b8caea2cb9 Add x32 pthread types 2012-05-14 12:56:56 -07:00
H.J. Lu
d3c6600440 Update comments for CALL_THREAD_FCT 2012-05-11 14:58:18 -07:00
H.J. Lu
60d45b36a5 Add sysdeps/x86_64/x32/tls.h 2012-05-11 14:33:12 -07:00
H.J. Lu
eae2d36a96 Fix a typo in ChangeLo. 2012-05-11 11:34:48 -07:00
H.J. Lu
a04e06bc4c Use uint64_t on 64-bit integer 2012-05-11 10:14:57 -07:00
H.J. Lu
512ec530c7 Replace movq/%q0 with mov/%0 in THREAD_SELF 2012-05-11 10:13:54 -07:00
H.J. Lu
c0d2c8538a Check __x86_64__ for __cleanup_fct_attribute 2012-05-11 10:12:42 -07:00
H.J. Lu
1f59b0b121 Check __PTHREAD_MUTEX_HAVE_PREV for mutex initializers 2012-05-11 10:10:37 -07:00
H.J. Lu
c252ec1579 Check __PTHREAD_MUTEX_HAVE_PREV for mutex prev 2012-05-11 10:08:57 -07:00
Thomas Schwinge
be971a2b1c Hurd: libc_once_get 2012-05-10 15:57:24 -07:00
Chung-Lin Tang
e1b4354e66 Use CFI statements instead of hand-coding .eh_frame. 2012-05-09 17:48:42 +08:00
David S. Miller
76e835cf9e Fix minor fallout from yesterdays sparc nptl changes.
nptl/

	* sysdeps/sparc/sparc64/pthread_spin_unlock.S: Fix thinko, we
	always have to return 0, especially for the pthread_spin_init
	alias.
	* sysdeps/sparc/sparc32/pthread_spin_lock.S: Add missing trailing
	newline.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S: Likewise.
	* sysdeps/sparc/sparc64/pthread_spin_lock.S: Likewise.
2012-05-03 11:48:13 -07:00
David S. Miller
e2dbf201ab Mirror i386 change on sparc: 'Avoid "anonymous" code in pthread_spin_lock'
nptl/

	* sysdeps/sparc/sparc64/pthread_spin_lock.S: New.
	* sysdeps/sparc/sparc64/pthread_spin_lock.c: Delete.
	* sysdeps/sparc/sparc64/pthread_spin_unlock.S: New.
	* sysdeps/sparc/sparc64/pthread_spin_unlock.c: Delete.
	* sysdeps/sparc/sparc64/pthread_spin_trylock.S: New.
	* sysdeps/sparc/sparc64/pthread_spin_trylock.c: Delete.
	* sysdeps/sparc/sparc64/pthread_spin_init.c: New.
	* sysdeps/sparc/sparc32/pthread_spin_lock.S: New.
	* sysdeps/sparc/sparc32/pthread_spin_lock.c: Delete.
	* sysdeps/sparc/sparc32/pthread_spin_trylock.S: New.
	* sysdeps/sparc/sparc32/pthread_spin_trylock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.S: New.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_lock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.S: New.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_trylock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.S: New.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_unlock.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/pthread_spin_init.c: New.
2012-05-02 19:04:54 -07:00
Allan McRae
d4c2917fc5 Fix test-suite failues with -Wl,--as-needed
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-05-02 20:32:50 -04:00
Paul Pluzhnikov
ff8a695b6d Kill trailing whitespace. 2012-05-02 14:01:37 -07:00
Paul Pluzhnikov
b93d565a51 Avoid "anonymous" code in pthread_spin_lock. 2012-05-02 13:58:40 -07:00
Andreas Schwab
6d5c57fabd Don't run tests when cross-compiling 2012-04-28 22:16:37 +02:00
Siddhesh Poyarekar
6e236b9276 move libgcc_s soname definition to shlib-versions 2012-04-26 09:19:54 +05:30
Paul Pluzhnikov
0cec7c5407 Delete unused TLS_GET_FS, TLS_SET_FS macros. 2012-04-20 09:52:13 -07:00
David S. Miller
7ac88e3831 Fix nptl/tst-cond1{6,7,8}.c on 32-bit with many cpus.
* tst-cond16.c (do_test): Use a thread stack size which is either
	PTHREAD_STACK_MIN or the page size, whichever is larger.
	* tst-cond18.c (do_test): Likewise.
2012-03-27 14:25:55 -07:00
H.J. Lu
24d8f4b7dc Use __asm__("rsp") to get CURRENT_STACK_FRAME 2012-03-19 16:21:21 -07:00
H.J. Lu
4adaaafc9e Use __NR_futex to define SYS_futex 2012-03-19 14:54:35 -07:00
H.J. Lu
ca7b8af5db Cast _Unwind_GetCFA return to _Unwind_Ptr first 2012-03-19 13:34:44 -07:00
David S. Miller
7e7fa5f871 Fix libc-lowlevellock.c sysdep finding more generically.
nptl/

	[BZ #13844]
	* sysdeps/unix/sysv/linux/libc-lowlevellock.c: Include using <..>
	instead of "...".
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc-lowlevellock.c:
	Delete, not needed.
2012-03-16 20:40:54 -07:00
David S. Miller
c4a7b16eb8 Add missing sparc32 NPTL file otherwise we use the wrong lowlevellock.c implementation.
nptl/

	[BZ #13844]
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc-lowlevellock.c: New file.
2012-03-15 21:13:02 -07:00
Paul Eggert
c524201ab0 Replace FSF snail mail address with URL in miscellaneous files. 2012-03-10 00:45:35 +00:00
Joseph Myers
90ad551f73 Make pthread.h define all symbols from time.h.
See:
http://www.pasc.org/interps/unofficial/db/p1003.1c/pasc-1003.1c-46.html
http://www.pasc.org/interps/unofficial/db/p1003.1/pasc-1003.1-86.html
https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=index.tpl&source=L&listname=austin-group-l&id=17302
(Geoff Clare, austin-group-l, 9 Mar 2012)
2012-03-09 21:10:45 +00:00
David S. Miller
c64bf5feb3 Update copyright year after my most recent changes.
nptl/

	* sysdeps/unix/sysv/linux/sparc/sem_post.c: Update copyright year.

/

	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: Update
	copyright year.
	* sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise.
2012-03-08 15:09:27 -08:00
Thomas Schwinge
2edd9a79e5 Work around kernel rejecting valid absolute timestamps. 2012-03-08 11:22:41 +01:00
Thomas Schwinge
c564a81246 Invalid timeouts in SH sem_timedwait.
We adjusted nwaiters even though this isn't necessary.
2012-03-08 10:45:05 +01:00
Thomas Schwinge
48aff7765b Fix 9554ebf2d4.
| Invalid timeouts in i386 sem_timedwait.
|
| We adjusted nwaiters even though this isn't necessary.
2012-03-08 09:33:12 +01:00
Joseph Myers
e7dbb1bec3 Weaken two NPTL configure link tests to compile tests. 2012-03-07 19:34:22 +00:00
Ulrich Drepper
a4300c7a4d Remove distribute variable from Makefiles 2012-03-07 05:17:13 -05:00
Thomas Schwinge
840df61ea4 Get rid of superfluous assignments in sem_timedwait 2012-03-07 04:11:11 -05:00
Ulrich Drepper
959e12e37b Fix CL 2012-03-07 00:28:22 -05:00
Ulrich Drepper
abdf2e1915 Better CL 2012-03-06 23:39:31 -05:00
Ulrich Drepper
9463518d0d Remove private information from libc-lock.h 2012-03-06 23:37:35 -05:00
David S. Miller
e92584001a Fix several build warnings on sparc.
/

	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
	(set_obp_int): New function.
	(get_obp_int): New function.
	(__get_clockfreq_via_dev_openprom): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sysdep.h (INTERNAL_SYSCALL_ERROR_P): Avoid
	unused variable warnings on 'val' and use builtin_expect.
	(INLINE_SYSCALL): Don't wrap INTERNAL_SYSCALL_ERROR_P with builtin_expect.
	(INLINE_CLONE_SYSCALL): Likewise.

nptl/

	* sysdeps/unix/sysv/linux/sparc/sem_post.c (__new_sem_post): Use
	atomic_increment and remove unused local variable.
	(__old_sem_post): Likewise.
2012-03-06 11:15:26 -08:00
David S. Miller
22f9d9df92 Fix stray references to __pthread_attr
* sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h: Don't refer to non-existing
	__pthread_attr.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/pthreadtypes.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h: Likewise.
2012-02-27 12:59:16 -08:00
Ulrich Drepper
8da0464f6f Fix name mangling of pthread_attr_t after change 2012-02-26 21:42:53 -05:00
Ulrich Drepper
d94a467080 Add first fixes for conformtest for POSIX2008 2012-02-26 21:32:56 -05:00
Ulrich Drepper
4a3dded527 Work around problem of pthread_attr_t definition with old compilers 2012-02-26 17:41:17 -05:00
Ulrich Drepper
4efeffc1d5 Fix up POSIX testing in conformtest 2012-02-26 13:17:27 -05:00
Joseph Myers
0e7dfaef51 Remove old initfini mechanism. 2012-02-21 00:46:01 +00:00
Richard Henderson
e3b69ca7d1 s390: Convert to crt[in].S. 2012-02-16 09:24:19 -08:00
Kaz Kojima
df83af673b Add SH target specific crti.S and crtn.S and remove initfini files.
Add sysdeps/sh/crti.S, sysdeps/sh/crtn.S and remove sysdeps/sh/elf/initfini.c
and nptl/sysdeps/unix/sysv/linux/sh/pt-initfini.c.
2012-02-16 07:17:24 +09:00
David S. Miller
f63f338062 Move sparc away from the deprecated inifini.c scheme.
/

	* sysdeps/sparc/Makefile: Add -fPIC when building crt{i,n}.S
	* sysdeps/sparc/crti.S: New file.
	* sysdeps/sparc/crtn.S: New file.
	* sysdeps/sparc/sparc32/Makefile: Remove initfini handling.
	* sysdeps/sparc/sparc64/Makefile: Likewise.

nptl/

	* sysdeps/sparc/Makefile: Add -fPIC when building pt-crti.S and crtn.S
2012-02-16 12:54:05 -08:00
Marek Polacek
d463ab10dd Remove unused Makefile. 2012-02-15 21:07:06 +01:00
Paul Eggert
59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Andreas Schwab
2832840339 Add missing dependency for pt-crti.o 2012-02-08 16:16:42 +01:00
Joseph Myers
3add8e1353 Support crti.S and crtn.S provided directly by architectures. 2012-02-08 01:45:26 +00:00
Joseph Myers
9a1d92541f Consistently use macros for x86 PIC thunks. 2012-02-03 23:22:53 +00:00
Ulrich Drepper
5452bffeef Fix warnings due to return in void functions 2012-01-11 11:56:30 -05:00
Ulrich Drepper
8898f02074 Add const attribute to pthread_equal 2012-01-10 19:37:35 -05:00
Ulrich Drepper
356fa562ec Consistently added return to pthread_exit 2012-01-10 19:02:21 -05:00
Adhemerval Zanella
f5420cf073 CL 2012-01-08 19:57:22 -05:00
Adhemerval Zanella
232872379e Use __pthread_get_minstack for AIO helper thread 2012-01-08 19:56:52 -05:00
Marek Polacek
c473bd1cd9 Quash implicit declaration warning 2012-01-08 13:21:50 -05:00
Ulrich Drepper
2119dcfacc Static linking is always needed 2012-01-08 09:52:29 -05:00
Ulrich Drepper
a784e50247 Remove pre-ISO C support
No more __const.
2012-01-07 23:57:22 -05:00