Re: [PATCH] x86: static_cpu_has_safe: discard dynamic check after init

From: H. Peter Anvin
Date: Wed Jan 20 2016 - 11:17:00 EST


On 01/20/16 08:04, Borislav Petkov wrote:
> On Wed, Jan 20, 2016 at 07:09:39AM -0800, H. Peter Anvin wrote:
>> But then you're using testl and get long immediates.
>>
>> (And the parentheses around boot_cpu_data->x86_capability are redundant.)
>
> Right.
>
> Ok, below is what builds here. So no SOBs etc.
>
> All this include hell wankery is so that we can use boot_cpu_data in
> cpufeature.h. And that's not simple because boot/mkcpustr.c includes it
> too so if I carve out struct cpuinfo_x86 to a separate asm/cpuinfo.h
> header, it complains because it doesn't see it.
>
> Thus this _ASM_BOOT_MKCPUSTR_ yucky marker to stop arch/x86/boot from
> including it.
>
> I'm very open to better ideas. :-)
>

I think the right answer is to split the macros that define specific CPU
features into a separate file. It would also make it assembly-safe
which would be useful in some other places.

However, I do also want to observe that we already do have this specific
marker... it is called __KERNEL__.

-hpa