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>,
	"yilun.xu@linux.intel.com" <yilun.xu@linux.intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH v3 6/6] x86/virt/tdx: Support DPAMT when adding memory for the extensions
Date: Thu, 8 Oct 2026 18:19:31 +0000	[thread overview]
Message-ID: <8f3e9d41b473d597ff538c5a70c49f02fbaaf317.camel@intel.com> (raw)
In-Reply-To: <ascck27BOXu2QZPR@yilunxu-OptiPlex-7050>

On Thu, 2026-10-08 at 12:31 +0800, Xu Yilun wrote:
> > Since 511 out of 512 pages in each 2MB block will find the entry already
> > present, the newly allocated pages are immediately freed. For tens of
> > megabytes of extensions, this results in thousands of unnecessary
> > allocations
> > and frees. Furthermore, free_pamt_array() performs expensive memory resets,
> > leading to unnecessary boot delays.
> > 
> > Could a struct tdx_pamt_cache be allocated locally in tdx_ext_mem_setup()
> > and
> > passed into tdx_pamt_get() to avoid this thrashing?
> 
> tdx_pamt_cache is for cases where memory allocation is not possible when
> adding DPAMT. I don't think it's good to use tdx_pamt_cache in normal
> cases.

Since we are worrying about fragmented long term allocation of the actual pages
of this memory, it does seem valid to worry about the PAMT memory for the same
reason. But given the problem is 1/512 of the other one. Let's ignore it for
now.

For the excess alloc/free, yea, lets leave it for future optimization. We are
already doing some optimization ahead of time with the full page array
implementation.

  reply	other threads:[~2026-10-08 18:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 17:41 [PATCH v3 0/6] Enable TDX module extensions Xu Yilun
2026-10-05 17:41 ` [PATCH v3 1/6] x86/virt/tdx: Move TDH.SYS.CONFIG operations into a wrapper Xu Yilun
2026-10-06 23:27   ` Edgecombe, Rick P
2026-10-05 17:41 ` [PATCH v3 2/6] x86/virt/tdx: Configure add-on features on TDX module init Xu Yilun
2026-10-06 23:56   ` Edgecombe, Rick P
2026-10-08  4:18     ` Xu Yilun
2026-10-08 16:06       ` Edgecombe, Rick P
2026-10-05 17:41 ` [PATCH v3 3/6] x86/virt/tdx: Add extra memory to TDX module for the extensions Xu Yilun
2026-10-05 17:56   ` sashiko-bot
2026-10-05 17:41 ` [PATCH v3 4/6] x86/virt/tdx: Make TDX module initialize " Xu Yilun
2026-10-05 18:00   ` sashiko-bot
2026-10-08  4:25     ` Xu Yilun
2026-10-05 17:41 ` [PATCH v3 5/6] x86/virt/tdx: Re-initialize the extensions on runtime TDX module update Xu Yilun
2026-10-05 17:58   ` sashiko-bot
2026-10-08  4:47     ` Xu Yilun
2026-10-06  4:32   ` Tony Lindgren
2026-10-05 17:41 ` [PATCH v3 6/6] x86/virt/tdx: Support DPAMT when adding memory for the extensions Xu Yilun
2026-10-05 17:57   ` sashiko-bot
2026-10-08  4:31     ` Xu Yilun
2026-10-08 18:19       ` Edgecombe, Rick P [this message]
2026-10-06  4:36   ` Tony Lindgren
2026-10-08  4:39     ` Xu Yilun
2026-10-08  5:37       ` Tony Lindgren

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=8f3e9d41b473d597ff538c5a70c49f02fbaaf317.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yilun.xu@linux.intel.com \
    /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