aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2011-11-08 19:23:23 -0500
committerAvi Kivity <avi@redhat.com>2012-03-05 07:52:26 -0500
commit25051b5a5aff0bb71435421b4b80279b789fa0dc (patch)
tree2bf51135f6dee991d80e83e4e59fe64b26d94f69 /arch/powerpc/kvm/booke.c
parent7e28e60ef974d0eeb43112ef264d8c130f7b7bf4 (diff)
KVM: PPC: Move prepare_to_enter call site into subarch code
This function should be called with interrupts disabled, to avoid a race where an exception is delivered after we check, but the resched kick is received before we disable interrupts (and thus doesn't actually trigger the exit code that would recheck exceptions). booke already does this properly in the lightweight exit case, but not on initial entry. For now, move the call of prepare_to_enter into subarch-specific code so that booke can do the right thing here. Ideally book3s would do the same thing, but I'm having a hard time seeing where it does any interrupt disabling of this sort (plus it has several additional call sites), so I'm deferring the book3s fix to someone more familiar with that code. book3s behavior should be unchanged by this patch. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index e082e348c882..feaefc433276 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -295,6 +295,8 @@ void kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
295 unsigned long old_pending = vcpu->arch.pending_exceptions; 295 unsigned long old_pending = vcpu->arch.pending_exceptions;
296 unsigned int priority; 296 unsigned int priority;
297 297
298 WARN_ON_ONCE(!irqs_disabled());
299
298 priority = __ffs(*pending); 300 priority = __ffs(*pending);
299 while (priority <= BOOKE_IRQPRIO_MAX) { 301 while (priority <= BOOKE_IRQPRIO_MAX) {
300 if (kvmppc_booke_irqprio_deliver(vcpu, priority)) 302 if (kvmppc_booke_irqprio_deliver(vcpu, priority))
@@ -323,6 +325,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
323 325
324 local_irq_disable(); 326 local_irq_disable();
325 327
328 kvmppc_core_prepare_to_enter(vcpu);
329
326 if (signal_pending(current)) { 330 if (signal_pending(current)) {
327 kvm_run->exit_reason = KVM_EXIT_INTR; 331 kvm_run->exit_reason = KVM_EXIT_INTR;
328 ret = -EINTR; 332 ret = -EINTR;