-/* $OpenBSD: kern_tc.c,v 1.33 2018/05/28 18:05:42 guenther Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.34 2018/09/18 20:47:11 bluhm Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
*/
#include <sys/param.h>
+#include <sys/atomic.h>
#include <sys/kernel.h>
#include <sys/timeout.h>
#include <sys/sysctl.h>
do {
th = timehands;
gen = th->th_generation;
+ membar_consumer();
*bt = th->th_offset;
bintime_addx(bt, th->th_scale * tc_delta(th));
+ membar_consumer();
} while (gen == 0 || gen != th->th_generation);
}
do {
th = timehands;
gen = th->th_generation;
+ membar_consumer();
bintime2timespec(&th->th_offset, tsp);
+ membar_consumer();
} while (gen == 0 || gen != th->th_generation);
}
do {
th = timehands;
gen = th->th_generation;
+ membar_consumer();
bintime2timeval(&th->th_offset, tvp);
+ membar_consumer();
} while (gen == 0 || gen != th->th_generation);
}
do {
th = timehands;
gen = th->th_generation;
+ membar_consumer();
*tsp = th->th_nanotime;
+ membar_consumer();
} while (gen == 0 || gen != th->th_generation);
}
do {
th = timehands;
gen = th->th_generation;
+ membar_consumer();
*tvp = th->th_microtime;
+ membar_consumer();
} while (gen == 0 || gen != th->th_generation);
}
th = tho->th_next;
ogen = th->th_generation;
th->th_generation = 0;
+ membar_producer();
memcpy(th, tho, offsetof(struct timehands, th_generation));
/*
*/
if (++ogen == 0)
ogen = 1;
+ membar_producer();
th->th_generation = ogen;
/* Go live with the new struct timehands. */
time_second = th->th_microtime.tv_sec;
time_uptime = th->th_offset.sec;
+ membar_producer();
timehands = th;
}