Re: [PATCH v2 1/4] KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES on nested vmexit

From: Paolo Bonzini
Date: Thu Jan 07 2021 - 13:01:00 EST


On 07/01/21 18:51, Paolo Bonzini wrote:
On 07/01/21 18:00, Sean Christopherson wrote:
Ugh, I assume this is due to one of the "premature" nested_ops->check_events()
calls that are necessitated by the event mess?  I'm guessing kvm_vcpu_running()
is the culprit?

If my assumption is correct, this bug affects nVMX as well.

Yes, though it may be latent.  For SVM it was until we started allocating svm->nested on demand.

Rather than clear the request blindly on any nested VM-Exit, what
about something like the following?

I think your patch is overkill, KVM_REQ_GET_NESTED_STATE_PAGES is only set from KVM_SET_NESTED_STATE so it cannot happen while the VM runs.

... and when leaving SMM. But in either case, there cannot be something else causing a nested vmexit before the request is set, because SMM does not support VMX operation. So I still don't think that it justifies the extra code and indirection.

Paolo