On Tue, Apr 30, 2024, Kai Huang wrote: > On 30/04/2024 8:06 am, Sean Christopherson wrote: > > My suggestion is essentially "throw in a CR4.VMXE check before > > TDH.SYS.LP.INIT if it's easy". If it's not easy for some reason, then don't do > > it. > > I see. The disconnection between us is I am not super clear why we should > treat TDH.SYS.LP.INIT as a special one that deserves a CR4.VMXE check but > not other SEAMCALLs. Because TDH.SYS.LP.INIT is done on all CPUs via an IPI function call, is a one- time thing, and is at the intersection of core TDX and KVM module code, e.g. the the core TDX code has an explicit assumption that: * This function assumes the caller has: 1) held read lock of CPU hotplug * lock to prevent any new cpu from becoming online; 2) done both VMXON * and tdx_cpu_enable() on all online cpus. KVM can obviously screw up and attempt SEAMCALLs without being post-VMXON, but that's entirely a _KVM_ bug. And the probability of getting all the way to something like TDH_MEM_SEPT_ADD without being post-VMXON is comically low, e.g. KVM and/or the kernel would likely crash long before that point.