Re: [PATCH v11 018/113] KVM: TDX: create/destroy VM structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx 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@xxxxxxxxx

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.






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux