]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: PPC: align vcpu_kick with x86
authorAlexander Graf <agraf@suse.de>
Fri, 9 Dec 2011 14:20:46 +0000 (15:20 +0100)
committerAvi Kivity <avi@redhat.com>
Mon, 5 Mar 2012 12:52:30 +0000 (14:52 +0200)
Our vcpu kick implementation differs a bit from x86 which resulted in us not
disabling preemption during the kick. Get it a bit closer to what x86 does.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/kvm/powerpc.c

index fd8d3b16eaf3388d5b394209e7a458e5432affec..e1ef4d6d972ab5a7b109ae70cb6d3f7add1e4022 100644 (file)
@@ -558,12 +558,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
 
 void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
 {
+       int me;
+       int cpu = vcpu->cpu;
+
+       me = get_cpu();
        if (waitqueue_active(&vcpu->wq)) {
                wake_up_interruptible(vcpu->arch.wqp);
                vcpu->stat.halt_wakeup++;
-       } else if (vcpu->cpu != -1) {
+       } else if (cpu != me && cpu != -1) {
                smp_send_reschedule(vcpu->cpu);
        }
+       put_cpu();
 }
 
 int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)