From patchwork Tue Mar 16 17:31:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 42619 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com 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 38FDA384BC33; Tue, 16 Mar 2021 17:31:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38FDA384BC33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1615915870; bh=35pRoY2N8INObsa0bQsJx3bh9UQkua5G1+ZkoX6x77Y=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=CmnKrskYxQI8FSH2xq77/+aWtdP9Nk25P1RosVkBVY8JtpoQq+DBwKUalHPZcwSmQ 81WZOEGLQ6YD4HFWwz4VaBDirMA+QM4vBI4ByhAqb47sjONNxYLKSI9oImbUOje+Zh u799n4wXBYVRWlX1seOaY70G95YAoZEzhZZoGK3w= 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.133.124]) by sourceware.org (Postfix) with ESMTP id C80923861969 for ; Tue, 16 Mar 2021 17:31:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C80923861969 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-P3ME71frNIGcMOSzWK_KDQ-1; Tue, 16 Mar 2021 13:31:04 -0400 X-MC-Unique: P3ME71frNIGcMOSzWK_KDQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7D1A107ACCD for ; Tue, 16 Mar 2021 17:31:03 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-254.ams2.redhat.com [10.36.112.254]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CBE65C1A3 for ; Tue, 16 Mar 2021 17:31:02 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v3 29/37] nptl: Move the internal thread priority protection symbols into libc In-Reply-To: References: Message-Id: <4d9fde839c6005514195b29455662217042580b4.1615914632.git.fweimer@redhat.com> Date: Tue, 16 Mar 2021 18:31:11 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@sourceware.org Sender: "Libc-alpha" This is a prerequisite for moving the mutex implementation. Reviewed-by: Adhemerval Zanella --- nptl/Makefile | 2 +- nptl/Versions | 5 +++++ nptl/pthreadP.h | 16 ++++++++++------ nptl/tpp.c | 6 +++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/nptl/Makefile b/nptl/Makefile index 1eca75ef35..353cbf8911 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -93,6 +93,7 @@ routines = \ pthread_setschedparam \ pthread_setspecific \ pthread_sigmask \ + tpp \ unwind \ shared-only-routines = forward @@ -232,7 +233,6 @@ libpthread-routines = \ sem_unlink \ sem_wait \ sigaction \ - tpp \ vars \ version \ diff --git a/nptl/Versions b/nptl/Versions index b3feadd045..4dee682ed9 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -121,6 +121,7 @@ libc { GLIBC_PRIVATE { __futex_abstimed_wait64; __futex_abstimed_wait_cancelable64; + __init_sched_fifo_prio; __libc_alloca_cutoff; __libc_allocate_rtsig_private; __libc_cleanup_pop_restore; @@ -147,13 +148,17 @@ libc { __pthread_cleanup_upto; __pthread_cond_destroy; # Used by the C11 threads. __pthread_cond_init; # Used by the C11 threads. + __pthread_current_priority; __pthread_exit; __pthread_force_elision; __pthread_getattr_default_np; __pthread_key_delete; __pthread_keys; __pthread_setcancelstate; + __pthread_tpp_change_priority; __pthread_unwind; + __sched_fifo_max_prio; + __sched_fifo_min_prio; } } diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 527e4acd4f..7fd290e004 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -231,12 +231,16 @@ rtld_hidden_proto (__nptl_set_robust_list_avail) #endif /* Thread Priority Protection. */ -extern int __sched_fifo_min_prio attribute_hidden; -extern int __sched_fifo_max_prio attribute_hidden; -extern void __init_sched_fifo_prio (void) attribute_hidden; -extern int __pthread_tpp_change_priority (int prev_prio, int new_prio) - attribute_hidden; -extern int __pthread_current_priority (void) attribute_hidden; +extern int __sched_fifo_min_prio; +libc_hidden_proto (__sched_fifo_min_prio) +extern int __sched_fifo_max_prio; +libc_hidden_proto (__sched_fifo_max_prio) +extern void __init_sched_fifo_prio (void); +libc_hidden_proto (__init_sched_fifo_prio) +extern int __pthread_tpp_change_priority (int prev_prio, int new_prio); +libc_hidden_proto (__pthread_tpp_change_priority) +extern int __pthread_current_priority (void); +libc_hidden_proto (__pthread_current_priority) /* The library can run in debugging mode where it performs a lot more tests. */ diff --git a/nptl/tpp.c b/nptl/tpp.c index 8b7d9a2d23..7f58a75731 100644 --- a/nptl/tpp.c +++ b/nptl/tpp.c @@ -25,9 +25,10 @@ #include #include - int __sched_fifo_min_prio = -1; +libc_hidden_data_def (__sched_fifo_min_prio) int __sched_fifo_max_prio = -1; +libc_hidden_data_def (__sched_fifo_max_prio) /* We only want to initialize __sched_fifo_min_prio and __sched_fifo_max_prio once. The standard solution would be similar to pthread_once, but then @@ -47,6 +48,7 @@ __init_sched_fifo_prio (void) atomic_store_relaxed (&__sched_fifo_min_prio, __sched_get_priority_min (SCHED_FIFO)); } +libc_hidden_def (__init_sched_fifo_prio) int __pthread_tpp_change_priority (int previous_prio, int new_prio) @@ -155,6 +157,7 @@ __pthread_tpp_change_priority (int previous_prio, int new_prio) return result; } +libc_hidden_def (__pthread_tpp_change_priority) int __pthread_current_priority (void) @@ -193,3 +196,4 @@ __pthread_current_priority (void) return result; } +libc_hidden_def (__pthread_current_priority)