bool kvm_vcpu_block(struct kvm_vcpu *vcpu)
{
+ DEFINE_WAIT_FUNC(vcpu_block_wait, woken_wake_function);
struct rcuwait *wait = kvm_arch_vcpu_get_wait(vcpu);
bool waited = false;
@@ -3437,13 +3439,11 @@ bool kvm_vcpu_block(struct kvm_vcpu *vcpu)
preempt_enable();
for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
-
if (kvm_vcpu_check_block(vcpu) < 0)
break;
waited = true;
- schedule();
+ wait_woken(&vcpu_block_wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
}