Re: [PATCH 2/2] KVM: TDX: Do not clear poisoned pages
From: Dave Hansen
Date: Wed Jun 18 2025 - 11:02:50 EST
On 6/18/25 05:08, Adrian Hunter wrote:
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -282,10 +282,10 @@ static void tdx_clear_page(struct page *page)
> 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.
> - */
> + /* Machine check handler may have poisoned the page */
> + if (PageHWPoison(page))
> + return;
I think the old comment needs to stay in some form.
There are two kinds of poisons here: One from an integrity mismatch and
the other because the hardware decided the memory is bad. MOVDIR64B
clears the integrity one, but not the hardware one obviously.
Could we make that clear in the comment, please?