]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: use proper hrtimer function to retrieve expiration time
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 8 Oct 2009 13:55:03 +0000 (10:55 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Nov 2009 00:21:49 +0000 (16:21 -0800)
commit ace1546487a0fe4634e3251067f8a32cb2cdc099 upstream.

hrtimer->base can be temporarily NULL due to racing hrtimer_start.
See switch_hrtimer_base/lock_hrtimer_base.

Use hrtimer_get_remaining which is robust against it.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/i8254.c
arch/x86/kvm/lapic.c

index 21f68e00524f51e32ad479f80446a515c1f6817a..5c8bffff6bd7b87468cd6690fb2f6999e859d946 100644 (file)
@@ -116,7 +116,7 @@ static s64 __kpit_elapsed(struct kvm *kvm)
         * itself with the initial count and continues counting
         * from there.
         */
-       remaining = hrtimer_expires_remaining(&ps->pit_timer.timer);
+       remaining = hrtimer_get_remaining(&ps->pit_timer.timer);
        elapsed = ps->pit_timer.period - ktime_to_ns(remaining);
        elapsed = mod_64(elapsed, ps->pit_timer.period);
 
index b225176b5981b86bd8b11f6391a8674839289fb5..9a65123b798e7ec9c7111f01b610c5e9bd3e2afb 100644 (file)
@@ -464,7 +464,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
        if (apic_get_reg(apic, APIC_TMICT) == 0)
                return 0;
 
-       remaining = hrtimer_expires_remaining(&apic->lapic_timer.timer);
+       remaining = hrtimer_get_remaining(&apic->lapic_timer.timer);
        if (ktime_to_ns(remaining) < 0)
                remaining = ktime_set(0, 0);