All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH v2 1/3] KVM: Simplify KVM_REQ_EVENT/req_int_win handling
Date: Sun, 20 May 2012 16:49:26 +0300	[thread overview]
Message-ID: <1337521768-14182-2-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1337521768-14182-1-git-send-email-avi@redhat.com>

Put the KVM_REQ_EVENT block in the regular vcpu->requests if (),
instead of its own little check.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 arch/x86/kvm/x86.c |   30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b78f89d..953e692 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5233,6 +5233,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 		vcpu->run->request_interrupt_window;
 	bool req_immediate_exit = 0;
 
+	if (unlikely(req_int_win))
+		kvm_make_request(KVM_REQ_EVENT, vcpu);
+
 	if (vcpu->requests) {
 		if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu))
 			kvm_mmu_unload(vcpu);
@@ -5277,20 +5280,19 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 			kvm_handle_pmu_event(vcpu);
 		if (kvm_check_request(KVM_REQ_PMI, vcpu))
 			kvm_deliver_pmi(vcpu);
-	}
-
-	if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
-		inject_pending_event(vcpu);
-
-		/* enable NMI/IRQ window open exits if needed */
-		if (vcpu->arch.nmi_pending)
-			kvm_x86_ops->enable_nmi_window(vcpu);
-		else if (kvm_cpu_has_interrupt(vcpu) || req_int_win)
-			kvm_x86_ops->enable_irq_window(vcpu);
-
-		if (kvm_lapic_enabled(vcpu)) {
-			update_cr8_intercept(vcpu);
-			kvm_lapic_sync_to_vapic(vcpu);
+		if (kvm_check_request(KVM_REQ_EVENT, vcpu)) {
+			inject_pending_event(vcpu);
+
+			/* enable NMI/IRQ window open exits if needed */
+			if (vcpu->arch.nmi_pending)
+				kvm_x86_ops->enable_nmi_window(vcpu);
+			else if (kvm_cpu_has_interrupt(vcpu) || req_int_win)
+				kvm_x86_ops->enable_irq_window(vcpu);
+
+			if (kvm_lapic_enabled(vcpu)) {
+				update_cr8_intercept(vcpu);
+				kvm_lapic_sync_to_vapic(vcpu);
+			}
 		}
 	}
 
-- 
1.7.10.1


  reply	other threads:[~2012-05-20 13:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-20 13:49 [PATCH v2 0/3] Minor vcpu->requests improvements Avi Kivity
2012-05-20 13:49 ` Avi Kivity [this message]
2012-05-20 13:49 ` [PATCH v2 2/3] KVM: Optimize vcpu->requests slow path slightly Avi Kivity
2012-05-30 20:03   ` Marcelo Tosatti
2012-05-31  9:27     ` Avi Kivity
2012-06-02  0:23       ` Marcelo Tosatti
2012-05-20 13:49 ` [PATCH v2 3/3] KVM: Move mmu reload out of line Avi Kivity

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=1337521768-14182-2-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.