Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Rick Edgecombe" <rick.p.edgecombe@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v11 09/11] x86/virt/tdx: Enable Dynamic PAMT
Date: Fri, 04 Sep 2026 22:11:32 +0000	[thread overview]
Message-ID: <20260904221132.D3EA51F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904215841.303070-10-rick.p.edgecombe@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Dynamically allocated PAMT pages (DPAMT) are not recognized by `is_pamt_page()`, causing Machine Check Exceptions (MCEs) on these pages to be misclassified as generic memory errors.
--

commit 4f5c2aeed6b267952a921a886ea2792c5ac1fb4a
Author: Rick Edgecombe <rick.p.edgecombe@intel.com>
Date:   Fri Sep 4 21:58:39 2026 +0000

x86/virt/tdx: Enable Dynamic PAMT

The Physical Address Metadata Table (PAMT) holds TDX metadata for
physical memory and must be allocated by the kernel during TDX module
initialization. This commit enables Dynamic PAMT (DPAMT) to reduce this
memory use by allocating part of the PAMT dynamically when the TDX module
reports support.

> diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> index 221e54492bf16..a77b72c4e06a7 100644
> --- a/arch/x86/virt/vmx/tdx/tdx.c
> +++ b/arch/x86/virt/vmx/tdx/tdx.c
[ ... ]
> @@ -1059,6 +1061,12 @@ static __init int config_tdx_module(struct tdmr_info_list *tdmr_list,
>  	args.rcx = __pa(tdmr_pa_array);
>  	args.rdx = tdmr_list->nr_consumed_tdmrs;
>  	args.r8 = global_keyid;
> +
> +	if (tdx_supports_dynamic_pamt(&tdx_sysinfo)) {
> +		pr_info("Enable Dynamic PAMT\n");
> +		args.r8 |= TDX_SYS_CONFIG_DYNAMIC_PAMT;
> +	}
> +

[Severity: Medium]
Will enabling Dynamic PAMT cause Machine Check Exceptions on DPAMT pages to
be misclassified?

Looking at is_pamt_page() in arch/x86/virt/vmx/tdx/tdx.c, it seems to only
iterate over statically configured TDMR PAMTs:

arch/x86/virt/vmx/tdx/tdx.c:is_pamt_page() {
    ...
    for (i = 0; i < tdmr_list->nr_consumed_tdmrs; i++) {
        unsigned long base, size;

        tdmr_get_pamt(tdmr_entry(tdmr_list, i), &base, &size);

        if (phys >= base && phys < (base + size))
            return true;
    }

    return false;
}

If a Machine Check Exception occurs on a dynamically allocated PAMT page,
is_pamt_page() will return false since it ignores dynamic PAMT pages.

Will this cause the hardware error to be treated as a generic memory error
instead of a TDX private memory error, thereby omitting the debug logs
for TDX memory corruption?

>  	ret = seamcall_prerr(TDH_SYS_CONFIG, &args);
>  
>  	/* Free the array as it is not required anymore. */

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260904215841.303070-1-rick.p.edgecombe@intel.com?part=9

  reply	other threads:[~2026-09-04 22:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 21:58 [PATCH v11 00/11] Dynamic PAMT Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 01/11] x86/virt/tdx: Simplify PAMT layout calculation Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 02/11] x86/virt/tdx: Allocate page bitmap for Dynamic PAMT Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 03/11] x86/virt/tdx: Add __tdx_pamt_get/put() helpers Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 04/11] x86/virt/tdx: Allocate refcounts for Dynamic PAMT memory Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 05/11] x86/virt/tdx: Handle multiple callers in tdx_pamt_get/put() Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 06/11] KVM: TDX: Allocate PAMT memory for TD and vCPU control structures Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 07/11] x86/virt/tdx: Add APIs to support Dynamic PAMT ops from KVM's fault path Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 08/11] KVM: TDX: Get/put PAMT pages when (un)mapping private memory Rick Edgecombe
2026-09-04 22:18   ` sashiko-bot
2026-09-04 21:58 ` [PATCH v11 09/11] x86/virt/tdx: Enable Dynamic PAMT Rick Edgecombe
2026-09-04 22:11   ` sashiko-bot [this message]
2026-09-04 21:58 ` [PATCH v11 10/11] Documentation/x86: Add documentation for TDX's " Rick Edgecombe
2026-09-04 21:58 ` [PATCH v11 11/11] x86/virt/tdx: Optimize tdx_pamt_get/put() Rick Edgecombe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260904221132.D3EA51F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox