[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aV32uDSqEDOgYp6L@yilunxu-OptiPlex-7050>
Date: Wed, 7 Jan 2026 14:01:28 +0800
From: Xu Yilun <yilun.xu@...ux.intel.com>
To: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
Cc: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>,
"Huang, Kai" <kai.huang@...el.com>,
"Li, Xiaoyao" <xiaoyao.li@...el.com>,
"Hansen, Dave" <dave.hansen@...el.com>,
"Zhao, Yan Y" <yan.y.zhao@...el.com>,
"Wu, Binbin" <binbin.wu@...el.com>,
"kas@...nel.org" <kas@...nel.org>,
"seanjc@...gle.com" <seanjc@...gle.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Annapurve, Vishal" <vannapurve@...gle.com>,
"Gao, Chao" <chao.gao@...el.com>, "bp@...en8.de" <bp@...en8.de>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v4 04/16] x86/virt/tdx: Allocate page bitmap for Dynamic
PAMT
On Tue, Jan 06, 2026 at 05:00:48PM +0000, Edgecombe, Rick P wrote:
> On Tue, 2026-01-06 at 12:01 +0800, Xu Yilun wrote:
> > Yes the extra indentation is unconventional, but everything here is,
> > and we know we will eventually change them all. So I more prefer
> > simple changes based on:
> >
> > if (!ret && !(ret = read_sys_metadata_field(0xABCDEF, &val)))
> >
> > rather than neat but more LOC (when both are easy to read).
>
> This whole code style was optimized to be verifiable, not for LOC. Kai
> originally had several macro based solution that had a bunch of code
> reuse before this style got settled on as part of the code gen. It
Yeah, I know the code style in this block is the result of several
rounds discussion, refined but not intend for human read. So I suggest
we only keep the existing steorotypes:
if (!ret && !(ret = read_sys_metadata_field(0xABCDEF, &val)))
sysinfo_xxx->xxxxx = val;
and
ret = ret ?: get_tdx_sys_info_xxx(&sysinfo->xxx);
isolate them, don't create other varients/hybrids of them such as:
if (!ret && !(ret = get_tdx_sys_info_dpamt_bits(sysinfo_tdmr, &val)))
when we need other logics, to avoid extensive review effort.
That's why I'm more fond of my version, it embraces the steorotype with
a nature "if" for extra logic:
if (tdx_support_dynamic_pamt(&tdx_sysinfo))
if (!ret && !(ret = read_sys_metadata_field(0x9100000100000013, &val)))
sysinfo_tdmr->pamt_page_bitmap_entry_bits = val;
But anyway, if anyone is really uncomfortable with the indentation,
ignore my version.
[...]
> > Anyway, this is trivial concern. I have more optional fields to add
> > and will follow the final decision.
>
> This is the kind of thing that shouldn't need a clever solution. There
> *should* be a way to more simply copy structured data from the TDX
> module.
>
> I do think this is a good area for cleanup, but let's not overhaul it
> just to get a small incremental benefit. If we need a new interface in
Agree. I definitely don't want a new TDX module interface for now.
> the TDX module, let's explore it and actually get to something simple.
Powered by blists - more mailing lists