lkml.org 
[lkml]   [2024]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v8 2/2] x86/mm: Don't disable PCID if the kernel is running on a hypervisor
From
Date
On Wed, 2024-04-17 at 11:23 -0700, Sean Christopherson wrote:
> On Wed, Apr 17, 2024, Dave Hansen wrote:
> > 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,
>
> Just in case we go this route (I hope we don't), this should probably be:
>
>         /* Only bare-metal is affected  PCIDs in guests are OK.  */
>         {
>           .vendor       = X86_VENDOR_ANY,
>           .feature      = X86_FEATURE_HYPERVISOR,
>           .driver_data  = 0,
>         },
>
> to make it clear that the goal is to match only the feature.  Matching Intel P6
> suffices because that's what the other entries in the array all check, but it
> makes subtle, confusing code even more subtle and confusing.

Agreed.

/* snip */

> > > >
> > 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.
>
> +1.  And it doesn't rely on the HYPERVISOR entry being the first entry, which
> is doubly evil.

So I'll go with the explicit checking in v9. I'll send it tomorrow.

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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