From a6064e195483fbb40ef206fe2294ca6b0d64eda7 Mon Sep 17 00:00:00 2001 From: cheloha Date: Tue, 8 Nov 2022 18:17:51 +0000 Subject: [PATCH] tc_setclock: don't print a warning if tc_windup() rejects inittodr(9) time During resume, it isn't necessarily a problem if the UTC time we get from inittodr(9) lags behind the system UTC clock. In particular, if the active timecounter's frequency is low enough, tc_delta() might not overflow across a brief suspend. Remove the misleading warning message. The code is behaving as intended, just not in a way I anticipated when I added the warning message a few years ago. Discovered by kettenis@. Root cause isolated with kettenis@. Link: https://marc.info/?l=openbsd-tech&m=166790845619897&w=2 ok mlarkin@ kettenis@ --- sys/kern/kern_tc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 3509b8f2bd9..297eccc95de 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_tc.c,v 1.78 2022/09/18 20:47:09 cheloha Exp $ */ +/* $OpenBSD: kern_tc.c,v 1.79 2022/11/08 18:17:51 cheloha Exp $ */ /* * Copyright (c) 2000 Poul-Henning Kamp @@ -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; @@ -583,12 +582,6 @@ tc_setclock(const struct timespec *ts) 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 */ bintimesub(&new_naptime, &old_naptime, &elapsed); -- 2.20.1