Re: [PATCH] KVM: nVMX: WARN on failure to set IA32_PERF_GLOBAL_CTRL

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

 



On 14/12/19 01:33, Oliver Upton wrote:
> Writes to MSR_CORE_PERF_GLOBAL_CONTROL should never fail if the VM-exit
> and VM-entry controls are exposed to L1. Promote the checks to perform a
> full WARN if kvm_set_msr() fails and remove the now unused macro
> SET_MSR_OR_WARN().
> 
> Suggested-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Signed-off-by: Oliver Upton <oupton@xxxxxxxxxx>
> ---
>  arch/x86/kvm/vmx/nested.c | 18 ++++--------------
>  1 file changed, 4 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 4aea7d304beb..fb502c62ee94 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -28,16 +28,6 @@ module_param(nested_early_check, bool, S_IRUGO);
>  	failed;								\
>  })
>  
> -#define SET_MSR_OR_WARN(vcpu, idx, data)				\
> -({									\
> -	bool failed = kvm_set_msr(vcpu, idx, data);			\
> -	if (failed)							\
> -		pr_warn_ratelimited(					\
> -				"%s cannot write MSR (0x%x, 0x%llx)\n",	\
> -				__func__, idx, data);			\
> -	failed;								\
> -})
> -
>  /*
>   * Hyper-V requires all of these, so mark them as supported even though
>   * they are just treated the same as all-context.
> @@ -2550,8 +2540,8 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
>  		vcpu->arch.walk_mmu->inject_page_fault = vmx_inject_page_fault_nested;
>  
>  	if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) &&
> -	    SET_MSR_OR_WARN(vcpu, MSR_CORE_PERF_GLOBAL_CTRL,
> -			    vmcs12->guest_ia32_perf_global_ctrl))
> +	    WARN_ON_ONCE(kvm_set_msr(vcpu, MSR_CORE_PERF_GLOBAL_CTRL,
> +				     vmcs12->guest_ia32_perf_global_ctrl)))
>  		return -EINVAL;
>  
>  	kvm_rsp_write(vcpu, vmcs12->guest_rsp);
> @@ -3999,8 +3989,8 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
>  		vcpu->arch.pat = vmcs12->host_ia32_pat;
>  	}
>  	if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL)
> -		SET_MSR_OR_WARN(vcpu, MSR_CORE_PERF_GLOBAL_CTRL,
> -				vmcs12->host_ia32_perf_global_ctrl);
> +		WARN_ON_ONCE(kvm_set_msr(vcpu, MSR_CORE_PERF_GLOBAL_CTRL,
> +					 vmcs12->host_ia32_perf_global_ctrl));
>  
>  	/* Set L1 segment info according to Intel SDM
>  	    27.5.2 Loading Host Segment and Descriptor-Table Registers */
> 

Queued, thanks.

Paolo




[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