aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a9565e24063..7149a2e6552 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1514,6 +1514,28 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
1514 finish_wait(&vcpu->wq, &wait); 1514 finish_wait(&vcpu->wq, &wait);
1515} 1515}
1516 1516
1517/*
1518 * Kick a sleeping VCPU, or a guest VCPU in guest mode, into host kernel mode.
1519 */
1520void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
1521{
1522 int me;
1523 int cpu = vcpu->cpu;
1524 wait_queue_head_t *wqp;
1525
1526 wqp = kvm_arch_vcpu_wq(vcpu);
1527 if (waitqueue_active(wqp)) {
1528 wake_up_interruptible(wqp);
1529 ++vcpu->stat.halt_wakeup;
1530 }
1531
1532 me = get_cpu();
1533 if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu))
1534 if (kvm_arch_vcpu_should_kick(vcpu))
1535 smp_send_reschedule(cpu);
1536 put_cpu();
1537}
1538
1517void kvm_resched(struct kvm_vcpu *vcpu) 1539void kvm_resched(struct kvm_vcpu *vcpu)
1518{ 1540{
1519 if (!need_resched()) 1541 if (!need_resched())