Or would we meet 585 years later? :) Seriously, this wrap around hide implicit error...
Reminder by Alexander Graf. Signed-off-by: Sheng Yang <[email protected]> --- arch/x86/kvm/lapic.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index afac68c..87c1da5 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -524,18 +524,9 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) if (tmcct == 0) return 0; - if (unlikely(ktime_to_ns(now) <= - ktime_to_ns(apic->timer.last_update))) { - /* Wrap around */ - passed = ktime_add(( { - (ktime_t) { - .tv64 = KTIME_MAX - - (apic->timer.last_update).tv64}; } - ), now); - apic_debug("time elapsed\n"); - } else - passed = ktime_sub(now, apic->timer.last_update); + BUG_ON(ktime_to_ns(now) <= ktime_to_ns(apic->timer.last_update)); + passed = ktime_sub(now, apic->timer.last_update); counter_passed = div64_u64(ktime_to_ns(passed), (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); -- 1.5.4.5 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
