public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@suse.de>
To: rt-users <linux-rt-users@vger.kernel.org>
Cc: kvm@vger.kernel.org
Subject: [patch 3/3] kvm: wake up waitqueue before calling get_cpu()
Date: Wed, 08 Apr 2009 01:58:56 +0200	[thread overview]
Message-ID: <20090407235902.542493610@suse.de> (raw)
In-Reply-To: 20090407235853.309888494@suse.de

[-- Attachment #1: patches.rt/kvm-wake-up-waitqueue-before-calling-get_cpu.patch --]
[-- Type: text/plain, Size: 1066 bytes --]

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 <jblunck@suse.de>
Signed-off-by: Sven-Thorsten Dietrich <sven@thebigcorporation.com>
---
 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();



  parent reply	other threads:[~2009-04-08  0:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07 23:58 [patch 0/3] Patches for KVM & RT Jan Blunck
2009-04-07 23:58 ` [patch 1/3] Make rt_down_read_trylock() behave like down_read_trylock() Jan Blunck
2009-04-09 13:47   ` Thomas Gleixner
2009-04-07 23:58 ` [patch 2/3] kvm: convert spin-locks to raw_spinlock_t Jan Blunck
2009-04-09  9:21   ` Marcelo Tosatti
2009-04-09 13:48   ` Thomas Gleixner
2009-04-07 23:58 ` Jan Blunck [this message]
2009-04-09  9:24   ` [patch 3/3] kvm: wake up waitqueue before calling get_cpu() Marcelo Tosatti
2009-04-09 13:48   ` Thomas Gleixner
2009-04-09 21:44 ` [patch 0/3] Patches for KVM & RT Carsten Emde
2009-04-10  7:23   ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090407235902.542493610@suse.de \
    --to=jblunck@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox