@@ -157,7 +157,7 @@ __seqprop_##lockname##_const_ptr(const seqcount_##lockname##_t *s) \
157157static __always_inline unsigned \
158158__seqprop_##lockname##_sequence(const seqcount_##lockname##_t *s) \
159159{ \
160- unsigned seq = READ_ONCE( s->seqcount.sequence); \
160+ unsigned seq = smp_load_acquire(& s->seqcount.sequence); \
161161 \
162162 if (!IS_ENABLED(CONFIG_PREEMPT_RT)) \
163163 return seq; \
@@ -170,7 +170,7 @@ __seqprop_##lockname##_sequence(const seqcount_##lockname##_t *s) \
170170 * Re-read the sequence counter since the (possibly \
171171 * preempted) writer made progress. \
172172 */ \
173- seq = READ_ONCE ( s -> seqcount .sequence ); \
173+ seq = smp_load_acquire ( & s -> seqcount .sequence ); \
174174 } \
175175 \
176176 return seq ; \
@@ -208,7 +208,7 @@ static inline const seqcount_t *__seqprop_const_ptr(const seqcount_t *s)
208208
209209static inline unsigned __seqprop_sequence (const seqcount_t * s )
210210{
211- return READ_ONCE ( s -> sequence );
211+ return smp_load_acquire ( & s -> sequence );
212212}
213213
214214static inline bool __seqprop_preemptible (const seqcount_t * s )
@@ -263,17 +263,9 @@ SEQCOUNT_LOCKNAME(mutex, struct mutex, true, mutex)
263263#define seqprop_assert (s ) __seqprop(s, assert)(s)
264264
265265/**
266- * __read_seqcount_begin() - begin a seqcount_t read section w/o barrier
266+ * __read_seqcount_begin() - begin a seqcount_t read section
267267 * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants
268268 *
269- * __read_seqcount_begin is like read_seqcount_begin, but has no smp_rmb()
270- * barrier. Callers should ensure that smp_rmb() or equivalent ordering is
271- * provided before actually loading any of the variables that are to be
272- * protected in this critical section.
273- *
274- * Use carefully, only in critical code, and comment how the barrier is
275- * provided.
276- *
277269 * Return: count to be passed to read_seqcount_retry()
278270 */
279271#define __read_seqcount_begin (s ) \
@@ -293,13 +285,7 @@ SEQCOUNT_LOCKNAME(mutex, struct mutex, true, mutex)
293285 *
294286 * Return: count to be passed to read_seqcount_retry()
295287 */
296- #define raw_read_seqcount_begin (s ) \
297- ({ \
298- unsigned _seq = __read_seqcount_begin(s); \
299- \
300- smp_rmb(); \
301- _seq; \
302- })
288+ #define raw_read_seqcount_begin (s ) __read_seqcount_begin(s)
303289
304290/**
305291 * read_seqcount_begin() - begin a seqcount_t read critical section
@@ -328,7 +314,6 @@ SEQCOUNT_LOCKNAME(mutex, struct mutex, true, mutex)
328314({ \
329315 unsigned __seq = seqprop_sequence(s); \
330316 \
331- smp_rmb(); \
332317 kcsan_atomic_next(KCSAN_SEQLOCK_REGION_MAX); \
333318 __seq; \
334319})
0 commit comments