From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Blunck Subject: [patch 3/3] kvm: wake up waitqueue before calling get_cpu() Date: Wed, 08 Apr 2009 01:58:56 +0200 Message-ID: <20090407235902.542493610@suse.de> References: <20090407235853.309888494@suse.de> Cc: kvm@vger.kernel.org To: rt-users Return-path: Received: from cantor.suse.de ([195.135.220.2]:50749 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754723AbZDHAB0 (ORCPT ); Tue, 7 Apr 2009 20:01:26 -0400 Content-Disposition: inline; filename=patches.rt/kvm-wake-up-waitqueue-before-calling-get_cpu.patch Sender: kvm-owner@vger.kernel.org List-ID: This moves the get_cpu() call down to be called after we wake up the waiters. Therefore the waitqueue locks can savely be rt mutex. Signed-off-by: Jan Blunck Signed-off-by: Sven-Thorsten Dietrich --- arch/x86/kvm/x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: b/arch/x86/kvm/x86.c =================================================================== --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4229,7 +4229,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); @@ -4239,6 +4239,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();