lkml.org 
[lkml]   [2024]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] x86/cpu: Fix x86 match cpu() to match just X86 VENDOR INTEL
On May 17, 2024 10:38:11 AM PDT, Borislav Petkov <bp@alien8.de> wrote:
>On Fri, May 17, 2024 at 10:21:34AM -0700, Tony Luck wrote:
>> diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c
>> index 8651643bddae..996f96cfce68 100644
>> --- a/arch/x86/kernel/cpu/match.c
>> +++ b/arch/x86/kernel/cpu/match.c
>> @@ -39,7 +39,7 @@ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match)
>> struct cpuinfo_x86 *c = &boot_cpu_data;
>>
>> for (m = match;
>> - m->vendor | m->family | m->model | m->steppings | m->feature;
>> + m->vendor | m->family | m->model | m->steppings | m->feature | m->flags;
>
>I think this should not do anything implicit even if it is correct but
>should explicitly check
>
> if (!(m->flags & X86_CPU_ID_FLAG_VENDOR_VALID))
> continue;
>
>I don't have a clear idea how exactly yet - I need to play with it.
>
>Maybe this stupid flow in the loop should be finally fixed into
>something more readable and sensible...
>
>Thx.
>

Thought: why don't we add VENDOR and CPUID as synthetic CPU feature flags as well? Not saying it necessarily solves this specific problem but it might make some other code more uniform.

Obviously on x86-64 CPUID is baseline; VENDOR might not be known, however.

\
 
 \ /
  Last update: 2024-05-27 18:30    [W:0.057 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site