Patchwork [11/52] KVM: PPC: booke: check for signals in kvmppc_vcpu_run

login
register
mail settings
Submitter Alexander Graf
Date Jan. 13, 2012, 2:31 p.m.
Message ID <1326465115-5976-12-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/135903/
State New
Headers show

Comments

Alexander Graf - Jan. 13, 2012, 2:31 p.m.
From: Scott Wood <scottwood@freescale.com>

Currently we check prior to returning from a lightweight exit,
but not prior to initial entry.

book3s already does a similar test.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/booke.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

Patch

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index b642200..9c78589 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -322,11 +322,19 @@  int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
 	}
 
 	local_irq_disable();
+
+	if (signal_pending(current)) {
+		kvm_run->exit_reason = KVM_EXIT_INTR;
+		ret = -EINTR;
+		goto out;
+	}
+
 	kvm_guest_enter();
 	ret = __kvmppc_vcpu_run(kvm_run, vcpu);
 	kvm_guest_exit();
-	local_irq_enable();
 
+out:
+	local_irq_enable();
 	return ret;
 }