lkml.org 
[lkml]   [2024]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v8 2/2] x86/mm: Don't disable PCID if the kernel is running on a hypervisor
From
On 4/17/24 10:22, Pawan Gupta wrote:
>>> static const struct x86_cpu_id invlpg_miss_ids[] = {
>>> + /* Only bare-metal is affected. PCIDs in guests are OK. */
>>> + {
>>> + .vendor = X86_VENDOR_INTEL,
>>> + .family = 6,
>>> + .model = INTEL_FAM6_ANY,
>>> + .feature = X86_FEATURE_HYPERVISOR,
>> Isn't this inverted? x86_match_cpu() will return NULL if the CPU doesn't have
>> HYPERVISOR. We want it to return NULL if the CPU *does* have HYPERVISOR.
> I think the implementation is correct, x86_match_cpu() will not return
> NULL if the CPU doesn't have HYPERVISOR feature *and* matches one of the
> CPUs below. It will only return NULL if none of the entries match.

I think I gave a crappy suggestion here.

Let's just do the X86_FEATURE_HYPERVISOR explicitly in the code instead
of trying to cram it into the invlpg_miss_ids[] check. It's way easier
to understand with an explicit code check.

\
 
 \ /
  Last update: 2024-04-17 19:25    [W:0.107 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site