[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <x2cuthbn54u2bqxr7sr2pt2zalvuhd3kpovrgzx42xp23wq6mw@pnvgcxs5zm45>
Date: Thu, 26 Jun 2025 12:25:55 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: Dave Hansen <dave.hansen@...el.com>
Cc: pbonzini@...hat.com, seanjc@...gle.com, dave.hansen@...ux.intel.com,
rick.p.edgecombe@...el.com, isaku.yamahata@...el.com, kai.huang@...el.com,
yan.y.zhao@...el.com, chao.gao@...el.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, kvm@...r.kernel.org, x86@...nel.org, linux-coco@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 02/12] x86/virt/tdx: Allocate page bitmap for Dynamic
PAMT
On Wed, Jun 25, 2025 at 11:06:16AM -0700, Dave Hansen wrote:
> > /*
> > * Locate a NUMA node which should hold the allocation of the @tdmr
> > * PAMT. This node will have some memory covered by the TDMR. The
> > @@ -522,7 +534,16 @@ static int tdmr_set_up_pamt(struct tdmr_info *tdmr,
> > * and the total PAMT size.
> > */
> > tdmr_pamt_size = 0;
> > - for (pgsz = TDX_PS_4K; pgsz < TDX_PS_NR; pgsz++) {
> > + pgsz = TDX_PS_4K;
> > +
> > + /* With Dynamic PAMT, PAMT_4K is replaced with a bitmap */
> > + if (tdx_supports_dynamic_pamt(&tdx_sysinfo)) {
> > + pamt_size[pgsz] = tdmr_get_pamt_bitmap_sz(tdmr);
> > + tdmr_pamt_size += pamt_size[pgsz];
> > + pgsz++;
> > + }
>
> 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.
Okay, makes sense.
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists