summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2009-04-08 03:58:56 +0400
committerAvi Kivity <avi@redhat.com>2009-06-10 12:48:49 +0400
commit9b62e5b10ff0f98346bcbe4a4fe3a0ca8fa7be30 (patch)
tree9170f5bce95041bc65630814d026db377beb2e25
parent14d0bc1f7c8226d5088e7182c3b53e0c7e91d1af (diff)
downloadlinux-9b62e5b10ff0f98346bcbe4a4fe3a0ca8fa7be30.tar.xz
KVM: Wake up waitqueue before calling get_cpu()
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>
-rw-r--r--arch/x86/kvm/x86.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0f3e04b74a66..e2713716e732 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4569,7 +4569,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);
@@ -4579,6 +4579,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();