rcu: Use data_race() for RCU expedited CPU stall-warning prints
authorPaul E. McKenney <paulmck@kernel.org>
Sun, 9 Feb 2020 10:35:22 +0000 (02:35 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 27 Apr 2020 18:04:37 +0000 (11:04 -0700)
Although the accesses used to determine whether or not an expedited
stall should be printed are an integral part of the concurrency algorithm
governing use of the corresponding variables, the values that are simply
printed are ancillary.  As such, it is best to use data_race() for these
accesses in order to provide the greatest latitude in the use of KCSAN
for the other accesses that are an integral part of the algorithm.  This
commit therefore changes the relevant uses of READ_ONCE() to data_race().

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree_exp.h

index 1a617b9dffb0534776ff32ce879bb685d7278ea9..e1a7986f15b4203b9317f2e5ba50849b6b9c8728 100644 (file)
@@ -542,8 +542,8 @@ static void synchronize_rcu_expedited_wait(void)
                }
                pr_cont(" } %lu jiffies s: %lu root: %#lx/%c\n",
                        jiffies - jiffies_start, rcu_state.expedited_sequence,
-                       READ_ONCE(rnp_root->expmask),
-                       ".T"[!!rnp_root->exp_tasks]);
+                       data_race(rnp_root->expmask),
+                       ".T"[!!data_race(rnp_root->exp_tasks)]);
                if (ndetected) {
                        pr_err("blocking rcu_node structures:");
                        rcu_for_each_node_breadth_first(rnp) {
@@ -553,8 +553,8 @@ static void synchronize_rcu_expedited_wait(void)
                                        continue;
                                pr_cont(" l=%u:%d-%d:%#lx/%c",
                                        rnp->level, rnp->grplo, rnp->grphi,
-                                       READ_ONCE(rnp->expmask),
-                                       ".T"[!!rnp->exp_tasks]);
+                                       data_race(rnp->expmask),
+                                       ".T"[!!data_race(rnp->exp_tasks)]);
                        }
                        pr_cont("\n");
                }