All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chao Gao" <chao.gao@intel.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v4 1/2] x86/virt/seamldr: Support large TDX module binaries
Date: Fri, 04 Dec 2026 11:11:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-249660@kernel.org> (raw)
In-Reply-To: <20261204105951.1811487-2-chao.gao@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] x86/virt/seamldr: costly order-4 kzalloc_obj() in
  seamldr_install_module()
--

commit 3d3e8627ca619b4725aef21c808f3c7dcc4e909c
Author: Chao Gao <chao.gao@intel.com>

x86/virt/seamldr: Support large TDX module binaries

This commit extends struct seamldr_params to 16 pages using P-SEAMLDR's
chained page-list layout so the kernel can load TDX modules larger than
2MB.

> diff --git a/arch/x86/virt/vmx/tdx/seamldr.c b/arch/x86/virt/vmx/tdx/seamldr.c
> index b1137ca6150d4..5678309624ab9 100644
> --- a/arch/x86/virt/vmx/tdx/seamldr.c
> +++ b/arch/x86/virt/vmx/tdx/seamldr.c
> @@ -24,7 +24,23 @@
>  #define P_SEAMLDR_INFO			0x8000000000000000
>  #define P_SEAMLDR_INSTALL		0x8000000000000001
>  
> -#define SEAMLDR_MAX_NR_MODULE_PAGES	496
> +/*
> + * The number of pages in 'struct seamldr_params'. The value is arbitrary
> + * and can be increased to fit larger modules.
> + */
> +#define SEAMLDR_PARAMS_NR_PAGES		16

[Severity: Medium]
Can setting SEAMLDR_PARAMS_NR_PAGES to 16 cause kzalloc_obj(*params) in
seamldr_install_module() to fail under memory fragmentation?

Growing struct seamldr_params from 4KB to 64KB turns every runtime module
update into an order-4 GFP_KERNEL allocation, above PAGE_ALLOC_COSTLY_ORDER
(order 3).  On a long-running TDX host fragmented by unmovable guest TD
private memory, this triggers direct compaction and fails with -ENOMEM.

tdx_fw_write() maps -ENOMEM to FW_UPLOAD_ERR_FW_INVALID, blocking live TDX
module updates even for small modules that previously needed one page.
Since P-SEAMLDR chains 4KB pages by physical address, using kvzalloc_obj()
with slow_virt_to_phys() instead of __pa() would avoid order-4 allocations.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204105951.1811487-1-chao.gao@intel.com?part=1

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 10:59 [PATCH v4 0/2] TDX: P-SEAMLDR: Support large TDX modules and sigstructs Chao Gao
2026-12-04 10:59 ` [PATCH v4 1/2] x86/virt/seamldr: Support large TDX module binaries Chao Gao
2026-12-04 11:11   ` sashiko-bot [this message]
2026-12-05  0:27   ` Edgecombe, Rick P
2026-12-04 10:59 ` [PATCH v4 2/2] x86/virt/seamldr: Support multiple sigstruct pages Chao Gao
2026-12-05  0:38   ` Edgecombe, Rick P

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=sashiko-outbox-249660@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chao.gao@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.