[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aRaEIETOLBXbpl5z@yzhao56-desk.sh.intel.com>
Date: Fri, 14 Nov 2025 09:21:36 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: Dave Hansen <dave.hansen@...el.com>
CC: "Huang, Kai" <kai.huang@...el.com>, "Du, Fan" <fan.du@...el.com>, "Li,
Xiaoyao" <xiaoyao.li@...el.com>, "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"david@...hat.com" <david@...hat.com>, "thomas.lendacky@....com"
<thomas.lendacky@....com>, "tabba@...gle.com" <tabba@...gle.com>,
"vbabka@...e.cz" <vbabka@...e.cz>, "kas@...nel.org" <kas@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"seanjc@...gle.com" <seanjc@...gle.com>, "pbonzini@...hat.com"
<pbonzini@...hat.com>, "binbin.wu@...ux.intel.com"
<binbin.wu@...ux.intel.com>, "ackerleytng@...gle.com"
<ackerleytng@...gle.com>, "michael.roth@....com" <michael.roth@....com>,
"Weiny, Ira" <ira.weiny@...el.com>, "Peng, Chao P" <chao.p.peng@...el.com>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>, "Annapurve, Vishal"
<vannapurve@...gle.com>, "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
"Miao, Jun" <jun.miao@...el.com>, "x86@...nel.org" <x86@...nel.org>,
"pgonda@...gle.com" <pgonda@...gle.com>
Subject: Re: [RFC PATCH v2 03/23] x86/tdx: Enhance
tdh_phymem_page_wbinvd_hkid() to invalidate huge pages
On Thu, Nov 13, 2025 at 07:26:43AM -0800, Dave Hansen wrote:
> On 11/12/25 23:37, Huang, Kai wrote:
> > Sure. But it seems you will need to wait all patches that you mentioned to
> > be merged to safely use 'page++' for pages in a folio?
> >
> > And if you do:
> >
> > for (i = 0; i < npages; i++)
> > {
> > struct page *p = folio_page(folio, start_idx + i);
> > struct tdx_module_args args = {};
> >
> > args.rcx = mk_keyed_paddr(hkid, p);
> > ...
> > }
> >
> > It should work w/o any dependency?
> >
> > Anyway, I don't have any strong opinion, as long as it works. You may
> > choose what you want. 🙂
>
> Folks, I'll make it easy: Do what Kai suggested above. It works
> universally and it's obvious. Saving an "i" variable only makes the code
> harder to read.
>
> If anyone thinks that:
>
> while (npages--)
>
> Is easier to understand than the most common C idiom on the planet:
>
> for (i = 0; i < npages; i++)
>
> ... then I don't know what to tell them.
Got it. That's very helpful. Thanks for the instruction!
Powered by blists - more mailing lists