summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2017-12-19 10:05:45 +0000
committerMoyano, Gabriel <gabriel.moyano@dlr.de>2021-11-16 09:48:22 +0100
commit7d3712fb26fe2cc7da71492f75b4f3cac6c996ec (patch)
treeb258f9f338fbcb068d8836fe612728ebd2cf2e76
parentSPDX: use the Beerware identifier. (diff)
downloadrtems-7d3712fb26fe2cc7da71492f75b4f3cac6c996ec.tar.bz2
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
-rw-r--r--cpukit/score/src/kern_tc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index b17327a2f8..9e6602e478 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -1799,10 +1799,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,