@@ -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));
Or would we meet 585 years later? :) Seriously, this wrap around hide implicit error... Reminder by Alexander Graf. Signed-off-by: Sheng Yang <sheng@linux.intel.com> --- arch/x86/kvm/lapic.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-)