unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sergey Bugaev via Libc-alpha <libc-alpha@sourceware.org>
To: libc-alpha@sourceware.org, bug-hurd@gnu.org
Cc: samuel.thibault@gnu.org, Sergey Bugaev <bugaevc@gmail.com>
Subject: [PATCH htl v3 0/5] Rewrite THREAD_GSCOPE
Date: Tue,  7 Sep 2021 16:33:20 +0300	[thread overview]
Message-ID: <20210907133325.255690-1-bugaevc@gmail.com> (raw)

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


             reply	other threads:[~2021-09-07 13:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 13:33 Sergey Bugaev via Libc-alpha [this message]
2021-09-07 13:33 ` [PATCH htl v3 1/5] elf: Replace most uses of THREAD_GSCOPE_IN_TCB Sergey Bugaev via Libc-alpha
2021-09-14 23:30   ` Samuel Thibault via Libc-alpha
2021-09-07 13:33 ` [PATCH htl v3 2/5] htl: Move thread table to ld.so Sergey Bugaev via Libc-alpha
2021-09-14 23:27   ` Samuel Thibault via Libc-alpha
2021-09-15 14:14     ` Sergey Bugaev via Libc-alpha
2021-09-15 14:34       ` Samuel Thibault via Libc-alpha
2021-09-15 14:35         ` Samuel Thibault via Libc-alpha
2021-09-15 15:13         ` Sergey Bugaev via Libc-alpha
2021-09-15 15:16           ` Samuel Thibault via Libc-alpha
2021-09-07 13:33 ` [PATCH htl v3 3/5] htl: Reimplement GSCOPE Sergey Bugaev via Libc-alpha
2021-09-14 23:28   ` Samuel Thibault via Libc-alpha
2021-09-07 13:33 ` [PATCH htl v3 4/5] elf: Remove THREAD_GSCOPE_IN_TCB Sergey Bugaev via Libc-alpha
2021-09-14 23:29   ` Samuel Thibault via Libc-alpha
2021-09-07 13:33 ` [PATCH htl v3 5/5] testrun.sh: Add support for --tool=rpctrace Sergey Bugaev via Libc-alpha
2021-09-08  6:57   ` Florian Weimer via Libc-alpha
2021-09-09 23:25     ` Samuel Thibault via Libc-alpha
2021-09-07 17:05 ` [PATCH htl v3 0/5] Rewrite THREAD_GSCOPE Adhemerval Zanella via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210907133325.255690-1-bugaevc@gmail.com \
    --to=libc-alpha@sourceware.org \
    --cc=bug-hurd@gnu.org \
    --cc=bugaevc@gmail.com \
    --cc=samuel.thibault@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).