On Fri, 2025-05-16 at 17:05 +0800, Yan Zhao wrote: > > So we have loops within loops... Better to add an arg to tdx_clflush_page() > > or > > add a variant that takes one. > Ok. > > One thing to note is that even with an extra arg, tdx_clflush_page() has to > call > clflush_cache_range() page by page because with > "#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)", > page virtual addresses are not necessarily contiguous. > > What about Binbin's proposal [1]? i.e., > > while (nr_pages) > tdx_clflush_page(nth_page(page, --nr_pages)); > > [1] > https://lore.kernel.org/all/a7d0988d-037c-454f-bc6b-57e71b357488@xxxxxxxxxxxxxxx/ These SEAMCALLs are handling physically contiguous pages so I don't think we need to worry about that. But Binbin's suggestion seems fine too.