On some arm64 machines, the agtimer(4) ticks slowly enough that the
tc_delta() doesn't overflow across brief suspends.  While working on
arm64 suspend/resume, kettenis@ has been seeing warnings like this
during resume:

tc_setclock: cannot rewind uptime to 307.253324249

The warning is misleading and should be removed.  The code is behaving
as intended, but in a way I didn't anticipate when I added the warning
a few years ago.

It might be useful print a warning in inittodr(9) during resume if the
RTC time predates the system UTC suspend timestamp, but that's a
distinct concern.

ok?

Index: kern_tc.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_tc.c,v
retrieving revision 1.78
diff -u -p -r1.78 kern_tc.c
--- kern_tc.c   18 Sep 2022 20:47:09 -0000      1.78
+++ kern_tc.c   8 Nov 2022 11:53:01 -0000
@@ -552,7 +552,6 @@ void
 tc_setclock(const struct timespec *ts)
 {
        struct bintime new_naptime, old_naptime, uptime, utc;
-       struct timespec tmp;
        static int first = 1;
 #ifndef SMALL_KERNEL
        struct bintime elapsed;
@@ -582,12 +581,6 @@ tc_setclock(const struct timespec *ts)
        new_naptime = timehands->th_naptime;
 
        mtx_leave(&windup_mtx);
-
-       if (bintimecmp(&old_naptime, &new_naptime, ==)) {
-               BINTIME_TO_TIMESPEC(&uptime, &tmp);
-               printf("%s: cannot rewind uptime to %lld.%09ld\n",
-                   __func__, (long long)tmp.tv_sec, tmp.tv_nsec);
-       }
 
 #ifndef SMALL_KERNEL
        /* convert the bintime to ticks */

Reply via email to