Re: FPU warning on x86_32 on Skylake

2016-12-19 Thread Lennart Sorensen
On Thu, Nov 24, 2016 at 09:11:41AM -0800, Andy Lutomirski wrote:
> I gett this when booting a 32-bit 4.9-rc6-ish on Skylake:
> 
> [0.564506] [ cut here ]
> [0.564994] WARNING: CPU: 0 PID: 1 at
> ./arch/x86/include/asm/fpu/internal.h:368 fpu__restore+0x203/0x210
> [0.565737] Modules linked in:
> [0.566040] CPU: 0 PID: 1 Comm: sh Not tainted 4.9.0-rc6+ #488
> [0.566502] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
> BIOS 1.9.3-1.fc25 04/01/2014
> [0.567174]  c78a9e5c c135a6d0  c1ac4b4c c78a9e8c c10aeb42
> c1ad53f0 
> [0.567896]  0001 c1ac4b4c 0170 c107e753 0170 c78a06c0
>  c78a0700
> [0.568583]  c78a9ea0 c10aec05 0009   c78a9eb8
> c107e753 c78a0700
> [0.569245] Call Trace:
> [0.569440]  [] dump_stack+0x58/0x78
> [0.569783]  [] __warn+0xe2/0x100
> [0.570109]  [] ? fpu__restore+0x203/0x210
> [0.570519]  [] warn_slowpath_null+0x25/0x30
> [0.570943]  [] fpu__restore+0x203/0x210
> [0.571312]  [] __fpu__restore_sig+0x1fc/0x580
> [0.571719]  [] fpu__restore_sig+0x2a/0x50
> [0.572103]  [] restore_sigcontext.isra.10+0xbd/0xd0
> [0.572546]  [] sys_sigreturn+0x81/0x90
> [0.572908]  [] do_int80_syscall_32+0x57/0xc0
> [0.573306]  [] entry_INT80_32+0x2a/0x2a
> [0.573677] ---[ end trace 88038c46b2a9d23a ]---
> 
> Telling KVM to disable XSAVES makes the warning go away.
> 
> I seem to be the only person testing 32-bit kernels on CPUs this new :-/

Well skylake added XRSTORS, which is used in place of XRSTOR if supported
by the CPU, but XRSTORS requires CPL=0, which XRSTOR did not as far as
I can tell.  Older CPUs don't have XRSTORS so this would not be an
issue there.

I don't know, but would not be surprised if running under kvm means the
guest kernel is not running with CPL=0 and hence the XRSTORS feature
ought not to be exposed as supported by the CPU to the guest kernel.

Just a guess.

Does this happen with a 64 bit kvm guest too?  Does it happen if the 32
bit kernel is booted on bare hardware?  My guess if I am thinking the
right thing is that the answers are yes and no respectively.

Looks like this was hit in jvm a couple of years ago:
https://www.spinics.net/lists/kvm/msg110434.html 

No idea what the resolution was if any.

-- 
Len Sorensen


Re: FPU warning on x86_32 on Skylake

2016-12-19 Thread Lennart Sorensen
On Thu, Nov 24, 2016 at 09:11:41AM -0800, Andy Lutomirski wrote:
> I gett this when booting a 32-bit 4.9-rc6-ish on Skylake:
> 
> [0.564506] [ cut here ]
> [0.564994] WARNING: CPU: 0 PID: 1 at
> ./arch/x86/include/asm/fpu/internal.h:368 fpu__restore+0x203/0x210
> [0.565737] Modules linked in:
> [0.566040] CPU: 0 PID: 1 Comm: sh Not tainted 4.9.0-rc6+ #488
> [0.566502] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
> BIOS 1.9.3-1.fc25 04/01/2014
> [0.567174]  c78a9e5c c135a6d0  c1ac4b4c c78a9e8c c10aeb42
> c1ad53f0 
> [0.567896]  0001 c1ac4b4c 0170 c107e753 0170 c78a06c0
>  c78a0700
> [0.568583]  c78a9ea0 c10aec05 0009   c78a9eb8
> c107e753 c78a0700
> [0.569245] Call Trace:
> [0.569440]  [] dump_stack+0x58/0x78
> [0.569783]  [] __warn+0xe2/0x100
> [0.570109]  [] ? fpu__restore+0x203/0x210
> [0.570519]  [] warn_slowpath_null+0x25/0x30
> [0.570943]  [] fpu__restore+0x203/0x210
> [0.571312]  [] __fpu__restore_sig+0x1fc/0x580
> [0.571719]  [] fpu__restore_sig+0x2a/0x50
> [0.572103]  [] restore_sigcontext.isra.10+0xbd/0xd0
> [0.572546]  [] sys_sigreturn+0x81/0x90
> [0.572908]  [] do_int80_syscall_32+0x57/0xc0
> [0.573306]  [] entry_INT80_32+0x2a/0x2a
> [0.573677] ---[ end trace 88038c46b2a9d23a ]---
> 
> Telling KVM to disable XSAVES makes the warning go away.
> 
> I seem to be the only person testing 32-bit kernels on CPUs this new :-/

Well skylake added XRSTORS, which is used in place of XRSTOR if supported
by the CPU, but XRSTORS requires CPL=0, which XRSTOR did not as far as
I can tell.  Older CPUs don't have XRSTORS so this would not be an
issue there.

I don't know, but would not be surprised if running under kvm means the
guest kernel is not running with CPL=0 and hence the XRSTORS feature
ought not to be exposed as supported by the CPU to the guest kernel.

Just a guess.

Does this happen with a 64 bit kvm guest too?  Does it happen if the 32
bit kernel is booted on bare hardware?  My guess if I am thinking the
right thing is that the answers are yes and no respectively.

Looks like this was hit in jvm a couple of years ago:
https://www.spinics.net/lists/kvm/msg110434.html 

No idea what the resolution was if any.

-- 
Len Sorensen