Re: [PATCH 3/3] x86, FPU: Do not use static_cpu_has before alternatives

From: H. Peter Anvin
Date: Mon Apr 29 2013 - 11:42:46 EST

On 04/29/2013 07:04 AM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
> The call stack below shows how this happens: basically eager_fpu_init()
> calls __thread_fpu_begin(current) which then does if (!use_eager_fpu()),
> which, in turn, uses static_cpu_has.
> And we're executing before alternatives so static_cpu_has doesn't work
> there yet.
> However, I don't want to cause the penalty of not using static_cpu_has
> to all callers of use_eager_fpu() which are a bunch spread around the
> tree so let's add the change only to __thread_fpu_begin() - it is still
> on the context switch path but we can at least keep the static_cpu_has
> call in the rest of the use_eager_fpu() callsites.

I *was* considering adding static_cpu_has_safe() at some point which
would have a three-state jump, with the default (pre-alternatives) jump
pointing to dynamic detection code.

This might be useful here, on the other hand, perhaps it is acceptable
for use_eager_fpu() to be initially false?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at