|
@@ -198,14 +198,11 @@ static int __pit_timer_fn(struct kvm_kpit_state *ps)
|
|
|
struct kvm_vcpu *vcpu0 = ps->pit->kvm->vcpus[0];
|
|
|
struct kvm_kpit_timer *pt = &ps->pit_timer;
|
|
|
|
|
|
- atomic_inc(&pt->pending);
|
|
|
- smp_mb__after_atomic_inc();
|
|
|
- if (vcpu0) {
|
|
|
+ if (!atomic_inc_and_test(&pt->pending))
|
|
|
set_bit(KVM_REQ_PENDING_TIMER, &vcpu0->requests);
|
|
|
- if (waitqueue_active(&vcpu0->wq)) {
|
|
|
- vcpu0->arch.mp_state = KVM_MP_STATE_RUNNABLE;
|
|
|
- wake_up_interruptible(&vcpu0->wq);
|
|
|
- }
|
|
|
+ if (vcpu0 && waitqueue_active(&vcpu0->wq)) {
|
|
|
+ vcpu0->arch.mp_state = KVM_MP_STATE_RUNNABLE;
|
|
|
+ wake_up_interruptible(&vcpu0->wq);
|
|
|
}
|
|
|
|
|
|
pt->timer.expires = ktime_add_ns(pt->timer.expires, pt->period);
|