Re: [PATCH 1/2] x86/virt/tdx: Drop tdx_clflush_*()
From: Nikolay Borisov
Date: Wed Sep 23 2026 - 08:05:53 EST
On 22.09.26 г. 23:52 ч., Rick Edgecombe wrote:
The TDX module exposes a bit (CLFLUSH_BEFORE_ALLOC) to say whether it
requires some memory to be flushed from the cache before being handed
to the TDX module.
During the initial TDX upstreaming, it was decided it would be simplest
to just always flush in these cases, rather than checking for the bit and
having conditional logic. So currently the kernel flushes in several
places when handing memory to the TDX module.
In practice this bit has never been set by any TDX module, so flushing
is unneeded. Going forward the TDX docs will be updated to clarify that
CLFLUSH_BEFORE_ALLOC will never be set in any future TDX module either.
So make code even simpler by just deleting all the CLFLUSH_BEFORE_ALLOC
handling.
AI was used to review the change.
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
The code change itself is trivial, however nothing in the code being removed is tied to CLFLUSH_BEFORE_ALLOC directly. And from the changelog it's not entirely clear which those operations are (as per other reviewers feedback). Looking at the TDX module spec that flag is mentioned in relation to the following 3 operations:
TDH.MEM.SEPT.ADD
TDH.MEM.PAGE.ADD
TDH.MEM.PAGE.AUG
Whereas the patch also removes flushing from MNG_CREATE/VP_ADDCX/MNG_ADDCX
So concrete references in the changelog would be much appreciated i.e whether flushing for those 3 additional functions was because people were overzealous, or they simply have been omitted from the public documentation.