Re: (Hardware?) problem with denormal values on mipsel

James Cowgill <[email protected]>
Newsgroups gmane.linux.debian.ports.mips,gmane.linux.debian.devel.kernel
Message-ID <[email protected]>
Control: reassign -1 src:linux 3.16.7-ckt9-2
Control: retitle -1 linux: mips sqrt.s instruction not emulated on Loongson processors
Control: tags -1 fixed-upstream
# Will be fixed in 4.1

On Tue, 2015-05-26 at 20:21 +0300, Aaro Koskinen wrote:
> On Tue, May 26, 2015 at 10:13:35AM +0100, James Cowgill wrote:
> > On Sun, 2015-05-24 at 22:32 +0300, Aaro Koskinen wrote:
> > > On Fri, May 22, 2015 at 11:00:18PM +0100, James Cowgill wrote:
> > > > On Sat, 2015-05-23 at 00:04 +0300, Aaro Koskinen wrote:
> > > > > On Fri, May 22, 2015 at 05:27:14PM +0100, James Cowgill wrote:
> > > > > > Yep it's a hardware problem. The following assembly dies (raises SIGILL)
> > > > > > at 'sqrt.s' on the Loongsons and works everywhere else:
> > > > > > 
> > > > > > ===
> > > > > >         .set mips2
> > > > > >         .text
> > > > > >         .global main
> > > > > >         .type main, @function
> > > > > > main:
> > > > > >         lui $t0, %hi(value)
> > > > > >         lwc1 $f0, %lo(value)($t0)
> > > > > >         nop
> > > > > >         sqrt.s $f0, $f0
> > > > > >         jr $ra
> > > > > > 
> > > > > >         .data
> > > > > > value:
> > > > > >         .float 1.1342362e-39
> > > > > > ===
> > > > > 
> > > > > Is this a standalone reproducer program for the problem? Because
> > > > > I tried it on on my Loongson box and didn't get any SIGILL...
> > > > 
> > > > It should be. I tried it on some 3A machines at work and it crashed
> > > > there (and then some other machines which didn't crash). There's a 2F I
> > > > can try on Tuesday.
> > > 
> > > My Loongson is 2F...
> > 
> > I tried it on my 2F (it's a Lemote Fuloong) and it crashed there as well
> > (both the gfortran and my testcase). It's running up to date jessie.
> > 
> > What compiler versions do you have?
> > What does the 'cpu model' line say in /proc/cpuinfo?
> 
> I'm using binutils 2.25, GCC 5.1, Linux 4.1-rc5. The cpu model is:
> 
> cpu model               : ICT Loongson-2 V0.3  FPU V0.1

Thanks! The kernel was the important part which was different to my
setup.

There's probably still a hardware bug in here somewhere, but before 3.16
the kernel was fixing it with the math emulator.

From what I can see:
Commit 08a07904e182 in 3.16 ('MIPS: math-emu: Remove most ifdefery.')
incorrectly disabled emulation of the sqrt.s instruction on processors
only supporting the mips2/mips3 ISA.

Commit 7352c8b13dd9 in 3.18 ('MIPS: Loongson: Set Loongson-3's ISA level
to MIPS64R1') worked around this in the Loongson 3s because their ISA
level was bumped to mips64r1.

Commit 2d83fea786d7 in 4.1-rc1 ('MIPS: Correct FP ISA requirements')
fixed the underlying sqrt.s emulation bug.

It would be good if the 4.1-rc1 patch or at least the 'case fsqrt_op'
part (which is the fix for this bug) can be applied to a jessie stable
kernel and then installed on the buildds. This should fix the original
problem of eso-midas failing to build on mipsel.

Thanks,
James
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAABCgAGBQJVZcqGAAoJENp9Vyz7AWUHYlcP/Ry+MPAUcfDDNzvqdkxBHK1z
KbgdypzkYqgmSX2idT29UY+HOh407gsE+eETmKVXZp3kZbuBjGAkQPjUJPmpwWDR
BJUM2oEwJGmR30Ng1DVtCPZG02YOVLq6in6m3Y9Pb+JEvECs7CdsaxLw3MfcjUFo
T9kNi1Kf+Ux+eop2AINKhF/EdZjgcPcydtYhIOBiCRVflJ3rGvis5yXNBZn3qAae
PGlA8t9/QEb+eG98tnmBxVhkGC8X3Evsu+bhf7vHFdl8qLikYCxaKGpZs9D2VRx5
ddcVY62M9V2ejjcuRf4luvUVLxauxmB8y3qmg6egDocygokR98jIu5IL8XxOWV+H
fey3g8jxCvFu0LOxpOkxPbma/kQL9wCNHcATsFCNQau+8uKW0Cv5rGFSsyanTb++
ZxjxF35+gFciAqMFPXVA83rVEF9XgAF1k9yRAHAMYCNr1Ny/ejG+mG1UEyHali3E
QdbeMUMV7gMDbe+4unjRGPs2cDcycpRUL9/F8vOCcSCicUdTML+nLRmrUd8koQla
xDQUsWY8DPOWMYpPMBzDOmZO3iNnAYg31Hb4HzBXw3N9QZvkH9b8b/TtMhCe8Bio
jCeUyDhJtISg4+VskrKvkXep3bKQa2G7zKG2ro8g9YAElGT6kUWr6Nde+AmEK0Rg
0plRzIs5NtsmNz5TIPb6
=bDKR
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.