diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-08-12 16:54:21 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-09-16 13:08:03 -0400 |
commit | c847f14217d5aec5336272a54a32ffcf6e06ddcb (patch) | |
tree | 865d138fe6a772c37c4928518b257bb14834c793 /kernel/rcu/tree_plugin.h | |
parent | 1772947bd0126661866069157e95197e9c0020e9 (diff) |
rcu: Avoid misordering in nocb_leader_wait()
The NOCB follower wakeup ordering depends on the store to the tail
pointer happening before the wakeup. However, because atomic_long_add()
does not return a value, it does not provide ordering guarantees, and
the locking in wake_up() only guarantees that the store will happen
before the unlock, which might be too late. Even though this is only a
theoretical issue, this commit adds a smp_mb__after_atomic() after the
final atomic_long_add() to provide the needed ordering guarantee.
Reported-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'kernel/rcu/tree_plugin.h')
-rw-r--r-- | kernel/rcu/tree_plugin.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 8b7351836228..c554accfc5f5 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -2306,6 +2306,7 @@ wait_again: | |||
2306 | atomic_long_add(rdp->nocb_gp_count, &rdp->nocb_follower_count); | 2306 | atomic_long_add(rdp->nocb_gp_count, &rdp->nocb_follower_count); |
2307 | atomic_long_add(rdp->nocb_gp_count_lazy, | 2307 | atomic_long_add(rdp->nocb_gp_count_lazy, |
2308 | &rdp->nocb_follower_count_lazy); | 2308 | &rdp->nocb_follower_count_lazy); |
2309 | smp_mb__after_atomic(); /* Store *tail before wakeup. */ | ||
2309 | if (rdp != my_rdp && tail == &rdp->nocb_follower_head) { | 2310 | if (rdp != my_rdp && tail == &rdp->nocb_follower_head) { |
2310 | /* | 2311 | /* |
2311 | * List was empty, wake up the follower. | 2312 | * List was empty, wake up the follower. |