Re: [PATCH 3/3] x86/fpu: Save FPU registers on context switch if there is a FPU

From: Andy Lutomirski
Date: Tue Oct 16 2018 - 19:00:59 EST

On Tue, Oct 16, 2018 at 1:25 PM Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
> Booting a 486 with "no387 nofxsr" ends with
> | math_emulate: 0060:c101987d
> | Kernel panic - not syncing: Math emulation needed in kernel
> on the first context switch in user land. The reason is that
> copy_fpregs_to_fpstate() tries `fnsave' which does not work. This
> happens since commit f1c8cd0176078 ("x86/fpu: Change fpu->fpregs_active
> users to fpu->fpstate_active").
> Add a check for X86_FEATURE_FPU before trying to save FPU registers (we
> have such a check switch_fpu_finish() already).
> Fixes: f1c8cd0176078 ("x86/fpu: Change fpu->fpregs_active users to fpu->fpstate_active")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

Reviewed-by: Andy Lutomirski <luto@xxxxxxxxxx>