From patchwork Wed Mar 26 13:41:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 295 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id 83A6C36019C for ; Wed, 26 Mar 2014 06:41:52 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id 32E6E27CA7ED; Wed, 26 Mar 2014 06:41:52 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 0252F27CA7D1 for ; Wed, 26 Mar 2014 06:41:51 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=n/U kLnawG+B+YOPnzpFUCwPlGXilMdM4vdu+VxIfiJODL5E8xGVcW6m0PNcn1/wFEaq fFdKL41XVY7HJKDGFA7pRrVip3QQSTiDlI8nB6nte2HrUNxfJAQN4dJdoxd5HIx1 ac3DhDhvttebNSFs/Ck36eo6ahxrKoUZDUAuPBOI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=/dGCVPi3z 6Ts/aQCP7XMoQhWnu8=; b=dNdqAfj21Z5oX72p0LuvDcNjAWHm8eKYcblV2U2b2 H7EwHWngspSTvVRdbnUXXx0TIpdA0JcjzuiGTRuStPpTeFzMGy3kSxfuGJFlQ/5R Oh8ZHLE4fIC/3amp8PqBKRiI2hs2tzRm5RG2L89KHbnxkXAZhrK4tq8u9Xm5yi3d lI= Received: (qmail 31649 invoked by alias); 26 Mar 2014 13:41:49 -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 31633 invoked by uid 89); 26 Mar 2014 13:41:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp05.br.ibm.com Message-ID: <5332D913.5050903@linux.vnet.ibm.com> Date: Wed, 26 Mar 2014 10:41:39 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: "GNU C. Library" Subject: [PATCH] Remove __PTHREAD_MUTEX_HAVE_ELISION undefined warning X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14032613-1798-0000-0000-0000021CDA65 X-DH-Original-To: glibc@patchwork.siddhesh.in This is a respin of the original attempt of remove __PTHREAD_MUTEX_HAVE_ELISION compile warnings on arch that does not define it. Following Joseph suggestion I changed to use a bits header. This patch adds new installed header bits/pthread-elision.h that defines __PTHREAD_MUTEX_HAVE_ELISION to an appropriated value depending of the architecture support. Tested on PPC64 (no warnings) and x86_64 (with --lock-elision=yes/no). On X86_64 I don't have a TM capable chip, however the defines by checking the -E output is as expected. I didn't check the s390 build, however since it also does not define __PTHREAD_MUTEX_HAVE_ELISION I expect to follow PPC64 way. --- * nptl/sysdeps/pthread/bits/pthread-elision.h: New header: define default lock elision support and defines. * nptl/sysdeps/pthread/pthread.h: Include pthread-elision.h. * nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h (__PTHREAD_MUTEX_HAVE_ELISION): Undefine. * nptl/sysdeps/unix/sysv/linux/x86/bits/pthread-elision.h: New header: x86 specific lock elision support. * nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h: (__PTHREAD_MUTEX_HAVE_ELISION): Definition moved to specific lock elision header. * posix/Makefile: Add bits/pthread-elision.h to install. --- diff --git a/nptl/sysdeps/pthread/bits/pthread-elision.h b/nptl/sysdeps/pthread/bits/pthread-elision.h new file mode 100644 index 0000000..cc997ae --- /dev/null +++ b/nptl/sysdeps/pthread/bits/pthread-elision.h @@ -0,0 +1,28 @@ +/* Lock elision default definitions. + Copyright (C) 2014 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 + . */ + +#ifndef _PTHREAD_ELISION_H +#define _PTHREAD_ELISION_H 1 + +#if !defined _PTHREAD_H +# error "Never include this file directly. Use instead" +#endif + +#define __PTHREAD_MUTEX_HAVE_ELISION 0 + +#endif diff --git a/nptl/sysdeps/pthread/pthread.h b/nptl/sysdeps/pthread/pthread.h index 1e0c5dc..39d6b91 100644 --- a/nptl/sysdeps/pthread/pthread.h +++ b/nptl/sysdeps/pthread/pthread.h @@ -26,6 +26,7 @@ #include #include #include +#include /* Detach state. */ diff --git a/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h index 23a1698..a361db6 100644 --- a/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h +++ b/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h @@ -20,8 +20,6 @@ #include -# define __PTHREAD_MUTEX_HAVE_ELISION 0 - #if __WORDSIZE == 64 # define __SIZEOF_PTHREAD_ATTR_T 56 # define __SIZEOF_PTHREAD_MUTEX_T 40 diff --git a/nptl/sysdeps/unix/sysv/linux/x86/bits/pthread-elision.h b/nptl/sysdeps/unix/sysv/linux/x86/bits/pthread-elision.h new file mode 100644 index 0000000..1d3fef1 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86/bits/pthread-elision.h @@ -0,0 +1,32 @@ +/* x86 lock elision definitions. + Copyright (C) 2014 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 + . */ + +#ifndef _PTHREAD_ELISION_H +#define _PTHREAD_ELISION_H 1 + +#if !defined _PTHREAD_H +# error "Never include this file directly. Use instead" +#endif + +#ifdef __x86_64__ +# define __PTHREAD_MUTEX_HAVE_ELISION 1 +#else +# define __PTHREAD_MUTEX_HAVE_ELISION 2 +#endif + +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h index 28e5144..a5363ec 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h +++ b/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h @@ -105,7 +105,6 @@ typedef union short __elision; __pthread_list_t __list; # define __PTHREAD_MUTEX_HAVE_PREV 1 -# define __PTHREAD_MUTEX_HAVE_ELISION 1 #else unsigned int __nusers; __extension__ union @@ -116,7 +115,6 @@ typedef union short __elision; # define __spins d.__espins # define __elision d.__elision -# define __PTHREAD_MUTEX_HAVE_ELISION 2 } d; __pthread_slist_t __list; }; diff --git a/posix/Makefile b/posix/Makefile index 328c2c5..daf22cb 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -29,7 +29,7 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \ bits/local_lim.h tar.h bits/utsname.h bits/confname.h \ bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \ bits/sched.h re_comp.h wait.h bits/environments.h cpio.h \ - sys/sysmacros.h spawn.h bits/unistd.h + sys/sysmacros.h spawn.h bits/unistd.h bits/pthread-elision.h routines := \ uname \