kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: "Jörg Sommer" <joerg@alea.gnuu.de>, "KVM list" <kvm@vger.kernel.org>
Subject: [PATCH 1/4] KVM: PPC: Book3s: PR: Disable preemption in vcpu_run
Date: Fri,  9 Dec 2011 16:26:49 +0100	[thread overview]
Message-ID: <1323444412-18482-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1323444412-18482-1-git-send-email-agraf@suse.de>

When entering the guest, we want to make sure we're not getting preempted
away, so let's disable preemption on entry, but enable it again while handling
guest exits.

Reported-by: Jörg Sommer <joerg@alea.gnuu.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/book3s_pr.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 726512b..8e4f800 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -519,6 +519,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
 	run->ready_for_interrupt_injection = 1;
 
 	trace_kvm_book3s_exit(exit_nr, vcpu);
+	preempt_enable();
 	kvm_resched(vcpu);
 	switch (exit_nr) {
 	case BOOK3S_INTERRUPT_INST_STORAGE:
@@ -763,6 +764,8 @@ program_interrupt:
 			run->exit_reason = KVM_EXIT_INTR;
 			r = -EINTR;
 		} else {
+			preempt_disable();
+
 			/* In case an interrupt came in that was triggered
 			 * from userspace (like DEC), we need to check what
 			 * to inject now! */
@@ -925,6 +928,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 #endif
 	ulong ext_msr;
 
+	preempt_disable();
+
 	/* Check if we can run the vcpu at all */
 	if (!vcpu->arch.sane) {
 		kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
@@ -1006,6 +1011,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 	current->thread.used_vsr = used_vsr;
 #endif
 
+	preempt_enable();
+
 	return ret;
 }
 
-- 
1.6.0.2


  reply	other threads:[~2011-12-09 15:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 15:26 [PATCH 0/4] Fix book3s-pr KVM with preemption Alexander Graf
2011-12-09 15:26 ` Alexander Graf [this message]
2011-12-09 18:19   ` [PATCH 1/4] KVM: PPC: Book3s: PR: Disable preemption in vcpu_run Scott Wood
2011-12-09 23:18     ` Alexander Graf
2011-12-13 21:15       ` Scott Wood
2011-12-09 15:26 ` [PATCH 2/4] KVM: PPC: Book3s: PR: No irq_disable " Alexander Graf
2011-12-09 15:26 ` [PATCH 3/4] KVM: PPC: Use get/set for to_svcpu to help preemption Alexander Graf
2011-12-09 15:26 ` [PATCH 4/4] KVM: PPC: align vcpu_kick with x86 Alexander Graf
2011-12-09 18:19   ` Scott Wood
2011-12-09 19:10     ` Alexander Graf
2011-12-09 19:15       ` Scott Wood
2011-12-09 23:15         ` Alexander Graf
2011-12-12 17:32           ` Scott Wood
2011-12-23 12:56             ` Alexander Graf
2011-12-23 21:50               ` Benjamin Herrenschmidt

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=1323444412-18482-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=joerg@alea.gnuu.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).