svn commit: r326973 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Tue Dec 19 10:05:46 UTC 2017
Author: kib
Date: Tue Dec 19 10:05:45 2017
New Revision: 326973
URL: https://svnweb.freebsd.org/changeset/base/326973
Log:
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
Modified:
head/sys/kern/kern_tc.c
Modified: head/sys/kern/kern_tc.c
==============================================================================
--- head/sys/kern/kern_tc.c Tue Dec 19 10:02:09 2017 (r326972)
+++ head/sys/kern/kern_tc.c Tue Dec 19 10:05:45 2017 (r326973)
@@ -1601,10 +1601,10 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_stat
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,
More information about the svn-src-all
mailing list