Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "sashiko-reviews@lists.linux.dev" <sashiko-reviews@lists.linux.dev>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH v8 02/11] x86/virt/tdx: Allocate page bitmap for Dynamic PAMT
Date: Wed, 29 Jul 2026 22:14:31 +0000	[thread overview]
Message-ID: <c1db916496c52b76eade934df73e65288067cea8.camel@intel.com> (raw)
In-Reply-To: <20260725003343.65E951F000E9@smtp.kernel.org>

On Sat, 2026-07-25 at 00:33 +0000, sashiko-bot@kernel.org wrote:
> [Severity: Medium]
> Does assigning val to pamt_page_bitmap_entry_bits result in an unsafe
> truncation?
> 
> Since pamt_page_bitmap_entry_bits is declared as a u8 in
> struct tdx_sys_info_tdmr, and the metadata field ID 0x9100000100000013
> specifies a 16-bit value according to the TDX ABI (bits 33:32 are '01'),
> a value from the hardware might be silently truncated.
> 
> If a future TDX module increases the required bitmap entry size to 256 bits
> or more, wouldn't this truncation cause severe memory under-allocation for
> the physically contiguous PAMT memory?

Impressed that Sashiko is so knowledgeable about TDX.

The spec lists pamt_page_bitmap_entry_bits as byte sized so there will be no
truncation. But 33:32 could be 00 and still work. The docs say:
   All metadata read and write interface functions (e.g.,
   TDH.MNG.RD, TDH.MNG.WR, TDH.VP.RD, TDG.SYS.RDALL etc.)
   ignore this field when used as an input; they use an implicit value.

Hmm... Both will work, but 00 for 33:32 would arguably be more correct even if
it is ignored. Hate to spin another version for this tiny non-functional thing.
Hmm...

  reply	other threads:[~2026-07-29 22:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25  0:22 [PATCH v8 00/11] Dynamic PAMT Rick Edgecombe
2026-07-25  0:22 ` [PATCH v8 01/11] x86/virt/tdx: Simplify PAMT layout calculation Rick Edgecombe
2026-07-25  0:22 ` [PATCH v8 02/11] x86/virt/tdx: Allocate page bitmap for Dynamic PAMT Rick Edgecombe
2026-07-25  0:33   ` sashiko-bot
2026-07-29 22:14     ` Edgecombe, Rick P [this message]
2026-07-25  0:22 ` [PATCH v8 03/11] x86/virt/tdx: Add tdx_alloc/free_control_page() helpers Rick Edgecombe
2026-07-25  0:35   ` sashiko-bot
2026-07-29 22:10     ` Edgecombe, Rick P
2026-07-25  0:22 ` [PATCH v8 04/11] x86/virt/tdx: Allocate refcounts for Dynamic PAMT memory Rick Edgecombe
2026-07-25  0:22 ` [PATCH v8 05/11] x86/virt/tdx: Handle multiple callers in tdx_pamt_get/put() Rick Edgecombe
2026-07-25  0:22 ` [PATCH v8 06/11] KVM: TDX: Allocate PAMT memory for TD and vCPU control structures Rick Edgecombe
2026-07-25  0:35   ` sashiko-bot
2026-07-29 22:05     ` Edgecombe, Rick P
2026-07-25  0:22 ` [PATCH v8 07/11] x86/tdx: Add APIs to support Dynamic PAMT ops from KVM's fault path Rick Edgecombe
2026-07-25  0:22 ` [PATCH v8 08/11] KVM: TDX: Get/put PAMT pages when (un)mapping private memory Rick Edgecombe
2026-07-25  0:46   ` sashiko-bot
2026-07-29 22:06     ` Edgecombe, Rick P
2026-07-25  0:22 ` [PATCH v8 09/11] x86/virt/tdx: Enable Dynamic PAMT Rick Edgecombe
2026-07-25  0:23 ` [PATCH v8 10/11] Documentation/x86: Add documentation for TDX's " Rick Edgecombe
2026-07-25  0:23 ` [PATCH v8 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=c1db916496c52b76eade934df73e65288067cea8.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=kvm@vger.kernel.org \
    --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