Re: [PATCH 02/15] x86/virt/tdx: Add extra memory to TDX Module for Extensions
From: Xiaoyao Li
Date: Wed May 27 2026 - 02:43:00 EST
On 5/27/2026 11:47 AM, Xu Yilun wrote:
+static void tdx_clflush_hpa_list(struct page *root, unsigned int nr_pages)
+{
+ u64 *entries = page_to_virt(root);
+ int i;
+
+ for (i = 0; i < nr_pages; i++)
+ clflush_cache_range(__va(entries[i]), PAGE_SIZE);
Is the page flush only needed when CLFLUSH_BEFORE_ALLOC is true?
If so, it inherits the same decision to always flush as what
Yes it is basically the same as tdx_clflush_page().
tdx_clflush_page() did. Then, any chance we can use tdx_clflush_page() here
But I don't think we should convert hpa/page/va back and forth just for
re-using one line of code.
Because we want/need to flush page as late as possible so that the page flush needs to happen right before SEAMCALL?
How about we pass in the struct page * and number into tdx_ext_mem_add() and construct the root page inside it?
so that we have a single central place of the comment to explain the kernel
design decision.
How about I add a comment here to connect this wrapper to
tdx_clflush_page():
/*
* Unconditionally flush the pages regardless of CLFLUSH_BEFORE_ALLOC. Inherit
* the same decision as tdx_clflush_page().
*/
static void tdx_clflush_hpa_list(struct page *root, unsigned int nr_pages)
...
It works either. I don't have strong preference. Let's see if anyone else say something about it.