projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6aa6767
)
x86/fpu: Fix i486 + no387 boot crash by only saving FPU registers on context switch...
author
Sebastian Andrzej Siewior
<
[email protected]
>
Tue, 16 Oct 2018 20:25:25 +0000
(22:25 +0200)
committer
Ingo Molnar
<
[email protected]
>
Wed, 17 Oct 2018 10:30:38 +0000
(12:30 +0200)
Booting an i486 with "no387 nofxsr" ends with with the following crash:
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
as the FPU is turned off.
This bug was introduced in:
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 in switch_fpu_finish() already).
Signed-off-by: Sebastian Andrzej Siewior <
[email protected]
>
Reviewed-by: Andy Lutomirski <
[email protected]
>
Cc: Borislav Petkov <
[email protected]
>
Cc: Dave Hansen <
[email protected]
>
Cc: Linus Torvalds <
[email protected]
>
Cc: Peter Zijlstra <
[email protected]
>
Cc: Thomas Gleixner <
[email protected]
>
Cc:
[email protected]
Fixes: f1c8cd0176078 ("x86/fpu: Change fpu->fpregs_active users to fpu->fpstate_active")
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Ingo Molnar <
[email protected]
>
arch/x86/include/asm/fpu/internal.h
patch
|
blob
|
history
diff --git
a/arch/x86/include/asm/fpu/internal.h
b/arch/x86/include/asm/fpu/internal.h
index a38bf5a1e37adbdb64007d95060e3575cfe3269c..69dcdf195b6112b691616e2512f8a4ecca4796a1 100644
(file)
--- a/
arch/x86/include/asm/fpu/internal.h
+++ b/
arch/x86/include/asm/fpu/internal.h
@@
-528,7
+528,7
@@
static inline void fpregs_activate(struct fpu *fpu)
static inline void
switch_fpu_prepare(struct fpu *old_fpu, int cpu)
{
- if (old_fpu->initialized) {
+ if (
static_cpu_has(X86_FEATURE_FPU) &&
old_fpu->initialized) {
if (!copy_fpregs_to_fpstate(old_fpu))
old_fpu->last_cpu = -1;
else