lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170216162453.GA12224@potion>
Date:   Thu, 16 Feb 2017 17:24:54 +0100
From:   Radim Krčmář <rkrcmar@...hat.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [PATCH] KVM: VMX: use vmcs_set/clear_bits for CPU-based
 execution controls

2017-02-15 15:44+0100, Paolo Bonzini:
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>

Reviewed-by: Radim Krčmář <rkrcmar@...hat.com>

> ---
>  arch/x86/kvm/vmx.c | 30 ++++++++----------------------
>  1 file changed, 8 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index bca60665d55d..0e0b5d09597e 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5459,26 +5459,20 @@ static bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
>  
>  static void enable_irq_window(struct kvm_vcpu *vcpu)
>  {
> -	u32 cpu_based_vm_exec_control;
> -
> -	cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
> -	cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING;
> -	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
> +	vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL,
> +		      CPU_BASED_VIRTUAL_INTR_PENDING);
>  }
>  
>  static void enable_nmi_window(struct kvm_vcpu *vcpu)
>  {
> -	u32 cpu_based_vm_exec_control;
> -
>  	if (!cpu_has_virtual_nmis() ||
>  	    vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) {
>  		enable_irq_window(vcpu);
>  		return;
>  	}
>  
> -	cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
> -	cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_NMI_PENDING;
> -	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
> +	vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL,
> +		      CPU_BASED_VIRTUAL_NMI_PENDING);
>  }
>  
>  static void vmx_inject_irq(struct kvm_vcpu *vcpu)
> @@ -6137,12 +6131,8 @@ static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu)
>  
>  static int handle_interrupt_window(struct kvm_vcpu *vcpu)
>  {
> -	u32 cpu_based_vm_exec_control;
> -
> -	/* clear pending irq */
> -	cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
> -	cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING;
> -	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
> +	vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL,
> +			CPU_BASED_VIRTUAL_INTR_PENDING);
>  
>  	kvm_make_request(KVM_REQ_EVENT, vcpu);
>  
> @@ -6408,12 +6398,8 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
>  
>  static int handle_nmi_window(struct kvm_vcpu *vcpu)
>  {
> -	u32 cpu_based_vm_exec_control;
> -
> -	/* clear pending NMI */
> -	cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
> -	cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING;
> -	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
> +	vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL,
> +			CPU_BASED_VIRTUAL_NMI_PENDING);
>  	++vcpu->stat.nmi_window_exits;
>  	kvm_make_request(KVM_REQ_EVENT, vcpu);
>  
> -- 
> 1.8.3.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ