linux-hardened/kernel/rcu
Paul E. McKenney 7f554a3d05 srcu: Reduce probability of SRCU ->unlock_count[] counter overflow
Because there are no memory barriers between the srcu_flip() ->completed
increment and the summation of the read-side ->unlock_count[] counters,
both the compiler and the CPU can reorder the summation with the
->completed increment.  If the updater is preempted long enough during
this process, the read-side counters could overflow, resulting in a
too-short grace period.

This commit therefore adds a memory barrier just after the ->completed
increment, ensuring that if the summation misses an increment of
->unlock_count[] from __srcu_read_unlock(), the next __srcu_read_lock()
will see the new value of ->completed, thus bounding the number of
->unlock_count[] increments that can be missed to NR_CPUS.  The actual
overflow computation is more complex due to the possibility of nesting
of __srcu_read_lock().

Reported-by: Lance Roy <ldr709@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2017-01-25 12:54:22 -08:00
..
Makefile rcutorture: Add RCU grace-period performance tests 2016-03-31 13:37:38 -07:00
rcu.h rcu: Narrow early boot window of illegal synchronous grace periods 2017-01-14 21:23:48 -08:00
rcuperf.c rcuperf: Consistently insert space between flag and message 2016-08-22 10:06:16 -07:00
rcutorture.c srcu: Implement more-efficient reader counts 2017-01-25 12:53:20 -08:00
srcu.c srcu: Reduce probability of SRCU ->unlock_count[] counter overflow 2017-01-25 12:54:22 -08:00
sync.c locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write() 2016-08-18 15:36:59 +02:00
tiny.c rcu: Remove cond_resched() from Tiny synchronize_sched() 2017-01-14 21:22:20 -08:00
tiny_plugin.h rcu: Narrow early boot window of illegal synchronous grace periods 2017-01-14 21:23:48 -08:00
tree.c rcu: Narrow early boot window of illegal synchronous grace periods 2017-01-14 21:23:48 -08:00
tree.h srcu: Force full grace-period ordering 2017-01-25 12:54:22 -08:00
tree_exp.h rcu: Narrow early boot window of illegal synchronous grace periods 2017-01-14 21:23:48 -08:00
tree_plugin.h rcu: Narrow early boot window of illegal synchronous grace periods 2017-01-14 21:23:48 -08:00
tree_trace.c rcu: Drive expedited grace periods from workqueue 2016-08-22 09:30:25 -07:00
update.c rcu: Narrow early boot window of illegal synchronous grace periods 2017-01-14 21:23:48 -08:00