From patchwork Mon Apr 27 21:07:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 20260 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3RLAHpi029770 for ; Mon, 27 Apr 2009 21:10:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756052AbZD0VKG (ORCPT ); Mon, 27 Apr 2009 17:10:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755772AbZD0VKG (ORCPT ); Mon, 27 Apr 2009 17:10:06 -0400 Received: from mx2.redhat.com ([66.187.237.31]:36489 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753429AbZD0VKC (ORCPT ); Mon, 27 Apr 2009 17:10:02 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3RL9wSb002310; Mon, 27 Apr 2009 17:09:58 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3RL9u2t017886; Mon, 27 Apr 2009 17:09:56 -0400 Received: from amt.cnet (vpn-10-9.str.redhat.com [10.32.10.9]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3RL9pgt027146; Mon, 27 Apr 2009 17:09:52 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id C753E68173E; Mon, 27 Apr 2009 18:09:19 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n3RL9DRH011659; Mon, 27 Apr 2009 18:09:13 -0300 Message-Id: <20090427210840.053977950@amt.cnet> User-Agent: quilt/0.47-1 Date: Mon, 27 Apr 2009 18:07:42 -0300 From: mtosatti@redhat.com To: kvm@vger.kernel.org Cc: sheng@linux.intel.com, Jan Blunck , Sven-Thorsten Dietrich , Marcelo Tosatti Subject: [patch 2/4] KVM: x86: wake up waitqueue before calling get_cpu() References: <20090427210740.675732111@amt.cnet> Content-Disposition: inline; filename=vcpu-kick-rt X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Jan Blunck 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 Signed-off-by: Marcelo Tosatti --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: kvm/arch/x86/kvm/x86.c =================================================================== --- kvm.orig/arch/x86/kvm/x86.c +++ kvm/arch/x86/kvm/x86.c @@ -4544,7 +4544,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); @@ -4554,6 +4554,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();