|
@@ -804,14 +804,20 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
|
|
|
return -EOPNOTSUPP; /* disabled wait */
|
|
|
}
|
|
|
|
|
|
- __set_cpu_idle(vcpu);
|
|
|
if (!ckc_interrupts_enabled(vcpu)) {
|
|
|
VCPU_EVENT(vcpu, 3, "%s", "enabled wait w/o timer");
|
|
|
+ __set_cpu_idle(vcpu);
|
|
|
goto no_timer;
|
|
|
}
|
|
|
|
|
|
now = get_tod_clock_fast() + vcpu->arch.sie_block->epoch;
|
|
|
sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now);
|
|
|
+
|
|
|
+ /* underflow */
|
|
|
+ if (vcpu->arch.sie_block->ckc < now)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ __set_cpu_idle(vcpu);
|
|
|
hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
|
|
|
VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime);
|
|
|
no_timer:
|