linux/kernel/rcu
Paul E. McKenney 1f3ebc8253 rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock()
Commit bb73c52bad ("rcu: Don't disable preemption for Tiny and Tree
RCU readers") removed the barrier() calls from rcu_read_lock() and
rcu_write_lock() in CONFIG_PREEMPT=n&&CONFIG_PREEMPT_COUNT=n kernels.
Within RCU, this commit was OK, but it failed to account for things like
get_user() that can pagefault and that can be reordered by the compiler.
Lack of the barrier() calls in rcu_read_lock() and rcu_read_unlock()
can cause these page faults to migrate into RCU read-side critical
sections, which in CONFIG_PREEMPT=n kernels could result in too-short
grace periods and arbitrary misbehavior.  Please see commit 386afc9114
("spinlocks and preemption points need to be at least compiler barriers")
and Linus's commit 66be4e66a7 ("rcu: locking and unlocking need to
always be at least barriers"), this last of which restores the barrier()
call to both rcu_read_lock() and rcu_read_unlock().

This commit removes barrier() calls that are no longer needed given that
the addition of them in Linus's commit noted above.  The combination of
this commit and Linus's commit effectively reverts commit bb73c52bad
("rcu: Don't disable preemption for Tiny and Tree RCU readers").

Reported-by: Herbert Xu <herbert@gondor.apana.org.au>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
[ paulmck: Fix embarrassing typo located by Alan Stern. ]
2019-08-01 14:05:51 -07:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.debug treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rcu.h rcutorture: Add trivial RCU implementation 2019-05-28 09:06:09 -07:00
rcu_segcblist.c rcu/rcu_segcblist: Convert to SPDX license identifier 2019-02-09 08:43:40 -08:00
rcu_segcblist.h rcu/rcu_segcblist: Convert to SPDX license identifier 2019-02-09 08:43:40 -08:00
rcuperf.c rcuperf: Fix cleanup path for invalid perf_type strings 2019-03-26 14:42:53 -07:00
rcutorture.c rcutorture: Upper case solves the case of the vanishing NULL pointer 2019-05-28 09:06:09 -07:00
srcutiny.c srcu: Remove cleanup_srcu_struct_quiesced() 2019-03-26 14:39:24 -07:00
srcutree.c rcu: Make __call_srcu static 2019-05-28 09:03:35 -07:00
sync.c rcu/sync: Simplify the state machine 2019-05-28 09:05:23 -07:00
tiny.c rcu: rcu_qs -- Use raise_softirq_irqoff to not save irqs twice 2019-03-26 14:37:49 -07:00
tree.c Merge branches 'consolidate.2019.05.28a', 'doc.2019.05.28a', 'fixes.2019.06.13a', 'srcu.2019.05.28a', 'sync.2019.05.28a' and 'torture.2019.05.28a' into HEAD 2019-06-19 09:21:46 -07:00
tree.h rcu: Rename rcu_data's ->deferred_qs to ->exp_deferred_qs 2019-05-28 08:48:19 -07:00
tree_exp.h Merge branches 'consolidate.2019.05.28a', 'doc.2019.05.28a', 'fixes.2019.06.13a', 'srcu.2019.05.28a', 'sync.2019.05.28a' and 'torture.2019.05.28a' into HEAD 2019-06-19 09:21:46 -07:00
tree_plugin.h rcu: Restore barrier() to rcu_read_lock() and rcu_read_unlock() 2019-08-01 14:05:51 -07:00
tree_stall.h rcu: Correctly unlock root node in rcu_check_gp_start_stall() 2019-05-28 09:02:57 -07:00
update.c rcutorture: Add trivial RCU implementation 2019-05-28 09:06:09 -07:00