diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-09-15 18:04:49 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-09-15 18:14:49 +0200 |
commit | b079dc1233f319b5a709a4ba07f6bcc7a789c335 (patch) | |
tree | 77e2779fff82ab2d05dbfade37604764c3cbe0ac /virt | |
parent | 00261a9426ed50016e07cbef028578e93589761c (diff) | |
download | lwn-b079dc1233f319b5a709a4ba07f6bcc7a789c335.tar.gz lwn-b079dc1233f319b5a709a4ba07f6bcc7a789c335.zip |
kvm: Move get_cpu inside of spinlocked region in make_all_cpus_request()
kvm->requests_lock is a sleeping lock in RT, but it's locked inside
the preempt disabled region of get_cpu(). Move the get_cpu() region
inside the spinlocked region to avoid the might sleep warning.
BUG: sleeping function called from invalid context at kernel/rtmutex.c:684
in_atomic(): 1, irqs_disabled(): 0, pid: 10670, name: qemu-kvm
Pid: 10670, comm: qemu-kvm Not tainted 2.6.31-rc9-rt9.1-32bit #47
Call Trace:
[<c022a88a>] __might_sleep+0xcb/0xd0
[<c0498bd9>] rt_spin_lock+0x29/0x5e
[<f9161b54>] make_all_cpus_request+0x36/0xb2 [kvm]
[<f9161bf6>] kvm_flush_remote_tlbs+0x12/0x1f [kvm]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: Carsten Emde <carsten.emde@osadl.org>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2884baf1d5f9..b24e96d5d40c 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -745,8 +745,8 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) if (alloc_cpumask_var(&cpus, GFP_ATOMIC)) cpumask_clear(cpus); - me = get_cpu(); spin_lock(&kvm->requests_lock); + me = get_cpu(); for (i = 0; i < KVM_MAX_VCPUS; ++i) { vcpu = kvm->vcpus[i]; if (!vcpu) @@ -763,8 +763,8 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) smp_call_function_many(cpus, ack_flush, NULL, 1); else called = false; - spin_unlock(&kvm->requests_lock); put_cpu(); + spin_unlock(&kvm->requests_lock); free_cpumask_var(cpus); return called; } |