From owner-freebsd-sparc64@FreeBSD.ORG Tue Jun 21 16:49:36 2011 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAD7C106564A; Tue, 21 Jun 2011 16:49:36 +0000 (UTC) (envelope-from jasone@canonware.com) Received: from canonware.com (10140.x.rootbsd.net [204.109.63.53]) by mx1.freebsd.org (Postfix) with ESMTP id C82D28FC14; Tue, 21 Jun 2011 16:49:36 +0000 (UTC) Received: from [IPv6:::1] (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by canonware.com (Postfix) with ESMTPSA id CCC012843A; Tue, 21 Jun 2011 09:32:39 -0700 (PDT) Message-ID: <4E00C7A7.8080704@canonware.com> Date: Tue, 21 Jun 2011 09:32:39 -0700 From: Jason Evans User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: Marius Strobl References: <20110616073138.GL31996@gradx.cs.jhu.edu> <20110616075319.GM31996@gradx.cs.jhu.edu> <20110617180713.GA5300@alchemy.franken.de> <20110617193129.GC4764@gradx.cs.jhu.edu> <20110617213532.GG7064@alchemy.franken.de> In-Reply-To: <20110617213532.GG7064@alchemy.franken.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, Nathaniel W Filardo , jasone@freebsd.org, freebsd-sparc64@freebsd.org Subject: Re: TLS bug? X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2011 16:49:37 -0000 On 06/17/2011 02:35 PM, Marius Strobl wrote: > On Fri, Jun 17, 2011 at 03:31:29PM -0400, Nathaniel W Filardo wrote: >> On Fri, Jun 17, 2011 at 08:07:13PM +0200, Marius Strobl wrote: >>> Using bonnie++ I can't reproduce this (didn't try mysql) but I have >> >> I seem to have good luck reproducing it with "-r 5 -s 10 -x 10" by about the >> third iteration. > > Ok, with these parameters I can reproduce it. > >> >>> some TLS fixes for libthr I forgot about but could be relevant here >>> (most actually date back to 2008 when the base binutils didn't support >>> GNUTLS for sparc64 so I couldn't test them easily). Could you please >>> give a libthr build with the following patch a try? >>> http://people.freebsd.org/~marius/libthr_sparc64.diff >> >> Concurrent runs both with and without those diffs still asserted. >> Interestingly, libc's .tbss section, even after the assertion, is still full >> of zeros, so it looks like something stranger than a wild-write back to >> .tbss. I'll go diving through the tls allocation code again when I get a >> minute. >> > > In combination with the below patch bonnie++ survived 100 iterations > here. I'm not sure what this means though as I don't have much knowledge > about TLS, I merely implemented the necessary relocations. Could be > that malloc() actually requires the initial exec model for variant II. > Unfortunately, it's not documented why it was added for x86. > Jason, can you shed some light on this? > > Marius > > Index: malloc.c > =================================================================== > --- malloc.c (revision 219535) > +++ malloc.c (working copy) > @@ -234,7 +234,7 @@ > #ifdef __sparc64__ > # define LG_QUANTUM 4 > # define LG_SIZEOF_PTR 3 > -# define TLS_MODEL /* default */ > +# define TLS_MODEL __attribute__((tls_model("initial-exec"))) > #endif > #ifdef __amd64__ > # define LG_QUANTUM 4 > I added the initial-exec TLS_MODEL because it is faster than the default; jemalloc in no way depends on this for correctness though, so your patch is safe. Thanks, Jason