diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2008-12-30 12:55:06 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 05:02:55 -0400 |
commit | 52d939a0bf44081bc9f69b4fbdc9e7f416df27c7 (patch) | |
tree | 27a14385847f5585cdccaf5e5c18074595642970 /arch/x86/kvm/i8254.c | |
parent | 61a6bd672bda3b9468bf5895c1be085c4e481138 (diff) |
KVM: PIT: provide an option to disable interrupt reinjection
Certain clocks (such as TSC) in older 2.6 guests overaccount for lost
ticks, causing severe time drift. Interrupt reinjection magnifies the
problem.
Provide an option to disable it.
[avi: allow room for expansion in case we want to disable reinjection
of other timers]
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8254.c')
-rw-r--r-- | arch/x86/kvm/i8254.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 72bd275a9b5c..528daadeba49 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -201,6 +201,9 @@ static int __pit_timer_fn(struct kvm_kpit_state *ps) | |||
201 | if (!atomic_inc_and_test(&pt->pending)) | 201 | if (!atomic_inc_and_test(&pt->pending)) |
202 | set_bit(KVM_REQ_PENDING_TIMER, &vcpu0->requests); | 202 | set_bit(KVM_REQ_PENDING_TIMER, &vcpu0->requests); |
203 | 203 | ||
204 | if (!pt->reinject) | ||
205 | atomic_set(&pt->pending, 1); | ||
206 | |||
204 | if (vcpu0 && waitqueue_active(&vcpu0->wq)) | 207 | if (vcpu0 && waitqueue_active(&vcpu0->wq)) |
205 | wake_up_interruptible(&vcpu0->wq); | 208 | wake_up_interruptible(&vcpu0->wq); |
206 | 209 | ||
@@ -580,6 +583,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm) | |||
580 | pit_state->irq_ack_notifier.gsi = 0; | 583 | pit_state->irq_ack_notifier.gsi = 0; |
581 | pit_state->irq_ack_notifier.irq_acked = kvm_pit_ack_irq; | 584 | pit_state->irq_ack_notifier.irq_acked = kvm_pit_ack_irq; |
582 | kvm_register_irq_ack_notifier(kvm, &pit_state->irq_ack_notifier); | 585 | kvm_register_irq_ack_notifier(kvm, &pit_state->irq_ack_notifier); |
586 | pit_state->pit_timer.reinject = true; | ||
583 | mutex_unlock(&pit->pit_state.lock); | 587 | mutex_unlock(&pit->pit_state.lock); |
584 | 588 | ||
585 | kvm_pit_reset(pit); | 589 | kvm_pit_reset(pit); |