Re: [PATCH 4/5] x86/fpu: Speed up lazy FPU restores slightly

From: Andy Lutomirski
Date: Sat Jan 23 2016 - 17:10:25 EST


On Sat, Jan 23, 2016 at 2:14 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Fri, Jan 22, 2016 at 04:56:05PM -0800, Andy Lutomirski wrote:
>> If we have an FPU, there's no need to check CR0 for FPU emulation.
>>
>> Signed-off-by: Andy Lutomirski <luto@xxxxxxxxxx>
>> ---
>> arch/x86/kernel/traps.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
>> index 87f80febf477..183b300f6a8b 100644
>> --- a/arch/x86/kernel/traps.c
>> +++ b/arch/x86/kernel/traps.c
>> @@ -752,7 +752,7 @@ do_device_not_available(struct pt_regs *regs, long error_code)
>> RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
>>
>> #ifdef CONFIG_MATH_EMULATION
>> - if (read_cr0() & X86_CR0_EM) {
>> + if (!cpu_has_fpu && (read_cr0() & X86_CR0_EM)) {
>
> Please use
>
> boot_cpu_has(X86_FEATURE_FPU)
>
> We want to kill those cpu_has_xxx things.

Queued for v2.

Maybe this will be just cpu_has some day if my theory about the new
improved static_cpu_has being shorter than boot_cpu_has pans out :)

--Andy