> Date: Tue, 14 Jul 2020 20:21:24 -0400 > From: George Koehler <[email protected]> > > On Tue, 14 Jul 2020 11:59:14 +0200 (CEST) > Mark Kettenis <[email protected]> wrote: > > > Yeah, one possible approach would be to increment ogen by two. A > > little bit easier to check that they can never be the same since one > > is always odd and the other is always even. > > > > Another possible approach would be to export both timehands. This > > could help avoiding some of the looping int the bin*time() functions > > in libc. Not sure that's worth it. And we should probably go for the > > "quick" fix initially regardless. > > I suspect that the bin*time() functions almost never loop back. > > Here's a quick fix: read ogen from the other struct timehands, so > there is only one sequence of generation values, giving odds to th0 > and evens to th1 (until the generation overflows and skips zero, then > it would give evens to th0 and odds to th1). > > I like this better than my first diff. OK?
ok kettenis@ > Index: kern/kern_tc.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_tc.c,v > retrieving revision 1.62 > diff -u -p -r1.62 kern_tc.c > --- kern/kern_tc.c 6 Jul 2020 13:33:09 -0000 1.62 > +++ kern/kern_tc.c 14 Jul 2020 21:58:57 -0000 > @@ -583,8 +583,8 @@ tc_windup(struct bintime *new_boottime, > * the contents, the generation must be zero. > */ > tho = timehands; > + ogen = tho->th_generation; > th = tho->th_next; > - ogen = th->th_generation; > th->th_generation = 0; > membar_producer(); > memcpy(th, tho, offsetof(struct timehands, th_generation)); >
