@@ -237,7 +237,9 @@ static void timekeeping_check_update(struct timekeeper *tk, u64 offset)
237
237
}
238
238
}
239
239
240
- static inline u64 timekeeping_debug_get_delta (const struct tk_read_base * tkr )
240
+ static inline u64 timekeeping_cycles_to_ns (const struct tk_read_base * tkr , u64 cycles );
241
+
242
+ static inline u64 timekeeping_debug_get_ns (const struct tk_read_base * tkr )
241
243
{
242
244
struct timekeeper * tk = & tk_core .timekeeper ;
243
245
u64 now , last , mask , max , delta ;
@@ -266,22 +268,22 @@ static inline u64 timekeeping_debug_get_delta(const struct tk_read_base *tkr)
266
268
*/
267
269
if (unlikely ((~delta & mask ) < (mask >> 3 ))) {
268
270
tk -> underflow_seen = 1 ;
269
- delta = 0 ;
271
+ now = last ;
270
272
}
271
273
272
274
/* Cap delta value to the max_cycles values to avoid mult overflows */
273
275
if (unlikely (delta > max )) {
274
276
tk -> overflow_seen = 1 ;
275
- delta = tkr -> clock -> max_cycles ;
277
+ now = last + max ;
276
278
}
277
279
278
- return delta ;
280
+ return timekeeping_cycles_to_ns ( tkr , now ) ;
279
281
}
280
282
#else
281
283
static inline void timekeeping_check_update (struct timekeeper * tk , u64 offset )
282
284
{
283
285
}
284
- static inline u64 timekeeping_debug_get_delta (const struct tk_read_base * tkr )
286
+ static inline u64 timekeeping_debug_get_ns (const struct tk_read_base * tkr )
285
287
{
286
288
BUG ();
287
289
}
@@ -389,7 +391,7 @@ static __always_inline u64 __timekeeping_get_ns(const struct tk_read_base *tkr)
389
391
static inline u64 timekeeping_get_ns (const struct tk_read_base * tkr )
390
392
{
391
393
if (IS_ENABLED (CONFIG_DEBUG_TIMEKEEPING ))
392
- return timekeeping_delta_to_ns (tkr , timekeeping_debug_get_delta ( tkr ) );
394
+ return timekeeping_debug_get_ns (tkr );
393
395
394
396
return __timekeeping_get_ns (tkr );
395
397
}
0 commit comments