lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c1b4aeaf404d3f034bd27eb514972c9867ac490.camel@intel.com>
Date: Thu, 31 Jul 2025 04:10:22 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
	"pbonzini@...hat.com" <pbonzini@...hat.com>, "Hansen, Dave"
	<dave.hansen@...el.com>, "seanjc@...gle.com" <seanjc@...gle.com>, "Edgecombe,
 Rick P" <rick.p.edgecombe@...el.com>, "dave.hansen@...ux.intel.com"
	<dave.hansen@...ux.intel.com>
CC: "Gao, Chao" <chao.gao@...el.com>, "x86@...nel.org" <x86@...nel.org>,
	"bp@...en8.de" <bp@...en8.de>, "mingo@...hat.com" <mingo@...hat.com>, "Zhao,
 Yan Y" <yan.y.zhao@...el.com>, "tglx@...utronix.de" <tglx@...utronix.de>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "linux-coco@...ts.linux.dev"
	<linux-coco@...ts.linux.dev>, "Yamahata, Isaku" <isaku.yamahata@...el.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv2 02/12] x86/virt/tdx: Allocate page bitmap for Dynamic
 PAMT

On Thu, 2025-07-31 at 01:06 +0000, Edgecombe, Rick P wrote:
> On Wed, 2025-06-25 at 11:06 -0700, Dave Hansen wrote:
> > This is the wrong place to do this.
> > 
> > Hide it in tdmr_get_pamt_sz(). Don't inject it in the main code flow
> > here and complicate the for loop.
> 
> I'm finding this tdmr_get_pamt_sz() maybe too strange to build on top of. 
> It iterates through these special TDX page sizes once, and calls into 
> tdmr_get_pamt_sz() for each, which in turn has a case statement for each 
> index. So the loop doesn't add much - each index still has its own line 
> of code inside tdmr_get_pamt_sz(). And then despite prepping the base/size 
> in an array via the loop, it has to be packed manually at the end for each 
> index. So I'm not sure if the general wisdom of doing things in a single way 
> is really adding much here.
> 
> I'm wondering if something like the below might be a better base to build 
> on. For dpamt the "tdmr->pamt_4k_size =" line could just branch on 
> tdx_supports_dynamic_pamt(). Any thoughts on it as an alternative to the 
> suggestion to add the dpamt logic to tdmr_get_pamt_sz()?

The code change LGTM, albeit I am not sure whether it is definitely
better.

For where to add dynamic PAMT logic, I think it's reasonable to put such
logic into tdmr_get_pamt_sz() because it changes the amount of memory that
we need to allocate for 4K page size.  If we do dynamic PAMT logic at
higher level, the code logic in tdmr_get_pamt_sz() to calculate PAMT size
for 4K page will not be accurate, i.e., it is only correct w/o dynamic
PAMT.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ