Re: [PATCH 1/3] KVM: nVMX: Always flush vpid02 on first use
From: Huang, Kai
Date: Wed Jun 17 2026 - 18:38:19 EST
On Wed, 2026-06-17 at 15:26 -0700, Sean Christopherson wrote:
> > > I think you mean the "actual flush" needs to be done on the first use. But
> > > setting last_vpid to 0 is a setting which is to make sure the actual flush will
> > > always be done on the first use, i.e., the actual flush will always be done on
> > > the first use. For this purpose seems to me there's no difference between
> > > setting last_vpid to 0 in enter_vmx_operation() and free_nested(), but maybe I
> > > am missing something.
>
> You're not missing anything. It's just that putting it in free_nested() subtly
> relies on zero-allocating vmx->nested, so that the *very* first use also flushes
> vpid02. Relying on zero-allocating is generally a-ok, but in this case it would
> require documenting the same base logic in multiple places.
Right. Agreed.