History log of /dragonfly/lib/libthread_xu/thread/thr_private.h (Results 1 – 25 of 55)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.2.1, v6.2.0, v6.3.0, v6.0.1
# 1f2cfeb1 07-Sep-2021 Sascha Wildner <saw@online.de>

<sys/*.h>: Fix some include guard names.


Revision tags: v6.0.0, v6.0.0rc1, v6.1.0
# cfbcdad7 18-Feb-2021 Sascha Wildner <saw@online.de>

libthread_xu: Remove some unused declarations from thr_private.h.


# 86ccdacb 17-Jan-2021 Aaron LI <aly@aaronly.me>

Implement clock_nanosleep(2) system call

* Extend the nanosleep1() function in kern_time.c to support the
clock_nanosleep(2) system call. Add {kern,sys}_clock_nanosleep()
functions and update k

Implement clock_nanosleep(2) system call

* Extend the nanosleep1() function in kern_time.c to support the
clock_nanosleep(2) system call. Add {kern,sys}_clock_nanosleep()
functions and update kern_nanosleep() accordingly.

* Add clock_nanosleep() syscall to syscalls.master and regenerate
syscall-related files.

* Update libc symbols with the new syscall.

* Add clock_nanosleep() warpper in libthread_xu.

* Update nanosleep.2 man page to describe clock_nanosleep().

* Update <time.h> and bump __DragonFly_version.

This work is loosely based on the FreeBSD implementation:
https://reviews.freebsd.org/rS315526

This clock_nanosleep(2) syscall passed all tests in the Open POSIX Test
Suite [0]:

conformance/interfaces/clock_nanosleep/1-1: execution: PASS
conformance/interfaces/clock_nanosleep/1-2: execution: PASS
conformance/interfaces/clock_nanosleep/1-3: execution: PASS
conformance/interfaces/clock_nanosleep/1-4: execution: PASS
conformance/interfaces/clock_nanosleep/1-5: execution: PASS
conformance/interfaces/clock_nanosleep/2-1: execution: PASS
conformance/interfaces/clock_nanosleep/2-2: execution: PASS
conformance/interfaces/clock_nanosleep/2-3: execution: PASS
conformance/interfaces/clock_nanosleep/3-1: execution: PASS
conformance/interfaces/clock_nanosleep/4-1: execution: PASS
conformance/interfaces/clock_nanosleep/5-1: execution: PASS
conformance/interfaces/clock_nanosleep/6-1: execution: PASS
conformance/interfaces/clock_nanosleep/9-1: execution: PASS
conformance/interfaces/clock_nanosleep/8-1: execution: PASS
conformance/interfaces/clock_nanosleep/10-1: execution: PASS
conformance/interfaces/clock_nanosleep/11-1: execution: PASS
conformance/interfaces/clock_nanosleep/13-1: execution: PASS
conformance/interfaces/clock_nanosleep/15-1: execution: PASS

[0] Open POSIX Test Suite: http://posixtest.sourceforge.net/

Reviewed-by: swildner, dillon, tuxillo, zach

show more ...


# cf8046a9 08-Dec-2020 zrj <rimvydas.jasinskas@gmail.com>

pthreads: Reimplement pthread types using non polluting types.

Use __ implementation specific namespace and adjust libthread_xu.
* The pthread_addr_t type was specific only to libc_r, remove it.

pthreads: Reimplement pthread types using non polluting types.

Use __ implementation specific namespace and adjust libthread_xu.
* The pthread_addr_t type was specific only to libc_r, remove it.
* The pthread_startroutine_t typedef was never used since initial fork.
* The mutex member in struct pthread_once was for libc_r only, rename
it to __sparelibc_r void pointer to keep ABI compatibility.
* Mangle struct names using __type_s scheme to avoid collisions with
user defined types in 3rd-party software packages.
* Adjust partly publicly visible struct pthread_once members too.

show more ...


# 940be950 08-Dec-2020 zrj <rimvydas.jasinskas@gmail.com>

pthreads: Use pthread_t type in libthread_xu.

Separated from upcoming work to allow easier differentiation between
non-pointers, single and double pointers. Inclusion of thr_private.h
already pr

pthreads: Use pthread_t type in libthread_xu.

Separated from upcoming work to allow easier differentiation between
non-pointers, single and double pointers. Inclusion of thr_private.h
already provides all needed information to dereference these types.

No functional change

show more ...


Revision tags: v5.8.3, v5.8.2
# 1ff88af1 27-Jun-2020 Sascha Wildner <saw@online.de>

libthread_xu: Fix building with -fno-common.

-fno-common will be default in future compilers (GCC 10, for example).


Revision tags: v5.8.1, v5.8.0, v5.9.0, v5.8.0rc1, v5.6.3
# da82a65a 11-Nov-2019 zrj <rimvydas.jasinskas@gmail.com>

Add <sys/cpumask.h>.

Collect and gather all scatter cpumask bits to correct headers. This
cleans up the namespace and simplifies platform handling in asm macros.
The cpumask_t together with its m

Add <sys/cpumask.h>.

Collect and gather all scatter cpumask bits to correct headers. This
cleans up the namespace and simplifies platform handling in asm macros.
The cpumask_t together with its macros is already non MI feature that is
used in userland utilities, libraries, kernel scheduler and syscalls.
It deserves sys/ header. Adjust syscalls.master and rerun sysent.

While there, fix an issue in ports that set POSIX env, but has
implementation of setting thread names through pthread_set_name_np().

show more ...


# 4cc8110f 12-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Fix incorrect fork assumption

* libthread_xu assumed that the forked child process's TID would be 1,
but that is no longer the case.

* Fix the assumption and correct some comments whil

pthreads - Fix incorrect fork assumption

* libthread_xu assumed that the forked child process's TID would be 1,
but that is no longer the case.

* Fix the assumption and correct some comments while we are here.

Reported-by: zrj

show more ...


# 721505de 12-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
te

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
teaching tens of thousands of programmers about signal safety, and
just making it work in libc and pthreads, only one of these two
possibilities is actually realizable.

In particular, high-level languages have become so complex, and some
applications (chrome, firefox, etc) have become so complex, that the
code is regularly tripping over signal safety issues.

However, implementing signal safety with current mechanisms is extremely
expensive due to the need for multiple system calls. To whit,
DragonFlyBSD now has a mechanism that does not require system calls
in the critical path.

* Implement sigblockall() and sigunblockall(). These functions
leverage the new /dev/lpmap per-thread shared page mechanism
to provide a way to temporary block the dispatch of all maskable
signals without having to make any system calls.

These are extremely fast routines.

- Reentrant / Recursable

- Temporarily blocks any dispatch of a maskable asynchronous signal
to the calling thread. Other threads are not affected... this is
a per-thread mechanism.

- The last sigunblockall() will immediately dispatch any blocked
signals.

- The normal signal mask is not affected by these routines.

- Does not block signals caused by synchronous traps.

- The current recursion count is retained on [v]fork() to ease
coding and to also allow signals to be temporarily blocked across a
fork until the child process is ready to deal with them, if desired.

* Implement signal safety for most of pthreads. All temporary internal
mutexes are now wrapped with sigblockall() and sigunblockall().

* Implement signal safety for the malloc subsystem. All functions
are wrawpped with sigblockall() and sigunblockall().

These implementations make lang/mono and lang/rust far more reliable
than they were before. Where 9 out of 10 builds used to fail, now
they succeed.

show more ...


# ce96aca2 02-Nov-2019 Sascha Wildner <saw@online.de>

libthread_xu: Remove local versions of 3 parameter timespec{add,sub}().

Adjust the parameter order. Comparison of preprocessed code before and
after this commit looks good.


# e7bf3f77 29-Oct-2019 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Bypass third-party allocators for internal allocations

* Adjust libthread_xu to always use libc's malloc/free (__malloc,
__free), bypassing third party allocators.

* Fixes interactions

pthreads - Bypass third-party allocators for internal allocations

* Adjust libthread_xu to always use libc's malloc/free (__malloc,
__free), bypassing third party allocators.

* Fixes interactions between third party alocators and pthreads
which often cause deadlocks or other chicken-and-egg issues,
or require serious hacks to work around.

show more ...


Revision tags: v5.6.2
# 8356845a 01-Jul-2019 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Use mmap() for thread->specific data

* Any application which tries to replace malloc() can wind up causing
pthreads to implode due to its use of malloc() in the early thread
initializ

pthreads - Use mmap() for thread->specific data

* Any application which tries to replace malloc() can wind up causing
pthreads to implode due to its use of malloc() in the early thread
initialization code.

* Change pthread_setspecific() to use mmap() instead of malloc()
to allocate the per-thread keys array, allowing applications
which replace malloc() to use pthread_setspecific() to initialize
per-thread malloc data if so desired.

The use of pthread_setspecific() predates TLS (per-thread) variable
declarations, aka the __thread storage qualifier, which is the
better way to implement per-thread data, but it is still a reasonable
choice so make it work.

* For DragonFlyBSD this is not expected to improve chrome because
our chrome build uses our base malloc() and does not try to replace
it with tcmalloc(). However, this change might help a limited
number of other applications that do.

Reported-by: sephe, tuxillo

show more ...


Revision tags: v5.6.1, v5.6.0
# 7bc469f6 12-Jun-2019 Sascha Wildner <saw@online.de>

Use some standard type names better.

struct sigaltstack -> stack_t
struct __siginfo -> siginfo_t
struct __sigset -> sigset_t

No functional change.


Revision tags: v5.6.0rc1, v5.7.0, v5.4.3
# 50caca1a 12-May-2019 Matthew Dillon <dillon@apollo.backplane.com>

rtld-elf - Notify thread state to optimize relocations

* Add shims to allow libthread_xu to notify rtld when threading
is being used.

* Requires weak symbols in libc which are overriden by rtld-e

rtld-elf - Notify thread state to optimize relocations

* Add shims to allow libthread_xu to notify rtld when threading
is being used.

* Requires weak symbols in libc which are overriden by rtld-elf.

* Implement the feature in rtld-elf and use it to avoid making calls
to lwp_gettid(). When threaded, use tls_get_tcb() (which does not
require a system call) instead of lwp_gettid(). When not threaded,
just use a constant.

NOTE: We cannot use tls_get_tcb() unconditionally because the tcb
is not setup during early relocations. So do this whack-a-mole
to make it work.

* This leaves just the sigprocmask wrappers around rtld-elf (which
are needed to prevent stacked relocations from signal handlers).

Poked-by: mjg

show more ...


Revision tags: v5.4.2
# ceae3ef4 07-Apr-2019 Sascha Wildner <saw@online.de>

libc/libpthread: Add guard to fix redundant __isthreaded declarations.


Revision tags: v5.4.1, v5.4.0, v5.5.0, v5.4.0rc1, v5.2.2, v5.2.1
# 6a8bb22d 05-May-2018 Sascha Wildner <saw@online.de>

Fix a few typos across the tree.


Revision tags: v5.2.0, v5.3.0, v5.2.0rc
# 44c4a02d 05-Jan-2018 Sascha Wildner <saw@online.de>

libthread_xu: Fix a typo in a comment.


Revision tags: v5.0.2
# e2caf0e7 08-Nov-2017 Matthew Dillon <dillon@apollo.backplane.com>

libc and pthreads - Fix atfork issues with nmalloc, update dmalloc

* Implement atfork handling for nmalloc. As part of this, refactor
some of nmalloc.

* Remove ZERO_LENGTH_PTR from nmalloc. Ins

libc and pthreads - Fix atfork issues with nmalloc, update dmalloc

* Implement atfork handling for nmalloc. As part of this, refactor
some of nmalloc.

* Remove ZERO_LENGTH_PTR from nmalloc. Instead, force 0-byte
allocations to allocate 1 byte. The standard requires unique
pointers to be returned.

* For now go back to a single depot lock instead of a per-zone
lock. It is unclear whether multi-threaded performance will
suffer or not, but its the only way to implement atfork handling.

* Implement proper atfork interlocks for nmalloc via pthreads to avoid
corruption when heavily threaded programs call fork().

* Bring dmalloc up to date in various ways, including properly
implementing a minimum 16-byte alignment for allocations >= 16 bytes,
and atfork handling. Also use a global depot lock for the same
reason we use it in nmalloc, and implement a front-end magazine
shortcut for any allocations <= 2MB.

Reported-by: mneumann

show more ...


Revision tags: v5.0.1
# 98247283 02-Nov-2017 Matthew Dillon <dillon@apollo.backplane.com>

pthreads - Fix rtld-elf and libthread_xu

* Fixes chrome, thunderbird, and multiple other issues with recent
libpthreads work.

Testing-by: mneumann, dillon


# fcaa7a3a 02-Nov-2017 Matthew Dillon <dillon@apollo.backplane.com>

libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
(sem and rtld) which must execute after all user atfork entities
pre-fork and bef

libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
(sem and rtld) which must execute after all user atfork entities
pre-fork and before all user atfork entities post-fork.

* Install an atfork handler for rtld-elf (also requires rtld-elf to
be updated). The handler will ensure that RTLD locks are in a sane
state prior to fork (by acquiring them), and will then release the
locks post-fork. This is the primary fix for lang/rust and cargo.

Also do not issue _thr_rtld_fini() when threading drops to 0.
Once threading has been set, rtld's pthread locks remain installed.

* Refactor thr_cond.c. Refactor condition variables to perform
according to the spec. Use a TAILQ to make pthread_cond_signal()
work exactly as described in the manual (that is, waking up only
one waiter at a time).

* Refactor thr_mutex.c. Primary instrument for debugging and
clean up. Also deal with improper EINTR handling.

* Refactor thr_fork.c. Implement the new atfork facility for
internal atfork handlers.

* Refactor thr_rwlock.c. Add debugging, cleanup.

* thr_sem.c now uses the internal atfork handler to ensure proper
ordering.

* thr_sig.c implements debugging features.

* Refactor thr_umtx.c... the low level mutex code. Store the id
for additonal verification and use an atomic lock to clear the
lock instead of an assignment. Properly ignore EINTR.

* Cleanup init_private() a bit.

* Add PTHREADS_DEBUGGING=TRUE and PTHREADS_DEBUGGING2=TRUE make
flags. The first writes out a garbage file in /tmp for all
locking operations as they occur. The second is used for
point debugging and writes out a file when signal 63 is sent
to the program.

* Add cpu_ccfence() in various places that might need it (a hack
for the moment, userland cannot currently #include
"machine/cpufunc.h").

* Should fix lang/rust and 'cargo'

show more ...


Revision tags: v5.0.0, v5.0.0rc2, v5.1.0, v5.0.0rc1, v4.8.1, v4.8.0, v4.6.2, v4.9.0, v4.8.0rc
# 3ae362f2 15-Jan-2017 Sepherosa Ziehau <sephe@dragonflybsd.org>

pthread: Implement pthread_attr_{get,set}affinity_np


Revision tags: v4.6.1
# 467ee1bb 19-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Set default contention scope to system.

It is a bit unclear how scope was handled previously.
Make it explicit to see what falls down.


# 4a9b8501 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Add vprintf variant of _thread_printf, reformat PANIC()

Cleans up intermediate writes.

Taken-from: FreeBSD


# 6be5672c 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: Fix some warnings, do not raise WARNS to 6.

Using -Os will create lots of -Winline, thus leave at 5 by default.
Sorry for __is_threaded.


# 19451dc5 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

pthread: General pre-cleanup (style, typos etc)

No functional change.


123