]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: Wake up waitqueue before calling get_cpu()
authorJan Blunck <jblunck@suse.de>
Tue, 7 Apr 2009 23:58:56 +0000 (23:58 +0000)
committerAvi Kivity <avi@redhat.com>
Tue, 28 Apr 2009 09:24:24 +0000 (12:24 +0300)
This moves the get_cpu() call down to be called after we wake up the
waiters. Therefore the waitqueue locks can safely be rt mutex.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Sven-Thorsten Dietrich <sven@thebigcorporation.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index 8e40154dda7220e0fb7ca3deb06e8090165d2077..fbda4211c3ebabd2c1bd396fa23fdd4b867aeef0 100644 (file)
@@ -4565,7 +4565,7 @@ static void vcpu_kick_intr(void *info)
 void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
 {
        int ipi_pcpu = vcpu->cpu;
-       int cpu = get_cpu();
+       int cpu;
 
        if (waitqueue_active(&vcpu->wq)) {
                wake_up_interruptible(&vcpu->wq);
@@ -4575,6 +4575,7 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
         * We may be called synchronously with irqs disabled in guest mode,
         * So need not to call smp_call_function_single() in that case.
         */
+       cpu = get_cpu();
        if (vcpu->guest_mode && vcpu->cpu != cpu)
                smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0);
        put_cpu();