On Thu, Sep 12, 2024 at 01:28:18AM +0800, Edgecombe, Rick P wrote: > On Wed, 2024-09-11 at 14:25 +0800, Xu Yilun wrote: > > > +static void vt_flush_tlb_all(struct kvm_vcpu *vcpu) > > > +{ > > > + /* > > > + * TDX calls tdx_track() in tdx_sept_remove_private_spte() to ensure > > > + * private EPT will be flushed on the next TD enter. > > > + * No need to call tdx_track() here again even when this callback is > > > as > > > + * a result of zapping private EPT. > > > + * Just invoke invept() directly here to work for both shared EPT > > > and > > > + * private EPT. > > > > IIUC, private EPT is already flushed in .remove_private_spte(), so in > > theory we don't have to invept() for private EPT? > > I think you are talking about the comment, and not an optimization. So changing: > "Just invoke invept() directly here to work for both shared EPT and private EPT" > to just "Just invoke invept() directly here to work for shared EPT". > > Seems good to me. Hmm, what about just adding "Due to the lack of context within this callback function, it cannot determine which EPT has been affected by zapping."? as blow: "TDX calls tdx_track() in tdx_sept_remove_private_spte() to ensure private EPT will be flushed on the next TD enter. No need to call tdx_track() here again even when this callback is as a result of zapping private EPT. Due to the lack of context within this callback function, it cannot determine which EPT has been affected by zapping. Just invoke invept() directly here to work for both shared EPT and private EPT for simplicity."