Re: [GIT PULL] x86 fixes

Ingo Molnar
2015-08-19T06:51:03Z

* Ingo Molnar <mingo@kernel.org> wrote:

>
> * H. Peter Anvin <hpa@zytor.com> wrote:
>
> > On 08/17/2015 10:17 AM, Linus Torvalds wrote:
> > > On Mon, Aug 17, 2015 at 9:58 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> > >>
> > >> That is not true. It *does* work, and I have tested it fairly recently.
> > >
> > > Ok, so it's not too badly broken. Good.
> > >
> > > Also, while it's been a long time since we needed FPU emulation on the
> > > i486sx, I don't recall the details of any of the (much more modern)
> > > IoT small cores. I *think* the base platforms are all at a Pentium
> > > level (ie not just FPU, but MMX), but maybe there's some reason to
> > > keep FP emulation alive for some platforms.
> > >
> >
> > I just went back and looked at my records... I can guarantee that it
> > worked as of 743aa456c1834f76982af44e8b71d1a0b2a82e21.
>
> So I went and built 743aa456c1834f76 with ARCH=i386 defconfig +MATH_EMULATION=y
> and booted it on real hardware with and without 'no387':
>
> - 743aa456c1834f76: boots fine to a generic distro
> - 743aa456c1834f76 + no387: early crash

Ah, so I was able to make math-emu work with the 'no387 nofxsr' boot options.

It turns out that the crash happens due 'no387' not turning off all modern FPU
features in cpufeatures, which confuses the FPU code. (This is a far less severe
bug than math emu not working at all.)

I get some instances of:

/etc/rc3.d/S99local: line 26: 1626 Illegal instruction

due to user-space presuming modern FPU capabilities:

Program received signal SIGILL, Illegal instruction.
0xb76be371 in RAND_SSLeay () from /lib/libcrypto.so.6

0xb76be371 <RAND_SSLeay+1297>: fucomip %st(1),%st

FUCOMPIP is a P6+ FPU instruction.

but otherwise it boots up to a shell prompt.

So I take back my claim, math-emu works. If math-emu grew support for some P6 era
FPU instructions it might even boot up generic distros without too much trouble.

Thanks,

Ingo