[hrtimer] Enforce resolution as lower limit of intervals

Roman Zippel pointed out that the missing lower limit of intervals
leads to an accounting error in the overrun count. Enforce the lower
limit of intervals to resolution in the timer forwarding code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

+5 -3
+1 -2
include/linux/hrtimer.h
··· 122 } 123 124 /* Forward a hrtimer so it expires after now: */ 125 - extern unsigned long hrtimer_forward(struct hrtimer *timer, 126 - const ktime_t interval); 127 128 /* Precise sleep: */ 129 extern long hrtimer_nanosleep(struct timespec *rqtp,
··· 122 } 123 124 /* Forward a hrtimer so it expires after now: */ 125 + extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval); 126 127 /* Precise sleep: */ 128 extern long hrtimer_nanosleep(struct timespec *rqtp,
+4 -1
kernel/hrtimer.c
··· 275 * The number of overruns is added to the overrun field. 276 */ 277 unsigned long 278 - hrtimer_forward(struct hrtimer *timer, const ktime_t interval) 279 { 280 unsigned long orun = 1; 281 ktime_t delta, now; ··· 286 287 if (delta.tv64 < 0) 288 return 0; 289 290 if (unlikely(delta.tv64 >= interval.tv64)) { 291 nsec_t incr = ktime_to_ns(interval);
··· 275 * The number of overruns is added to the overrun field. 276 */ 277 unsigned long 278 + hrtimer_forward(struct hrtimer *timer, ktime_t interval) 279 { 280 unsigned long orun = 1; 281 ktime_t delta, now; ··· 286 287 if (delta.tv64 < 0) 288 return 0; 289 + 290 + if (interval.tv64 < timer->base->resolution.tv64) 291 + interval.tv64 = timer->base->resolution.tv64; 292 293 if (unlikely(delta.tv64 >= interval.tv64)) { 294 nsec_t incr = ktime_to_ns(interval);