[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <745d70bf-feec-46d5-b3f7-2bb86cd8bbb1@intel.com>
Date: Thu, 13 Nov 2025 07:26:43 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: "Huang, Kai" <kai.huang@...el.com>, "Zhao, Yan Y" <yan.y.zhao@...el.com>
Cc: "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 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.
Powered by blists - more mailing lists