summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-10-13 12:39:23 -0700
committerPaul E. McKenney <paulmck@kernel.org>2020-11-19 19:37:17 -0800
commit4d60b475f858ebdb06c1339f01a890f287b5e587 (patch)
tree604d4ee919a630ffd9717b97e0356f979a54e553 /security
parentbd56e0a4a291bc9db2cbaddef20ec61a1aad4208 (diff)
downloadlinux-4d60b475f858ebdb06c1339f01a890f287b5e587.tar.bz2
rcu: Prevent lockdep-RCU splats on lock acquisition/release
The rcu_cpu_starting() and rcu_report_dead() functions transition the current CPU between online and offline state from an RCU perspective. Unfortunately, this means that the rcu_cpu_starting() function's lock acquisition and the rcu_report_dead() function's lock releases happen while the CPU is offline from an RCU perspective, which can result in lockdep-RCU splats about using RCU from an offline CPU. And this situation can also result in too-short grace periods, especially in guest OSes that are subject to vCPU preemption. This commit therefore uses sequence-count-like synchronization to forgive use of RCU while RCU thinks a CPU is offline across the full extent of the rcu_cpu_starting() and rcu_report_dead() function's lock acquisitions and releases. One approach would have been to use the actual sequence-count primitives provided by the Linux kernel. Unfortunately, the resulting code looks completely broken and wrong, and is likely to result in patches that break RCU in an attempt to address this appearance of broken wrongness. Plus there is no net savings in lines of code, given the additional explicit memory barriers required. Therefore, this sequence count is instead implemented by a new ->ofl_seq field in the rcu_node structure. If this counter's value is an odd number, RCU forgives RCU read-side critical sections on other CPUs covered by the same rcu_node structure, even if those CPUs are offline from an RCU perspective. In addition, if a given leaf rcu_node structure's ->ofl_seq counter value is an odd number, rcu_gp_init() delays starting the grace period until that counter value changes. [ paulmck: Apply Peter Zijlstra feedback. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions