From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id 5F6D73854835 for ; Thu, 18 Mar 2021 12:44:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5F6D73854835 Received: by mail-qt1-x830.google.com with SMTP id r14so3891740qtt.7 for ; Thu, 18 Mar 2021 05:44:25 -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=5qeACkGNa6rLakiP3eyMYXXeRazxLajxhpF9LImKvrU=; b=C6RIKHOTC1sU0JNVs+Tq4Pcr3H0Of+UwFso0WbLT0mbZKf7ug8yAmeCZe1EbtRvedG vpCHWTQ2mWDtYBuxPuBKyb7Bh0aHWuZdLQI46voe1NvLzK2LsF8fRk4MwTvsYbmXYSkr FSViOuKH6cZ9xDlnxWPzvz28tGUMBtXlNEp3E4Gv9HWzl6QJPGzvSjzC4bhFzZbPdj1s t0YEYVFUsZappvHXs6EJjHwJpd51TYaw953JSfnP2AdnXF+ix1qQq/P1/X9IGrdHK2MI e5tYhA0E2I6O/EjJH1Rl42gjR+3HdjMIrM0R5gfhDzsBTXQgv+I1TonYN6xRv631xR9T EcSA== X-Gm-Message-State: AOAM532hJOIM5JE+B4CZzSjI9lobjSNmPsHScTbli6MJwJLqOBOoAj/6 PJLXeOJOOpMNOPRzg2ITTUacTddjKWadAQkH X-Google-Smtp-Source: ABdhPJyi3nWFgWaR7P9LpnWCqTZ8cA3UKzUMOCpUfwhd6HN8H+Qp8q7lsHxzwmwibW6SQIwS8Fu9rg== X-Received: by 2002:aed:2b06:: with SMTP id p6mr3510661qtd.101.1616071464792; Thu, 18 Mar 2021 05:44:24 -0700 (PDT) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm1342883qti.79.2021.03.18.05.44.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Mar 2021 05:44:24 -0700 (PDT) Subject: Re: [PATCH v3 13/37] nptl: Move __pthread_keys global variable into libc To: Florian Weimer , libc-alpha@sourceware.org References: <5cda5f191909a1e9b3f2f48ce6f417b4b7ea3556.1615914631.git.fweimer@redhat.com> From: Adhemerval Zanella Message-ID: Date: Thu, 18 Mar 2021 09:44:22 -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: <5cda5f191909a1e9b3f2f48ce6f417b4b7ea3556.1615914631.git.fweimer@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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, 18 Mar 2021 12:44:27 -0000 On 16/03/2021 14:29, Florian Weimer via Libc-alpha wrote: > This prepares moving pthread_exit, and later the pthread_key_create > infrastructure. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > nptl/Makefile | 1 + > nptl/Versions | 1 + > nptl/pthreadP.h | 2 +- > nptl/pthread_keys.c | 24 ++++++++++++++++++++++++ > nptl/vars.c | 5 ----- > nptl_db/structs.def | 2 +- > 6 files changed, 28 insertions(+), 7 deletions(-) > create mode 100644 nptl/pthread_keys.c > > diff --git a/nptl/Makefile b/nptl/Makefile > index d7491632b8..c0ae3593ef 100644 > --- a/nptl/Makefile > +++ b/nptl/Makefile > @@ -76,6 +76,7 @@ routines = \ > pthread_getaffinity \ > pthread_getattr_np \ > pthread_getschedparam \ > + pthread_keys \ > pthread_mutex_consistent \ > pthread_once \ > pthread_self \ Ok. > diff --git a/nptl/Versions b/nptl/Versions > index 968c4fba35..13198d1e89 100644 > --- a/nptl/Versions > +++ b/nptl/Versions > @@ -120,6 +120,7 @@ libc { > __pthread_cond_init; # Used by the C11 threads. > __pthread_force_elision; > __pthread_getattr_default_np; > + __pthread_keys; > __pthread_unwind; > } > } Ok. > diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h > index b136aeae4d..d28610150c 100644 > --- a/nptl/pthreadP.h > +++ b/nptl/pthreadP.h > @@ -217,7 +217,7 @@ extern int __concurrency_level attribute_hidden; > > /* Thread-local data key handling. */ > extern struct pthread_key_struct __pthread_keys[PTHREAD_KEYS_MAX]; > -hidden_proto (__pthread_keys) > +libc_hidden_proto (__pthread_keys) > > /* Number of threads running. */ > extern unsigned int __nptl_nthreads; Ok. > diff --git a/nptl/pthread_keys.c b/nptl/pthread_keys.c > new file mode 100644 > index 0000000000..76e4cfad34 > --- /dev/null > +++ b/nptl/pthread_keys.c > @@ -0,0 +1,24 @@ > +/* Table of pthread_key_create keys and their destructors. > + Copyright (C) 2004-2021 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > + > +/* Table of the key information. */ > +struct pthread_key_struct __pthread_keys[PTHREAD_KEYS_MAX] > + __attribute__ ((nocommon)); > +libc_hidden_data_def (__pthread_keys) Ok. > diff --git a/nptl/vars.c b/nptl/vars.c > index 51de9fbd54..8de30856b8 100644 > --- a/nptl/vars.c > +++ b/nptl/vars.c > @@ -33,8 +33,3 @@ int __default_pthread_attr_lock = LLL_LOCK_INITIALIZER; > nptl/descr.h for more context on the single-threaded process case. */ > int __pthread_multiple_threads attribute_hidden; > #endif > - > -/* Table of the key information. */ > -struct pthread_key_struct __pthread_keys[PTHREAD_KEYS_MAX] > - __attribute__ ((nocommon)); > -hidden_data_def (__pthread_keys) Ok. > diff --git a/nptl_db/structs.def b/nptl_db/structs.def > index 1522c96f8f..33bf0f9be4 100644 > --- a/nptl_db/structs.def > +++ b/nptl_db/structs.def > @@ -82,7 +82,7 @@ DB_MAIN_VARIABLE (__nptl_nthreads) > DB_VARIABLE (__nptl_last_event) > DB_VARIABLE (__nptl_initial_report_events) > > -DB_ARRAY_VARIABLE (__pthread_keys) > +DB_MAIN_ARRAY_VARIABLE (__pthread_keys) > DB_STRUCT (pthread_key_struct) > DB_STRUCT_FIELD (pthread_key_struct, seq) > DB_STRUCT_FIELD (pthread_key_struct, destr) > Ok.