Skip to content

Commit

Permalink
HVM-784 kvm_vcpu_block()/kvm_vcpu_kick() race induces latency burp
Browse files Browse the repository at this point in the history
  • Loading branch information
bcantrill committed Oct 16, 2013
1 parent 2bbad6a commit 6dd07ba
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions kvm.c
Expand Up @@ -24,7 +24,7 @@
* Yaniv Kamay <yaniv@qumranet.com>
*
* Ported to illumos by Joyent
* Copyright (c) 2012 Joyent, Inc. All rights reserved.
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
*
* Authors:
* Max Bruning <max@joyent.com>
Expand Down Expand Up @@ -1380,15 +1380,18 @@ void
kvm_vcpu_block(struct kvm_vcpu *vcpu)
{
for (;;) {
mutex_enter(&vcpu->kvcpu_kick_lock);

if (kvm_arch_vcpu_runnable(vcpu)) {
set_bit(KVM_REQ_UNHALT, &vcpu->requests);
mutex_exit(&vcpu->kvcpu_kick_lock);
break;
}

if (issig(JUSTLOOKING))
if (issig(JUSTLOOKING)) {
mutex_exit(&vcpu->kvcpu_kick_lock);
break;

mutex_enter(&vcpu->kvcpu_kick_lock);
}

if (kvm_cpu_has_pending_timer(vcpu)) {
mutex_exit(&vcpu->kvcpu_kick_lock);
Expand Down

0 comments on commit 6dd07ba

Please sign in to comment.