Re: [PATCH v1 1/2] KVM: nVMX: single function for switching between vmcs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>> -	cpu = get_cpu();
>>> -	vmx->loaded_vmcs = vmcs02;
>>> -	vmx_vcpu_put(vcpu);
>>> -	vmx_vcpu_load(vcpu, cpu);
>>> -	vcpu->cpu = cpu;
>>> -	put_cpu();
>>> -
>>> +	vmx_switch_vmcs(vcpu, vmcs02);
>>>  	vmx_segment_cache_clear(vmx);
>>>  
>>>  	if (prepare_vmcs02(vcpu, vmcs12, from_vmentry, &exit_qual)) {
>>>  		leave_guest_mode(vcpu);
>>> -		vmx_load_vmcs01(vcpu);
>>> +		vmx_switch_vmcs(vcpu, &vmx->vmcs01);
>>>  		nested_vmx_entry_failure(vcpu, vmcs12,
>>>  					 EXIT_REASON_INVALID_STATE, exit_qual);
>>>  		return 1;
>>> @@ -10436,7 +10430,7 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry)
>>>  					    vmcs12->vm_entry_msr_load_count);
>>>  	if (msr_entry_idx) {
>>>  		leave_guest_mode(vcpu);
>>> -		vmx_load_vmcs01(vcpu);
>>> +		vmx_switch_vmcs(vcpu, &vmx->vmcs01);
>>>  		nested_vmx_entry_failure(vcpu, vmcs12,
>>>  				EXIT_REASON_MSR_LOAD_FAIL, msr_entry_idx);
>>>  		return 1;
>>> @@ -11004,7 +10998,7 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
>>>  	if (unlikely(vmx->fail))
>>>  		vm_inst_error = vmcs_read32(VM_INSTRUCTION_ERROR);
>>>  
>>> -	vmx_load_vmcs01(vcpu);
>>> +	vmx_switch_vmcs(vcpu, &vmx->vmcs01);
>>>  
>>>  	if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
>>>  	    && nested_exit_intr_ack_set(vcpu)) {
>>>
>>
>>
> 
> Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> 

Thanks, just noticed a minor thing is missing:

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index dc2d8f0..71b14d9 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -10399,7 +10399,6 @@ static int enter_vmx_non_root_mode(struct
kvm_vcpu *vcpu, bool from_vmentry)
        struct vcpu_vmx *vmx = to_vmx(vcpu);
        struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
        struct loaded_vmcs *vmcs02;
-       int cpu;
        u32 msr_entry_idx;
        u32 exit_qual;

So I will add it to this patch.

-- 

Thanks,

David



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux