Re: [PATCH v2 2/5] x86/virt/tdx: Pull kexec cache flush logic into arch/x86
From: Dave Hansen
Date: Wed Apr 01 2026 - 11:08:13 EST
On 3/31/26 16:04, Sean Christopherson wrote:
> But unless the WBINVD is actually costly, why bother getting fancy?
WBINVD might be the most expensive single instruction in the whole ISA.
That said, I'd much rather have a potentially unnecessary WBINVD than
miss one. The thing I'd be worried about would be something wonky like:
1. CPU offline does WBINVD
2. Some other TDX call gets made, dirties caches again
3. tdx_offline_cpu() skips WBINVD
So, let's just do both for now: Do WBINVD in tdx_offline_cpu() and
comment that it might be redundant with other things in the CPU offline
procedure.
This really needs to be solved with infrastructure and keeping data
about the reasons for needing WBINVD, not relying on code ordering or
fragile semantics.