Hello, this is yet another revision of the same patchset to stop issuing many redundant gsync_wake () calls. Following the brief feedback I got the last time, it switches most users of THREAD_GSCOPE_IN_TCB to PTHREAD_IN_LIBC, then actually introduces the new GSCOPE implementation, and then finally drops the remaining uses of THREAD_GSCOPE_IN_TCB entirely, since it's not always on.
Things still seem to build and work somewhat (tested on GNU/Hurd i686 and GNU/Linux x86_64). rpctrace uname still shows that there are no more gsync_wake () calls. Apparently dlopen (RTLD_GLOBAL) is a good way to trigger THREAD_GSCOPE_WAIT (). I have written a test program that spawns 100 threads, then each of the threads dlopen's 100 shared objects, then dlclose's them back. On GNU/Linux, I have verified with GDB that it hits NPTL's __thread_gscope_wait (). I haven't been able to verify the same on the Hurd due to the general flakiness of GDB there, but I have ran the program with the patched glibc multiple times and it doesn't crash, so I assume it's working fine. Sergey Bugaev (5): elf: Replace most uses of THREAD_GSCOPE_IN_TCB htl: Move thread table to ld.so htl: Reimplement GSCOPE elf: Remove THREAD_GSCOPE_IN_TCB testrun.sh: Add support for --tool=rpctrace Makefile | 9 +++- elf/dl-reloc.c | 4 +- elf/dl-support.c | 3 +- elf/dl-tls.c | 6 +-- elf/dl-tls_init_tp.c | 2 +- htl/Versions | 2 - htl/pt-alloc.c | 50 +++++++++------------ htl/pt-create.c | 11 ++--- htl/pt-internal.h | 23 +++------- sysdeps/aarch64/nptl/tls.h | 1 - sysdeps/alpha/nptl/tls.h | 1 - sysdeps/arc/nptl/tls.h | 1 - sysdeps/arm/nptl/tls.h | 1 - sysdeps/csky/nptl/tls.h | 1 - sysdeps/generic/ldsodefs.h | 18 +++++--- sysdeps/generic/tls.h | 6 --- sysdeps/hppa/nptl/tls.h | 1 - sysdeps/htl/dl-support.c | 23 ++++++++++ sysdeps/htl/dl-thread_gscope_wait.c | 55 ++++++++++++++++++++++++ sysdeps/htl/pt-key-delete.c | 8 ++-- sysdeps/htl/pthreadP.h | 2 - sysdeps/htl/raise.c | 8 +++- sysdeps/htl/thrd_current.c | 7 ++- sysdeps/i386/nptl/tls.h | 1 - sysdeps/ia64/nptl/tls.h | 1 - sysdeps/m68k/nptl/tls.h | 1 - sysdeps/mach/hurd/htl/pt-sigstate-init.c | 2 +- sysdeps/mach/hurd/htl/pt-sysdep.c | 2 +- sysdeps/mach/hurd/htl/pt-sysdep.h | 2 +- sysdeps/mach/hurd/i386/tls.h | 19 ++++++++ sysdeps/mach/hurd/tls.h | 20 --------- sysdeps/microblaze/nptl/tls.h | 1 - sysdeps/mips/nptl/tls.h | 1 - sysdeps/nios2/nptl/tls.h | 1 - sysdeps/powerpc/nptl/tls.h | 1 - sysdeps/riscv/nptl/tls.h | 1 - sysdeps/s390/nptl/tls.h | 1 - sysdeps/sh/nptl/tls.h | 1 - sysdeps/sparc/nptl/tls.h | 1 - sysdeps/x86_64/nptl/tls.h | 1 - 40 files changed, 172 insertions(+), 128 deletions(-) create mode 100644 sysdeps/htl/dl-support.c create mode 100644 sysdeps/htl/dl-thread_gscope_wait.c -- 2.31.1