aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2017-12-19 10:05:45 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2017-12-19 10:05:45 +0000
commit6f697994fd36703d412a100c6e1b626fbf194cd4 (patch)
treecffbc8c23eb005293881033d4f8d3d9297c2afdb /sys/kern
parent30d4f9e8883099cbdbcb732b68372b7c2e0ec979 (diff)
downloadsrc-6f697994fd36703d412a100c6e1b626fbf194cd4.tar.gz
src-6f697994fd36703d412a100c6e1b626fbf194cd4.zip
Use atomic_load(9) to read ppsinfo sequence numbers.
In this case volatile qualifiers enusre that a compiler does not optimize the accesses out. Reviewed by: alc, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D13534
Notes
Notes: svn path=/head/; revision=326973
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_tc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 377a8b55359a..d291bc78fad3 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1601,10 +1601,10 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps)
tv.tv_usec = fapi->timeout.tv_nsec / 1000;
timo = tvtohz(&tv);
}
- aseq = pps->ppsinfo.assert_sequence;
- cseq = pps->ppsinfo.clear_sequence;
- while (aseq == pps->ppsinfo.assert_sequence &&
- cseq == pps->ppsinfo.clear_sequence) {
+ aseq = atomic_load_int(&pps->ppsinfo.assert_sequence);
+ cseq = atomic_load_int(&pps->ppsinfo.clear_sequence);
+ while (aseq == atomic_load_int(&pps->ppsinfo.assert_sequence) &&
+ cseq == atomic_load_int(&pps->ppsinfo.clear_sequence)) {
if (abi_aware(pps, 1) && pps->driver_mtx != NULL) {
if (pps->flags & PPSFLAG_MTX_SPIN) {
err = msleep_spin(pps, pps->driver_mtx,