Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1315708
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/5] x86/fpu: Fix math emulation in eager fpu mode |
| Date | 2016-01-23 18:50 +0100 |
| Message-ID | <qUatY-67d-3@gated-at.bofh.it> (permalink) |
| References | <qTUIx-3qs-3@gated-at.bofh.it> <qTUIy-3qs-21@gated-at.bofh.it> <qU3iN-17c-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, Jan 23, 2016 at 2:02 AM, Borislav Petkov <bp@alien8.de> wrote: > On Fri, Jan 22, 2016 at 04:56:02PM -0800, Andy Lutomirski wrote: >> Systems without an FPU are generally old and therefore use lazy FPU >> switching. Unsurprisingly, math emulation in eager FPU mode is a >> bit buggy. Fix it. >> >> There were two bugs involving kernel code trying to use the FPU >> registers in eager mode even if they didn't exist and one BUG_ON >> that was incorrect. >> >> Signed-off-by: Andy Lutomirski <luto@kernel.org> >> --- >> arch/x86/include/asm/fpu/internal.h | 3 ++- >> arch/x86/kernel/fpu/core.c | 2 +- >> arch/x86/kernel/traps.c | 1 - >> 3 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h >> index 0fd440df63f1..a1f78a9fbf41 100644 >> --- a/arch/x86/include/asm/fpu/internal.h >> +++ b/arch/x86/include/asm/fpu/internal.h >> @@ -589,7 +589,8 @@ switch_fpu_prepare(struct fpu *old_fpu, struct fpu *new_fpu, int cpu) >> * If the task has used the math, pre-load the FPU on xsave processors >> * or if the past 5 consecutive context-switches used math. >> */ >> - fpu.preload = new_fpu->fpstate_active && >> + fpu.preload = static_cpu_has(X86_FEATURE_FPU) && >> + new_fpu->fpstate_active && >> (use_eager_fpu() || new_fpu->counter > 5); > > Should we move that static_cpu_has(X86_FEATURE_FPU) check in > use_eager_fpu()? I'm confused. I want to make use_eager_fpu() return true always, so how would this help? The idea is for FPU emulation to work despite being in eager mode. > > I mean, when !X86_FEATURE_FPU, then we most certainly aren't doing eager > FPU anyway. With this patch applied, we can do eager fpu without X86_FEATURE_FPU :) --Andy
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] x86/fpu: eagerfpu fixes, speedups, and default enablement Andy Lutomirski <luto@kernel.org> - 2016-01-23 02:00 +0100
[PATCH 2/5] x86/fpu: Fix FNSAVE usage in eagerfpu mode Andy Lutomirski <luto@kernel.org> - 2016-01-23 02:00 +0100
[PATCH 4/5] x86/fpu: Speed up lazy FPU restores slightly Andy Lutomirski <luto@kernel.org> - 2016-01-23 02:00 +0100
Re: [PATCH 4/5] x86/fpu: Speed up lazy FPU restores slightly Borislav Petkov <bp@alien8.de> - 2016-01-23 11:20 +0100
Re: [PATCH 4/5] x86/fpu: Speed up lazy FPU restores slightly Andy Lutomirski <luto@amacapital.net> - 2016-01-23 23:20 +0100
Re: [PATCH 4/5] x86/fpu: Speed up lazy FPU restores slightly Borislav Petkov <bp@alien8.de> - 2016-01-24 00:40 +0100
[PATCH 5/5] x86/fpu: Default eagerfpu=on on all CPUs Andy Lutomirski <luto@kernel.org> - 2016-01-23 02:00 +0100
Re: [PATCH 5/5] x86/fpu: Default eagerfpu=on on all CPUs Borislav Petkov <bp@alien8.de> - 2016-01-23 11:30 +0100
[PATCH 1/5] x86/fpu: Fix math emulation in eager fpu mode Andy Lutomirski <luto@kernel.org> - 2016-01-23 02:00 +0100
Re: [PATCH 1/5] x86/fpu: Fix math emulation in eager fpu mode Borislav Petkov <bp@alien8.de> - 2016-01-23 11:10 +0100
Re: [PATCH 1/5] x86/fpu: Fix math emulation in eager fpu mode Andy Lutomirski <luto@amacapital.net> - 2016-01-23 18:50 +0100
Re: [PATCH 1/5] x86/fpu: Fix math emulation in eager fpu mode Borislav Petkov <bp@alien8.de> - 2016-01-23 19:00 +0100
csiph-web