Re: [PATCH] KVM: x86: allow KVM_REQ_GET_NESTED_STATE_PAGES outside guest mode for VMX
From: Paolo Bonzini <pbonzini@redhat.com>
Date: 2021-01-25 19:51:48
Also in:
kvm, lkml
From: Paolo Bonzini <pbonzini@redhat.com>
Date: 2021-01-25 19:51:48
Also in:
kvm, lkml
On 25/01/21 20:16, Sean Christopherson wrote:
quoted
} +static bool vmx_get_nested_state_pages(struct kvm_vcpu *vcpu) +{ + if (!nested_get_evmcs_page(vcpu)) + return false; + + if (is_guest_mode(vcpu) && !nested_get_vmcs12_pages(vcpu)) + return false;nested_get_evmcs_page() will get called twice in the common case of is_guest_mode() == true. I can't tell if that will ever be fatal, but it's definitely weird. Maybe this? if (!is_guest_mode(vcpu)) return nested_get_evmcs_page(vcpu); return nested_get_vmcs12_pages(vcpu);
I wouldn't say there is a common case; however the idea was to remove the call to nested_get_evmcs_page from nested_get_vmcs12_pages, since that one is only needed after KVM_GET_NESTED_STATE and not during VMLAUNCH/VMRESUME. Paolo