Skip to content

Commit c099290

Browse files
committed
rcu: Mark writes to the rcu_segcblist structure's ->flags field
KCSAN reports data races between the rcu_segcblist_clear_flags() and rcu_segcblist_set_flags() functions, though misreporting the latter as a call to rcu_segcblist_is_enabled() from call_rcu(). This commit converts the updates of this field to WRITE_ONCE(), relying on the resulting unmarked reads to continue to detect buggy concurrent writes to this field. Reported-by: Zhouyi Zhou <zhouzhouyi@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Frederic Weisbecker <frederic@kernel.org>
1 parent d818cc7 commit c099290

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/rcu/rcu_segcblist.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ static inline long rcu_segcblist_n_cbs(struct rcu_segcblist *rsclp)
5656
static inline void rcu_segcblist_set_flags(struct rcu_segcblist *rsclp,
5757
int flags)
5858
{
59-
rsclp->flags |= flags;
59+
WRITE_ONCE(rsclp->flags, rsclp->flags | flags);
6060
}
6161

6262
static inline void rcu_segcblist_clear_flags(struct rcu_segcblist *rsclp,
6363
int flags)
6464
{
65-
rsclp->flags &= ~flags;
65+
WRITE_ONCE(rsclp->flags, rsclp->flags & ~flags);
6666
}
6767

6868
static inline bool rcu_segcblist_test_flags(struct rcu_segcblist *rsclp,

0 commit comments

Comments
 (0)