From: Paul E. McKenney Date: Mon, 20 Jan 2020 23:29:04 +0000 (-0800) Subject: rcu: Add WRITE_ONCE() to rcu_state ->gp_start X-Git-Tag: v5.7-rc1~183^2^2^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=59881bcd85a06565c53fd13ce3b0ad7fa55e560c;p=thirdparty%2Flinux.git rcu: Add WRITE_ONCE() to rcu_state ->gp_start The rcu_state structure's ->gp_start field is read locklessly, so this commit adds the WRITE_ONCE() to an update in order to provide proper documentation and READ_ONCE()/WRITE_ONCE() pairing. This data race was reported by KCSAN. Not appropriate for backporting due to failure being unlikely. Signed-off-by: Paul E. McKenney --- diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index bca637b274fb8..488b71d030307 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -102,7 +102,7 @@ static void record_gp_stall_check_time(void) unsigned long j = jiffies; unsigned long j1; - rcu_state.gp_start = j; + WRITE_ONCE(rcu_state.gp_start, j); j1 = rcu_jiffies_till_stall_check(); /* Record ->gp_start before ->jiffies_stall. */ smp_store_release(&rcu_state.jiffies_stall, j + j1); /* ^^^ */