Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2006 16:19:29 -0700
From:      Colin Percival <cperciva@freebsd.org>
To:        Rostislav Krasny <rosti.bsd@gmail.com>
Cc:        Igor Sysoev <is@rambler-co.ru>, David Xu <davidxu@freebsd.org>, freebsd-current@freebsd.org
Subject:   Re: FreeBSD-SA-06:14.fpu
Message-ID:  <44554601.5090105@freebsd.org>
In-Reply-To: <20060430142408.fcd60069.rosti.bsd@gmail.com>
References:  <20060430142408.fcd60069.rosti.bsd@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44554601.5090105>