develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #118055] miniperl fails with SIGBUS on sparc(usethreads+use64bitint)

Thread Previous | Thread Next
From:
Niko Tyni
Date:
May 22, 2013 19:40
Subject:
Re: [perl #118055] miniperl fails with SIGBUS on sparc(usethreads+use64bitint)
Message ID:
20130522193953.GA4217@madeleine.local.invalid
On Wed, May 22, 2013 at 12:33:28PM +0100, Nicholas Clark wrote:
> On Tue, May 21, 2013 at 05:02:38PM -0400, Andy Dougherty wrote:
> > On Tue, 21 May 2013, Nicholas Clark wrote:
> 
> > > I can replicate this on one of the sparc linux machines on the GCC compile
> > > farm. For -Duse64bitint:
> > 
> > I was able to replicate it on an old Sparc Solaris system.  It compiles 
> > successfully with gcc-3.4.3, but fails with gcc-4.1.0 and gcc-4.6.0.
> 
> Interesting. So newer gcc is generating instructions that require alignment,
> and older gcc is not. And "old Sparc Solaris" meant that newer Sparc Solaris
> didn't (ie newer hardware can do misaligned reads?)

Earlier cases of similar alignment problems on sparc that I've seen
typically only occurred at gcc -O2, not at -O0. I was somewhat surprised
to see this one crash at -O0 too.

> > > Whilst it's cleaner, I'm wary of the idea of aligning everything to 8
> > > (for all platforms where sizeof(IV) > sizeof(void *)) because it will
> > > penalise ARM and x86 for BASOPs, BINOPs and LOGOPs, which are fairly
> > > common (I believe).
> > 
> > It could perhaps be protected by #ifdef __sparc__/#endif conditionals.
> 
> I don't think that this is correct, as I've read that mips can enable SIGBUS
> on misaligned reads, hence at least one other architecture potentially needs
> this.

FWIW ARM also has (probably different) alignment requirements, but
unaligned access trapping is somewhat controllable on ARM/Linux through
the sysctl interface at /proc/cpu/alignment. AIUI "fixing" an unaligned
access in the kernel causes a severe performance penalty.

 http://jsolano.net/2012/09/06/arm-unaligned-data-access-and-floating-point-in-linux/

I don't think there's a similar sysctl for Sparc / Linux (or Solaris
for that matter.)

> > I may be able to look at this late next week.
> 
> I hope to have something sooner than that.

Thanks for looking at this. I'm happy to test anything you come up with. 
-- 
Niko Tyni   ntyni@debian.org

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About