On Mon, Jan 25, 2021, Paolo Bonzini wrote:
On 25/01/21 20:16, Sean Christopherson wrote:
} +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;
Eh, I would argue that it is more common to do KVM_REQ_GET_NESTED_STATE_PAGES with is_guest_mode() than it is with !is_guest_mode(), as the latter is valid if and only if eVMCS is in use. But, I think we're only vying for internet points. :-)
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.
I'm confused, this patch explicitly adds a call to nested_get_evmcs_page() in nested_get_vmcs12_pages().