From patchwork Fri Oct 17 22:03:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 3279 Received: (qmail 3593 invoked by alias); 17 Oct 2014 22:04:00 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 3584 invoked by uid 89); 17 Oct 2014 22:03:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] NPTL: Clean up THREAD_SYSINFO macros. Message-Id: <20141017220355.9E9442C2452@topped-with-meat.com> Date: Fri, 17 Oct 2014 15:03:55 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=HmxzzpQ5do9kwjftEr4A:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=FOV4igQQi3lVatwr:21 a=fDd2OF8Fc7v1VetP:21 a=CjuIK1q_8ugA:10 This has no material effect on Linux configurations. Thanks, Roland * sysdeps/i386/nptl/tls.h (THREAD_SELF_SYSINFO, THREAD_SYSINFO): Macros removed. [NEED_DL_SYSINFO] (SETUP_THREAD_SYSINFO, CHECK_THREAD_SYSINFO): New macros. * sysdeps/ia64/nptl/tls.h [NEED_DL_SYSINFO] (SETUP_THREAD_SYSINFO, CHECK_THREAD_SYSINFO): New macros. * nptl/allocatestack.c (allocate_stack) [NEED_DL_SYSINFO]: Call SETUP_THREAD_SYSINFO instead of doing an assignment. * nptl/createthread.c (create_thread) [NEED_DL_SYSINFO]: Call CHECK_THREAD_SYSINFO instead of doing an assert. --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -430,8 +430,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, #endif #ifdef NEED_DL_SYSINFO - /* Copy the sysinfo value from the parent. */ - THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO; + SETUP_THREAD_SYSINFO (pd); #endif /* The process ID is also the same as that of the caller. */ @@ -567,8 +566,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, #endif #ifdef NEED_DL_SYSINFO - /* Copy the sysinfo value from the parent. */ - THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO; + SETUP_THREAD_SYSINFO (pd); #endif /* Don't allow setxid until cloned. */ --- a/nptl/createthread.c +++ b/nptl/createthread.c @@ -234,7 +234,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, } #ifdef NEED_DL_SYSINFO - assert (THREAD_SELF_SYSINFO == THREAD_SYSINFO (pd)); + CHECK_THREAD_SYSINFO (pd); #endif /* Determine whether the newly created threads has to be started --- a/nptl/nptl-init.c +++ b/nptl/nptl-init.c @@ -304,8 +304,10 @@ __pthread_initialize_minimal_internal (void) /* Minimal initialization of the thread descriptor. */ struct pthread *pd = THREAD_SELF; +#ifdef __NR_set_tid_address INTERNAL_SYSCALL_DECL (err); pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid); +#endif THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]); THREAD_SETMEM (pd, user_stack, true); if (LLL_LOCK_INITIALIZER != 0) --- a/sysdeps/i386/nptl/tls.h +++ b/sysdeps/i386/nptl/tls.h @@ -141,9 +141,6 @@ union user_desc_init # define GET_DTV(descr) \ (((tcbhead_t *) (descr))->dtv) -#define THREAD_SELF_SYSINFO THREAD_GETMEM (THREAD_SELF, header.sysinfo) -#define THREAD_SYSINFO(pd) ((pd)->header.sysinfo) - /* Macros to load from and store into segment registers. */ # ifndef TLS_GET_GS # define TLS_GET_GS() \ @@ -154,9 +151,13 @@ union user_desc_init __asm ("movw %w0, %%gs" :: "q" (val)) # endif -#if defined NEED_DL_SYSINFO +#ifdef NEED_DL_SYSINFO # define INIT_SYSINFO \ _head->sysinfo = GLRO(dl_sysinfo) +# define SETUP_THREAD_SYSINFO(pd) \ + ((pd)->header.sysinfo = THREAD_GETMEM (THREAD_SELF, header.sysinfo)) +# define CHECK_THREAD_SYSINFO(pd) \ + assert ((pd)->header.sysinfo == THREAD_GETMEM (THREAD_SELF, header.sysinfo)) #else # define INIT_SYSINFO #endif --- a/sysdeps/ia64/nptl/tls.h +++ b/sysdeps/ia64/nptl/tls.h @@ -109,8 +109,12 @@ register struct pthread *__thread_self __asm__("r13"); #define THREAD_SYSINFO(pd) \ (((tcbhead_t *) ((char *) (pd) + TLS_PRE_TCB_SIZE))->__private) -#if defined NEED_DL_SYSINFO +#ifdef NEED_DL_SYSINFO # define INIT_SYSINFO THREAD_SELF_SYSINFO = (void *) GLRO(dl_sysinfo) +# define SETUP_THREAD_SYSINFO(pd) \ + (THREAD_SYSINFO (pd) = THREAD_SELF_SYSINFO) +# define CHECK_THREAD_SYSINFO(pd) \ + assert (THREAD_SYSINFO (pd) == THREAD_SELF_SYSINFO) #else # define INIT_SYSINFO NULL #endif