| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
pthread_suspend_all_np() may have already suspended its parent thread.
Add locking code in pthread_suspend_all_np() to only allow one thread
to suspend other threads, this eliminates a deadlock where two or more
threads try to suspend each others.
Notes:
svn path=/head/; revision=239718
|
|
|
|
|
|
|
| |
in init_private(), don't call it again in fork() wrapper.
Notes:
svn path=/head/; revision=239609
|
|
|
|
|
|
|
|
|
|
|
| |
for process, thread or others we want to support.
Use the syscall to implement POSIX API clock_getcpuclock and
pthread_getcpuclockid.
PR: 168417
Notes:
svn path=/head/; revision=239347
|
|
|
|
|
|
|
| |
Handle TLS for ARMv6 and ARMv7
Notes:
svn path=/head/; revision=239270
|
|
|
|
| |
Notes:
svn path=/head/; revision=239206
|
|
|
|
|
|
|
|
| |
Further decreases unexpected context switches by defering mutex wakeup
until internal sleep queue lock is released.
Notes:
svn path=/head/; revision=239200
|
|
|
|
| |
Notes:
svn path=/head/; revision=238645
|
|
|
|
| |
Notes:
svn path=/head/; revision=238644
|
|
|
|
| |
Notes:
svn path=/head/; revision=238643
|
|
|
|
| |
Notes:
svn path=/head/; revision=238642
|
|
|
|
| |
Notes:
svn path=/head/; revision=238641
|
|
|
|
| |
Notes:
svn path=/head/; revision=238640
|
|
|
|
|
|
|
|
|
|
| |
replace _thr_ref_add() with _thr_find_thread(),
so reference count is no longer needed.
MFC after: 3 days
Notes:
svn path=/head/; revision=238637
|
|
|
|
|
|
|
|
|
|
| |
be acquired.
PR: 168317
MFC after: 3 days
Notes:
svn path=/head/; revision=236135
|
|
|
|
|
|
|
| |
redundant SC_LOOKUP() calling.
Notes:
svn path=/head/; revision=235218
|
|
|
|
|
|
|
| |
upper level.
Notes:
svn path=/head/; revision=235068
|
|
|
|
|
|
|
|
|
|
| |
Enqueue thread in LIFO, this can cause starvation, but it gives better
performance. Use _thr_queuefifo to control the frequency of FIFO vs LIFO,
you can use environment string LIBPTHREAD_QUEUE_FIFO to configure the
variable.
Notes:
svn path=/head/; revision=234947
|
|
|
|
|
|
|
|
| |
Reviewed by: davidxu@
MFC after: 1 week
Notes:
svn path=/head/; revision=234424
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a mutex after a thread has unlocked it, it event writes data to the mutex
memory to clear contention bit, there is a race that other threads
can lock it and unlock it, then destroy it, so it should not write
data to the mutex memory if there isn't any waiter.
The new operation UMTX_OP_MUTEX_WAKE2 try to fix the problem. It
requires thread library to clear the lock word entirely, then
call the WAKE2 operation to check if there is any waiter in kernel,
and try to wake up a thread, if necessary, the contention bit is set again
by the operation. This also mitgates the chance that other threads find
the contention bit and try to enter kernel to compete with each other
to wake up sleeping thread, this is unnecessary. With this change, the
mutex owner is no longer holding the mutex until it reaches a point
where kernel umtx queue is locked, it releases the mutex as soon as
possible.
Performance is improved when the mutex is contensted heavily. On Intel
i3-2310M, the runtime of a benchmark program is reduced from 26.87 seconds
to 2.39 seconds, it even is better than UMTX_OP_MUTEX_WAKE which is
deprecated now. http://people.freebsd.org/~davidxu/bench/mutex_perf.c
Notes:
svn path=/head/; revision=233912
|
|
|
|
|
|
|
|
|
|
|
| |
_SIG_MAXSIG works a bit unexpectedly: signals 1 till _SIG_MAXSIG are valid,
both bounds inclusive.
Reviewed by: davidxu
MFC after: 1 week
Notes:
svn path=/head/; revision=233516
|
|
|
|
|
|
|
| |
Reported by: pjd
Notes:
svn path=/head/; revision=233134
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
example, it uses a serialization point like following:
pthread_mutex_lock(&mutex);
pthread_mutex_unlock(&mutex);
pthread_mutex_destroy(&muetx);
They think a previous lock holder should have already left the mutex and
is no longer referencing it, so they destroy it. To be maximum compatible
with such code, we use IA64 version to unlock the mutex in kernel, remove
the two steps unlocking code.
Notes:
svn path=/head/; revision=233103
|
|
|
|
|
|
|
|
| |
this makes it possible a thread received PTHREAD_BARRIER_SERIAL_THREAD
immediately free memory area of the barrier.
Notes:
svn path=/head/; revision=233022
|
|
|
|
|
|
|
| |
things simple
Notes:
svn path=/head/; revision=232579
|
|
|
|
|
|
|
| |
this eliminates a clock_gettime() syscall.
Notes:
svn path=/head/; revision=232209
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
according to POSIX document, the clock ID may be dynamically allocated,
it unlikely will be in 64K forever. To make it future compatible, we
pack all timeout information into a new structure called _umtx_time, and
use fourth argument as a size indication, a zero means it is old code
using timespec as timeout value, but the new structure also includes flags
and a clock ID, so the size argument is different than before, and it is
non-zero. With this change, it is possible that a thread can sleep
on any supported clock, though current kernel code does not have such a
POSIX clock driver system.
Notes:
svn path=/head/; revision=232144
|
|
|
|
|
|
|
|
|
| |
UMTX_OP_WAIT. Upper 16bits is enough to hold a clock id, and lower
16bits is used to pass flags. The change saves a clock_gettime() syscall
from libthr.
Notes:
svn path=/head/; revision=231989
|
|
|
|
|
|
|
| |
is zero may trigger timeout too early. It seems a copy&paste bug.
Notes:
svn path=/head/; revision=231906
|
|
|
|
|
|
|
|
| |
- Switch to Variant I TCB layout
- Use function from rtld for TCB allocation/deallocation
Notes:
svn path=/head/; revision=231619
|
|
|
|
| |
Notes:
svn path=/head/; revision=231503
|
|
|
|
|
|
|
|
| |
Save pointer to the TLS structure taking into account TP_OFFSET
and TCB structure size.
Notes:
svn path=/head/; revision=231350
|
|
|
|
|
|
|
|
|
|
| |
queue pointers, just reuse it.
PR: 164828
MFC after: 1 week
Notes:
svn path=/head/; revision=231106
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the signal handlers with the context information in the deferrred
case.
Only enable the use of getcontextx(3) in the deferred signal delivery
code on amd64 and i386. Sparc64 seems to have some undetermined issues
with interaction of alloca(3) and signal delivery.
Tested by: flo (who also provided sparc64 harware access for me), pho
Discussed with: marius
MFC after: 1 month
Notes:
svn path=/head/; revision=230430
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
versions of pthread_md.h have a special case of dereferencing a null
pointer. Clang warns about this with:
In file included from lib/libthr/arch/i386/i386/pthread_md.c:36:
lib/libthr/arch/i386/include/pthread_md.h:96:10: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
return (TCB_GET32(tcb_self));
^~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:73:13: note: expanded from:
: "m" (*(u_int *)(__tcb_offset(name)))); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/libthr/arch/i386/include/pthread_md.h:96:10: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
Since this indirection is done relative to the fs or gs segment, to
retrieve thread-specific data, it is an exception to the rule.
Therefore, add a volatile qualifier to tell the compiler we really want
to dereference a zero address.
MFC after: 1 week
Notes:
svn path=/head/; revision=228536
|
|
|
|
|
|
|
|
|
|
|
|
| |
timeout correctly for pthread_cond_timedwait when
it uses kernel-based condition variable.
PR: 162403
Submitted by: jilles
MFC after: 3 days
Notes:
svn path=/head/; revision=227604
|
|
|
|
| |
Notes:
svn path=/head/; revision=223294
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
o Set TP using inline assembly to avoid dead code elimination.
o Eliminate _tcb.
Merge from r161840:
Stylize: avoid using a global register variable.
Merge from r157461:
Simplify _get_curthread() and _tcb_ctor because libc and rtld now
already allocate thread pointer space in tls block for initial thread.
Merge from r177853:
Replace function _umtx_op with _umtx_op_err, the later function directly
returns errno, because errno can be mucked by user's signal handler and
most of pthread api heavily depends on errno to be correct, this change
should improve stability of the thread library.
MFC after: 1 week
Notes:
svn path=/head/; revision=223228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
used a global pthread_mutex_t for synchronization. r179417 replaced that
with an implementation that directly used atomic instructions and thr_*
syscalls to synchronize callers to pthread_once. However, calling
pthread_mutex_lock on the global mutex implicitly ensured that
_thr_check_init() had been called but with r179417 this was no longer
guaranteed. This meant that if you were unlucky enough to have your first
call into libthr be a call to pthread_once(), you would segfault when
trying to access the pointer returned by _get_curthread().
The fix is to explicitly call _thr_check_init() from pthread_once().
Reviewed by: davidxu
Approved by: emaste (mentor)
MFC after: 1 week
Notes:
svn path=/head/; revision=220888
|
|
|
|
|
|
|
|
|
|
| |
calling thread's unique integral ID, which is similar to AIX function of
the same name. Bump __FreeBSD_version to note its introduction.
Reviewed by: kib
Notes:
svn path=/head/; revision=218414
|
|
|
|
|
|
|
| |
Submitted by: avg
Notes:
svn path=/head/; revision=217253
|
|
|
|
|
|
|
|
|
|
| |
threading, fall back to libc method of performing
__pthread_map_stacks_exec() job.
Reported and tested by: Mykola Dzham <i levsha me>
Notes:
svn path=/head/; revision=217224
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Stack creation code is changed to call _rtld_get_stack_prot() to get
the stack protection right. There is a race where thread is created
during dlopen() of dso that requires executable stacks. Then,
_rtld_get_stack_prot() may return PROT_READ | PROT_WRITE, but thread
is still not linked into the thread list. In this case, the callback
misses the thread stack, and rechecks the required protection
afterward.
Reviewed by: davidxu
Notes:
svn path=/head/; revision=217191
|
|
|
|
| |
Notes:
svn path=/head/; revision=217107
|
|
|
|
|
|
|
| |
Found by: clang static analyzer
Notes:
svn path=/head/; revision=217047
|
|
|
|
|
|
|
| |
queue locked.
Notes:
svn path=/head/; revision=216949
|
|
|
|
|
|
|
| |
significant for lock owner.
Notes:
svn path=/head/; revision=216687
|
|
|
|
| |
Notes:
svn path=/head/; revision=216642
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Add flags CVWAIT_ABSTIME and CVWAIT_CLOCKID for umtx kernel based
condition variable, this should eliminate an extra system call to get
current time.
- Add sub-function UMTX_OP_NWAKE_PRIVATE to wake up N channels in single
system call. Create userland sleep queue for condition variable, in most
cases, thread will wait in the queue, the pthread_cond_signal will defer
thread wakeup until the mutex is unlocked, it tries to avoid an extra
system call and a extra context switch in time window of pthread_cond_signal
and pthread_mutex_unlock.
The changes are part of process-shared mutex project.
Notes:
svn path=/head/; revision=216641
|
|
|
|
| |
Notes:
svn path=/head/; revision=214653
|
|
|
|
|
|
|
| |
Submitted by: avg
Notes:
svn path=/head/; revision=214506
|