From patchwork Sat Sep 27 04:40:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos O'Donell X-Patchwork-Id: 3009 Received: (qmail 23371 invoked by alias); 27 Sep 2014 04:41:02 -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 23359 invoked by uid 89); 27 Sep 2014 04:40:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <54263FBC.5050200@redhat.com> Date: Sat, 27 Sep 2014 00:40:28 -0400 From: "Carlos O'Donell" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Andi Kleen , GNU C Library , Siddhesh Poyarekar Subject: Disable all lock elision unless --enable-lock-elision=yes Andi. The rwlock elision support you added in 2014-06-13 appears to unconditionally enable elision for rwlock's if the RTM-bit indicates TSX is present. That isn't what we do for mutexes, and isn't very conservative in that case. Did I read the code right? If I did, could we please put rwlock TSX usage under the control of the --enable-lock-elision flag? I need to easily disable TSX for all of glibc, until we can get early microcode updates worked out, and I had to hack things up because --enable-lock-elision no longer controls all of the elision uses in glibc. For example the following WIP patch does what I'm thinking. Cheers, Carlos. --- I should probably patch configure.ac to change the description of the enable option to talk about all locks. Cheers, Carlos. diff -urN glibc-2.20.mod/sysdeps/unix/sysv/linux/x86/elision-conf.c glibc-2.20/sysdeps/unix/sysv/linux/x86/elision-conf.c --- glibc-2.20.mod/sysdeps/unix/sysv/linux/x86/elision-conf.c 2014-09-27 00:25:46.443462345 -0400 +++ glibc-2.20/sysdeps/unix/sysv/linux/x86/elision-conf.c 2014-09-27 00:29:53.586615813 -0400 @@ -62,12 +62,16 @@ char **argv __attribute__ ((unused)), char **environ) { - __elision_available = HAS_RTM; #ifdef ENABLE_LOCK_ELISION + __elision_available = HAS_RTM; __pthread_force_elision = __libc_enable_secure ? 0 : __elision_available; -#endif if (!HAS_RTM) __elision_aconf.retry_try_xbegin = 0; /* Disable elision on rwlocks */ +#else + __elision_available = 0; + __pthread_force_elision = 0; + __elision_aconf.retry_try_xbegin = 0; +#endif } #ifdef SHARED