Skip to content

Commit 9b62e5b

Browse files
Jan Blunckavikivity
authored andcommitted
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>
1 parent 14d0bc1 commit 9b62e5b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4569,7 +4569,7 @@ static void vcpu_kick_intr(void *info)
45694569
void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
45704570
{
45714571
int ipi_pcpu = vcpu->cpu;
4572-
int cpu = get_cpu();
4572+
int cpu;
45734573

45744574
if (waitqueue_active(&vcpu->wq)) {
45754575
wake_up_interruptible(&vcpu->wq);
@@ -4579,6 +4579,7 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
45794579
* We may be called synchronously with irqs disabled in guest mode,
45804580
* So need not to call smp_call_function_single() in that case.
45814581
*/
4582+
cpu = get_cpu();
45824583
if (vcpu->guest_mode && vcpu->cpu != cpu)
45834584
smp_call_function_single(ipi_pcpu, vcpu_kick_intr, vcpu, 0);
45844585
put_cpu();

0 commit comments

Comments
 (0)