[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27b983f2-a6da-4b2c-a5d4-c84e2c80f193@intel.com>
Date: Wed, 18 Jun 2025 20:39:50 +0800
From: Xiaoyao Li <xiaoyao.li@...el.com>
To: Adrian Hunter <adrian.hunter@...el.com>, Tony Luck <tony.luck@...el.com>,
pbonzini@...hat.com, seanjc@...gle.com
Cc: vannapurve@...gle.com, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
H Peter Anvin <hpa@...or.com>, linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
rick.p.edgecombe@...el.com, kirill.shutemov@...ux.intel.com,
kai.huang@...el.com, reinette.chatre@...el.com,
tony.lindgren@...ux.intel.com, binbin.wu@...ux.intel.com,
isaku.yamahata@...el.com, yan.y.zhao@...el.com, chao.gao@...el.com
Subject: Re: [PATCH 2/2] KVM: TDX: Do not clear poisoned pages
On 6/18/2025 8:08 PM, Adrian Hunter wrote:
> Skip clearing a private page if it is marked as poisoned.
>
> The machine check architecture may have the capability to recover from
> memory corruption in SEAM non-root (i.e. TDX VM guest) mode. In that
> case the page is marked as poisoned, and the TDX Module puts the TDX VM
> into a FATAL error state where the only operation permitted is to tear it
> down.
>
> During tear down, reclaimed pages are cleared which, in some cases, helps
> to avoid integrity violation or TD bit mismatch detection when later being
> read using a shared HKID.
>
> However a poisoned page will never be allocated again, so clearing is not
> necessary, and in any case poisoned pages should not be touched.
>
> Note that while it is possible that memory corruption arises from integrity
> violation which could be cleared by MOVDIR64B, that is not necessarily the
> cause of the machine check.
>
> Suggested-by: Kai Huang <kai.huang@...el.com>
> Fixes: 8d032b683c299 ("KVM: TDX: create/destroy VM structure")
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> arch/x86/kvm/vmx/tdx.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 457f91b95147..f4263f7a3924 100644
> --- 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 */
This doesn't read correct. The page is not poisoned by the machine check
handler. Machine check handler just marks the page as poisoned.
With it fixed,
Reviewed-by: Xiaoyao Li <xiaoyao.li@...el.com>
> + if (PageHWPoison(page))
> + return;
> +
> for (i = 0; i < PAGE_SIZE; i += 64)
> movdir64b(dest + i, zero_page);
> /*
Powered by blists - more mailing lists