Re: FreeBSD-SA-06:14.fpu

From: Colin Percival <cperciva_at_freebsd.org>
Date: Sun, 30 Apr 2006 16:19:29 -0700
> David Xu wrote:
>> Probably it should only be applied to AMD CPU but not Intel and others,
>> it is easy to check cpu vendor and put a
>> if (bug_fxsave)
>> 	fpu_clean_state();
>> in file npx.c.

The problem with doing something like this is that the branch will
almost never be in the processor's branch prediction tables, so you
will get a branch mis-prediction on the unaffected processors --
which is likely to be more expensive than simply running the state
cleaning code.

Rostislav Krasny wrote:
> Other possible solution is making the fpu_clean_state() optional by
> something like following:
> 
> #ifdef BUG_FXSAVE
> #define fpu_clean_state() __fpu_clean_state()
> #else
> #define fpu_clean_state() ;
> #endif
> 
> ... and including "options BUG_FXSAVE" to GENERIC.

Yes, this is probably the right solution.  My priority was to fix the
bug; optimizing performance comes second.

Colin Percival
Received on Mon May 01 2006 - 03:13:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:55 UTC