From: Bandan Das <bsd@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: VMX: use vmcs_set/clear_bits for CPU-based execution controls
Date: Thu, 16 Feb 2017 19:04:14 -0500 [thread overview]
Message-ID: <jpgshndhedd.fsf@linux.bootlegged.copy> (raw)
In-Reply-To: <1487169866-14989-1-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Wed, 15 Feb 2017 15:44:26 +0100")
Paolo Bonzini <pbonzini@redhat.com> writes:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
I took a quick look and found these two potential
consumers of these set/clear wrappers.
vmcs_set_secondary_exec_control()
vmx_set_virtual_x2apic_mode()
Since this has been reviewed already,
we can just have them later in a follow up
(unless you left them out intentionally).
Bandan
> 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);
next prev parent reply other threads:[~2017-02-17 0:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 14:44 [PATCH] KVM: VMX: use vmcs_set/clear_bits for CPU-based execution controls Paolo Bonzini
2017-02-16 16:24 ` Radim Krčmář
2017-02-16 19:22 ` David Hildenbrand
2017-02-17 0:04 ` Bandan Das [this message]
2017-02-17 8:41 ` Paolo Bonzini
2017-02-17 17:22 ` Bandan Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jpgshndhedd.fsf@linux.bootlegged.copy \
--to=bsd@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox