From patchwork Tue Dec 7 12:59:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 48576 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0472A385842E for ; Tue, 7 Dec 2021 12:59:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0472A385842E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1638881999; bh=CGV0HfxBLOjBA6d9n5AKLOM7VHgdlXV1y5x/2CJ/S7Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=l8drfzzgX2VhUG7ux9XEl6FIMKu+MEdNky44R8ymtXm/beJH7TZHMUVMxk2MS00b2 vpZmdLl7SMUfmkxmkUfs78jMWTAEgWY33EHr2RQd3MCsRH382NRaeFmQSnfbJqv4fQ qnbja5bAKPFmKU55vT2doj6kIHmfLwPiCwnwFfbg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 13F873858C60 for ; Tue, 7 Dec 2021 12:59:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 13F873858C60 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-241-uIEvpmapOcCyCIm7Vwo-kQ-1; Tue, 07 Dec 2021 07:59:32 -0500 X-MC-Unique: uIEvpmapOcCyCIm7Vwo-kQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74153100F94F for ; Tue, 7 Dec 2021 12:59:31 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ACCFC10114AE for ; Tue, 7 Dec 2021 12:59:29 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 0/8] Extensible rseq integration X-From-Line: 354a2d43774aeca68104a6230caa4be7141ed43b Mon Sep 17 00:00:00 2001 Message-Id: Date: Tue, 07 Dec 2021 13:59:26 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This series integrates the previous posted v2 for . It incorporates Mathieu's and Paul E. McKenney suggestion to use a volatile read for rseq_abi.cpu_id access, using a new THREAD_GETMEM_VOLATILE macro. The last patch in the series makes rseq registration consistent across threads. Florian Weimer (8): nptl: Add for defining __thread_pointer nptl: Introduce for THREAD_* accessors nptl: Introduce THREAD_GETMEM_VOLATILE nptl: Add rseq registration Linux: Use rseq to accelerate sched_getcpu nptl: Add glibc.pthread.rseq tunable to control rseq registration nptl: Add public rseq symbols and nptl: rseq failure after registration on main thread is fatal NEWS | 11 + manual/threads.texi | 81 ++++++ manual/tunables.texi | 10 + nptl/descr.h | 4 + nptl/pthread_create.c | 22 ++ sysdeps/aarch64/nptl/tls.h | 10 +- sysdeps/alpha/nptl/tls.h | 10 +- sysdeps/arc/nptl/tls.h | 10 +- sysdeps/arm/nptl/tls.h | 10 +- sysdeps/csky/nptl/tls.h | 10 +- sysdeps/hppa/nptl/tls.h | 10 +- sysdeps/i386/nptl/tcb-access.h | 125 +++++++++ sysdeps/i386/nptl/tls.h | 108 +------- sysdeps/ia64/nptl/tls.h | 10 +- sysdeps/m68k/nptl/tls.h | 10 +- sysdeps/microblaze/nptl/tls.h | 15 +- sysdeps/mips/nptl/tls.h | 9 +- sysdeps/nios2/nptl/tls.h | 10 +- sysdeps/nptl/dl-tls_init_tp.c | 38 ++- sysdeps/nptl/dl-tunables.list | 6 + sysdeps/nptl/internaltypes.h | 1 + sysdeps/nptl/tcb-access.h | 32 +++ sysdeps/nptl/thread_pointer.h | 28 ++ sysdeps/powerpc/nptl/thread_pointer.h | 33 +++ sysdeps/powerpc/nptl/tls.h | 15 +- sysdeps/riscv/nptl/tls.h | 9 +- sysdeps/s390/nptl/tls.h | 10 +- sysdeps/sh/nptl/tls.h | 14 +- sysdeps/sparc/nptl/tls.h | 10 +- sysdeps/unix/sysv/linux/Makefile | 20 +- sysdeps/unix/sysv/linux/Versions | 5 + sysdeps/unix/sysv/linux/aarch64/bits/rseq.h | 43 +++ sysdeps/unix/sysv/linux/aarch64/ld.abilist | 3 + sysdeps/unix/sysv/linux/alpha/ld.abilist | 3 + sysdeps/unix/sysv/linux/arc/ld.abilist | 3 + sysdeps/unix/sysv/linux/arm/be/ld.abilist | 3 + sysdeps/unix/sysv/linux/arm/bits/rseq.h | 83 ++++++ sysdeps/unix/sysv/linux/arm/le/ld.abilist | 3 + sysdeps/unix/sysv/linux/bits/rseq.h | 29 ++ sysdeps/unix/sysv/linux/csky/ld.abilist | 3 + sysdeps/unix/sysv/linux/hppa/ld.abilist | 3 + sysdeps/unix/sysv/linux/i386/ld.abilist | 3 + sysdeps/unix/sysv/linux/ia64/ld.abilist | 3 + .../unix/sysv/linux/m68k/coldfire/ld.abilist | 3 + .../unix/sysv/linux/m68k/m680x0/ld.abilist | 3 + sysdeps/unix/sysv/linux/microblaze/ld.abilist | 3 + sysdeps/unix/sysv/linux/mips/bits/rseq.h | 62 +++++ .../unix/sysv/linux/mips/mips32/ld.abilist | 3 + .../sysv/linux/mips/mips64/n32/ld.abilist | 3 + .../sysv/linux/mips/mips64/n64/ld.abilist | 3 + sysdeps/unix/sysv/linux/nios2/ld.abilist | 3 + sysdeps/unix/sysv/linux/powerpc/bits/rseq.h | 37 +++ .../sysv/linux/powerpc/powerpc32/ld.abilist | 3 + .../linux/powerpc/powerpc64/be/ld.abilist | 3 + .../linux/powerpc/powerpc64/le/ld.abilist | 3 + sysdeps/unix/sysv/linux/riscv/rv32/ld.abilist | 3 + sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist | 3 + sysdeps/unix/sysv/linux/rseq-internal.h | 52 ++++ sysdeps/unix/sysv/linux/s390/bits/rseq.h | 37 +++ .../unix/sysv/linux/s390/s390-32/ld.abilist | 3 + .../unix/sysv/linux/s390/s390-64/ld.abilist | 3 + sysdeps/unix/sysv/linux/sched_getcpu.c | 19 +- sysdeps/unix/sysv/linux/sh/be/ld.abilist | 3 + sysdeps/unix/sysv/linux/sh/le/ld.abilist | 3 + .../unix/sysv/linux/sparc/sparc32/ld.abilist | 3 + .../unix/sysv/linux/sparc/sparc64/ld.abilist | 3 + sysdeps/unix/sysv/linux/sys/rseq.h | 184 +++++++++++++ sysdeps/unix/sysv/linux/tst-rseq-disable.c | 95 +++++++ sysdeps/unix/sysv/linux/tst-rseq-nptl.c | 260 ++++++++++++++++++ sysdeps/unix/sysv/linux/tst-rseq.c | 72 +++++ sysdeps/unix/sysv/linux/tst-rseq.h | 57 ++++ sysdeps/unix/sysv/linux/x86/bits/rseq.h | 30 ++ sysdeps/unix/sysv/linux/x86_64/64/ld.abilist | 3 + sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist | 3 + sysdeps/x86/nptl/thread_pointer.h | 38 +++ sysdeps/x86_64/nptl/tcb-access.h | 132 +++++++++ sysdeps/x86_64/nptl/tls.h | 114 +------- 77 files changed, 1745 insertions(+), 382 deletions(-) create mode 100644 sysdeps/i386/nptl/tcb-access.h create mode 100644 sysdeps/nptl/tcb-access.h create mode 100644 sysdeps/nptl/thread_pointer.h create mode 100644 sysdeps/powerpc/nptl/thread_pointer.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/rseq.h create mode 100644 sysdeps/unix/sysv/linux/arm/bits/rseq.h create mode 100644 sysdeps/unix/sysv/linux/bits/rseq.h create mode 100644 sysdeps/unix/sysv/linux/mips/bits/rseq.h create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/rseq.h create mode 100644 sysdeps/unix/sysv/linux/rseq-internal.h create mode 100644 sysdeps/unix/sysv/linux/s390/bits/rseq.h create mode 100644 sysdeps/unix/sysv/linux/sys/rseq.h create mode 100644 sysdeps/unix/sysv/linux/tst-rseq-disable.c create mode 100644 sysdeps/unix/sysv/linux/tst-rseq-nptl.c create mode 100644 sysdeps/unix/sysv/linux/tst-rseq.c create mode 100644 sysdeps/unix/sysv/linux/tst-rseq.h create mode 100644 sysdeps/unix/sysv/linux/x86/bits/rseq.h create mode 100644 sysdeps/x86/nptl/thread_pointer.h create mode 100644 sysdeps/x86_64/nptl/tcb-access.h base-commit: 68007900beef12000ed90f38c251eaf32fbc0490