On 11/12/24 13:21, Edgecombe, Rick P wrote: > On Tue, 2024-11-12 at 12:17 -0800, Dave Hansen wrote: >> On 10/30/24 12:00, Rick Edgecombe wrote: >>> +u64 tdh_mng_create(u64 tdr, u64 hkid) >>> +{ >>> + struct tdx_module_args args = { >>> + .rcx = tdr, >>> + .rdx = hkid, >>> + }; >>> + clflush_cache_range(__va(tdr), PAGE_SIZE); >>> + return seamcall(TDH_MNG_CREATE, &args); >>> +} >>> +EXPORT_SYMBOL_GPL(tdh_mng_create); >> I'd _prefer_ that this explain why the clflush is there. > How about: > /* > * The TDX module exposes a CLFLUSH_BEFORE_ALLOC bit to specify whether > * a CLFLUSH of pages is required before handing them to the TDX module. > * Be conservative and make the code simpler by doing the CLFLUSH > * unconditionally. > */ Is there a chance we could put this in a helper so the "be conservative" policy is centralized in one location? The comment could also go there.