softlockup: stop softlockup messages due to touch_ts math overflow
Ensure math does not overflow when touch_ts is close to the upper
bounds. This occurs when the top 32 bits of the TSC reach 0xffffffff
causing additions to touch_ts to overflow and this in turn generates
spurious softlockup warnings.
While this normally does not happen (since it requires an uptime of
possibly thousands of years, it may happen if the TSC warps during S3).
Signed-off-by: Colin Ian King <firstname.lastname@example.org>
kernel/softlockup.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index 0d4c789..463652e 100644
@@ -155,11 +155,13 @@ void softlockup_tick(void)
* Wake up the high-prio watchdog task twice per
* threshold timespan.
- if (now > touch_ts + softlockup_thresh/2)
+ if ((unsigned long long)now >
+ (unsigned long long)touch_ts + softlockup_thresh/2)
/* Warn about unreasonable delays: */
- if (now <= (touch_ts + softlockup_thresh))
+ if ((unsigned long long)now <=
+ ((unsigned long long)touch_ts + softlockup_thresh))