From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by sourceware.org (Postfix) with ESMTPS id E47203858001 for ; Thu, 25 Mar 2021 20:21:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E47203858001 Received: by mail-qk1-x72f.google.com with SMTP id o5so3188987qkb.0 for ; Thu, 25 Mar 2021 13:21:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mvYXzEOEh6KinprQ3kC1/AcskWI2d4/FmfDKoE6eUOs=; b=B8QU6ZkA+92AM2JRIc6j9nWATfbh0zzc7cPkzoflqKcVa/UW/XIUpmd0NFliXj9/oP 3rftgnLxyGQ20pcgJo2SnkpnIE44XrxP/HwlPM/JtLYEYygb82zu+NHIloyRcS0YUYWZ VPqd+GJPn2xUx7br5nAuztYev3qqH1haHVB7XQ4hMynWxcMNVpDoVQ9sWt9D0ihgRAY0 NZ33gAJ1v81ADVql7SYAH3g0iInTG1MH5uF8j2deoqD5lQ8SkSTXOcjjKZiLOPdCw+pX +vZoTbUAfScWgi8vD8TER3hKEz18rQ2De+e8NrtaeQ4dvxLhLvJMlXe1JBcLGdUk3DEj /phQ== X-Gm-Message-State: AOAM530FqVnEwtP+PyO/MDRLwbRQqyDF6CqJqTZ/Clx5YA11foUaDBkd 1pDY3bfkTnLCGtwUOampIpEFlC22huhBEpRn X-Google-Smtp-Source: ABdhPJyHn5+dulItq8AtD7MssjsHj1lturqgk34WDjosACZJkfLLABVuHK57l6zo77yBOdXSG1ejdg== X-Received: by 2002:a05:620a:244f:: with SMTP id h15mr9528610qkn.235.1616703667436; Thu, 25 Mar 2021 13:21:07 -0700 (PDT) Received: from [192.168.1.132] ([177.194.41.149]) by smtp.gmail.com with ESMTPSA id g3sm4426910qth.66.2021.03.25.13.21.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Mar 2021 13:21:07 -0700 (PDT) Subject: Re: [PATCH v3 29/37] nptl: Move the internal thread priority protection symbols into libc To: libc-alpha@sourceware.org, Florian Weimer References: <4d9fde839c6005514195b29455662217042580b4.1615914632.git.fweimer@redhat.com> From: Adhemerval Zanella Message-ID: <4394f31a-a4cc-cb59-8685-e2ab2f5fa4a0@linaro.org> Date: Thu, 25 Mar 2021 17:21:05 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <4d9fde839c6005514195b29455662217042580b4.1615914632.git.fweimer@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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-List-Received-Date: Thu, 25 Mar 2021 20:21:09 -0000 On 16/03/2021 14:31, Florian Weimer via Libc-alpha wrote: > This is a prerequisite for moving the mutex implementation. LGTM, thanks. 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 \ > Ok. > 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; > } > } > Ok. I presume we might remove them once mutex code is moved to libc, right? > 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. */ Ok. > 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) > Ok.