Re: [PATCH 23/33] KVM: TDX: create/destroy VM structure

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

 



On 2/26/25 10:14, Paolo Bonzini wrote:
> +static void tdx_clear_page(struct page *page)
> +{
> +	const void *zero_page = (const void *) page_to_virt(ZERO_PAGE(0));
> +	void *dest = page_to_virt(page);
> +	unsigned long i;
> +
> +	/*
> +	 * The page could have been poisoned.  MOVDIR64B also clears
> +	 * the poison bit so the kernel can safely use the page again.
> +	 */
> +	for (i = 0; i < PAGE_SIZE; i += 64)
> +		movdir64b(dest + i, zero_page);
> +	/*
> +	 * MOVDIR64B store uses WC buffer.  Prevent following memory reads
> +	 * from seeing potentially poisoned cache.
> +	 */
> +	__mb();
> +}

Hey guys,

This ended up in KVM code when we already have the *VERY* similar
reset_tdx_pages().

Could we consolidate them, please? There's no reason to sprinkle
knowledge of movdir64b's memory ordering rules all across the tree.

Adrian, this is probably something to go do, first, before you try and
poke at this code that probably shouldn't be in KVM in the first place.




[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