lkml.org 
[lkml]   [2023]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v11 018/113] KVM: TDX: create/destroy VM structure
Date
On Thu, 2023-01-19 at 15:29 +0000, Sean Christopherson wrote:
> On Thu, Jan 19, 2023, Huang, Kai wrote:
> > On Thu, 2023-01-12 at 08:31 -0800, isaku.yamahata@intel.com wrote:
> > > +static void tdx_clear_page(unsigned long page_pa)
> > > +{
> > > + const void *zero_page = (const void *) __va(page_to_phys(ZERO_PAGE(0)));
> > > + void *page = __va(page_pa);
> > > + unsigned long i;
> > > +
> > > + if (!static_cpu_has(X86_FEATURE_MOVDIR64B)) {
> > > + clear_page(page);
> > > + return;
> > > + }
> >
> > There might be below issues here:
> >
> > 1) The kernel says static_cpu_has() should only be used in fast patch where each
> > cycle is counted, otherwise use boot_cpu_has(). I don't know whether here you
> > should use static_cpu_has().
>
> That documentation is stale[*], go ahead and use cpu_feature_enabled().
>
> https://lore.kernel.org/all/20221107211505.8572-1-bp@alien8.de

Thanks for the info :)

>
> > 2) IIUC a CPU feature bit can be cleared by 'clearcpuid=xxx' kernel command
>
> As you note below, using clearcpuid taints the kernel, i.e. any breakage due to
> clearcpuid is user error.

Agreed.


\
 
 \ /
  Last update: 2023-03-26 23:48    [W:0.341 / U:4.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site