Index: sys/kern/subr_smr.c =================================================================== --- sys/kern/subr_smr.c +++ sys/kern/subr_smr.c @@ -275,7 +275,7 @@ c = zpcpu_get_cpu(smr, i); c_seq = SMR_SEQ_INVALID; for (;;) { - c_seq = atomic_load_int(&c->c_seq); + c_seq = atomic_load_acq_int(&c->c_seq); if (c_seq == SMR_SEQ_INVALID) break; @@ -323,6 +323,8 @@ if (c_seq != SMR_SEQ_INVALID && SMR_SEQ_GT(rd_seq, c_seq)) rd_seq = c_seq; } + /* Same semantic for reads of c->c_seq above as in smr_enter(). */ + atomic_thread_fence_acq(); /* * Advance the rd_seq as long as we observed the most recent one. @@ -331,6 +333,7 @@ do { if (SMR_SEQ_LEQ(rd_seq, s_rd_seq)) break; + atomic_thread_fence_rel(); } while (atomic_fcmpset_int(&s->s_rd_seq, &s_rd_seq, rd_seq) == 0); out: