From 871c5b102cccf201912303e0bd60b9be35fd1cdf Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 26 Jul 2023 21:45:36 +0000 Subject: [PATCH] kern: Restore non-atomic time_second symbol. This is used by savecore(8), vmstat(8), and possibly other things. --- sys/kern/kern_tc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 009a3f26efcd..b570195fd0c0 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -133,6 +133,9 @@ static struct timehands *volatile timehands = &th0; struct timecounter *timecounter = &dummy_timecounter; static struct timecounter *timecounters = &dummy_timecounter; +/* used by savecore(8) */ +time_t time_second_legacy asm("time_second"); + #ifdef __HAVE_ATOMIC64_LOADSTORE volatile time_t time__second __cacheline_aligned = 1; volatile time_t time__uptime __cacheline_aligned = 1; @@ -164,6 +167,8 @@ static inline void setrealuptime(time_t second, time_t uptime) { + time_second_legacy = second; + atomic_store_relaxed(&time__second, second); atomic_store_relaxed(&time__uptime, uptime); } @@ -178,6 +183,8 @@ setrealuptime(time_t second, time_t uptime) KDASSERT(mutex_owned(&timecounter_lock)); + time_second_legacy = second; + /* * Fast path -- no wraparound, just updating the low bits, so * no need for seqlocked access.