Re: [RFC PATCH v2 03/23] x86/tdx: Enhance tdh_phymem_page_wbinvd_hkid() to invalidate huge pages
From: Yan Zhao
Date: Thu Nov 13 2025 - 04:05:10 EST
On Thu, Nov 13, 2025 at 03:37:29PM +0800, Huang, Kai wrote:
>
> Thanks for all the explanation.
>
> [...]
>
>
> > In [6], the new folio_page() implementation is
> >
> > static inline struct page *folio_page(struct folio *folio, unsigned long n)
> > {
> > return &folio->page + n;
> > }
> >
> > So, invoking folio_page() should be equal to page++ in our case.
> >
> > [6] https://lore.kernel.org/kvm/20250901150359.867252-13-david@xxxxxxxxxx
>
> 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?
Correct.
> 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. :-)
I don't have a strong opinion either. However, based on previous reviews, it
seems people prefer while (npages--) over introducing an additional variable.
I guess I'll choose a version depending on whether these patches are merged when
I post the next version. :)