Re: [PATCH] KVM: SVM: Use a separate vmcb for the nested L2 guest

From: Paolo Bonzini
Date: Tue Sep 22 2020 - 11:04:50 EST


On 17/09/20 21:23, Cathy Avery wrote:
>
> 2) There is a workaround in nested_svm_vmexit() where
>
> if (svm->vmcb01->control.asid == 0)
> svm->vmcb01->control.asid = svm->nested.vmcb02->control.asid;
>
> This was done as a result of the kvm selftest 'state_test'. In that
> test svm_set_nested_state() is called before svm_vcpu_run().
> The asid is assigned by svm_vcpu_run -> pre_svm_run for the current
> vmcb which is now vmcb02 as we are in nested mode subsequently
> vmcb01.control.asid is never set as it should be.

I think the asid should be kept in svm->asid, and copied to
svm->vmcb->control.asid in svm_vcpu_run. It's slightly overkill for
non-nested but it simplifies the nested case a lot so it's worth it.

That would be a first patch in the series, placed before this one.

Paolo