mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Tony Lindgren <tony.lindgren@linux.intel.com>
Cc: <x86@kernel.org>, <linux-coco@lists.linux.dev>,
	<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<yilun.xu@linux.intel.com>, Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [RFC PATCH v2 00/10] TDX: Stop auto-generating the global metadata code
Date: Wed, 23 Sep 2026 16:19:12 +0800	[thread overview]
Message-ID: <arOLgHrOf8tlTwfv@intel.com> (raw)
In-Reply-To: <arNnJO3aKDlCD2Uz@tlindgre-MOBL1>

On Wed, Sep 23, 2026 at 08:44:04AM +0300, Tony Lindgren wrote:
>On Fri, Sep 18, 2026 at 06:29:19AM -0700, Chao Gao wrote:
>> This series cleans up the TDX global metadata code. It has two goals:
>> 
>> 1. Replace the generated code with a table-driven metadata reader.
>> 
>> 2. Make the existing code easier to read and maintain, and simplify
>>    adding new metadata fields.
>> 
>> During the v1 review, Dave raised concerns about signing off on
>> AI-generated code. I have since rewritten the affected patches based on
>> my own understanding of the code.
>> 
>> The main goal of this RFC is to agree on whether the table-driven reader is
>> the right replacement for the generated code. Please raise any concerns or
>> alternative design ideas.
>
>For alternatives, I wonder if grouping the metadata would help in the long
>run. Some of TDX metadata needs to be cached. Some of the metadata is init
>time data for how much memory to allocate etc. Some of the metadata needs
>to be re-read after TDX module update.

I agree that TDX metadata should be cached only when there is a reason to.

And yes, some init-time data is cached even though nothing reads it after
init: max_tdmrs, max_reserved_per_tdmr and the pamt_*_entry_size fields are
only needed while building the TDMRs.

Only the version fields are re-read after a module update. Splitting them
out of struct tdx_sys_info would be a good improvement, so the rest of the
structure could then be __ro_after_init.

These are cleanups that can be done in a separate series.

>
>Should we have the table-driven metadata reader use the TDX module
>metadata directly by default instead of always copying the data? That
>could be used for the init time data. And data could still be cached for
>CPUIDs etc.

The table-driven reader doesn't impose caching. It maps field IDs to
members of whatever structure the caller passes, so the destination can be
a cached global or a stack local. For init-time data, we can read it into a
stack local the same way the handoff class is read in tdx_module_shutdown().

  reply	other threads:[~2026-09-23  8:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 13:29 Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 01/10] x86/virt/tdx: Add a helper to read a table of metadata fields Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 02/10] x86/virt/tdx: Convert the version metadata reader Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 03/10] x86/virt/tdx: Convert the features " Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 04/10] x86/virt/tdx: Convert the tdmr " Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 05/10] x86/virt/tdx: Convert the td_ctrl " Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 06/10] x86/virt/tdx: Convert the handoff " Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 07/10] x86/virt/tdx: Convert the td_conf " Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 08/10] x86/virt/tdx: Remove tdx_global_metadata.c Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 09/10] x86/virt/tdx: Use early returns in get_tdx_sys_info() Chao Gao
2026-09-18 13:29 ` [RFC PATCH v2 10/10] x86/virt/tdx: Verify structure member sizes against metadata field IDs Chao Gao
2026-09-23  0:47 ` [RFC PATCH v2 00/10] TDX: Stop auto-generating the global metadata code Edgecombe, Rick P
2026-09-23  8:23   ` Chao Gao
2026-09-23  5:44 ` Tony Lindgren
2026-09-23  8:19   ` Chao Gao [this message]
2026-09-23  8: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=arOLgHrOf8tlTwfv@intel.com \
    --to=chao.gao@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=tglx@kernel.org \
    --cc=tony.lindgren@linux.intel.com \
    --cc=x86@kernel.org \
    --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

all inboxes | Powered by JetHome®