Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcu: Add documentation for raw SRCU read-side primitives

Update various files in Documentation/RCU to reflect srcu_read_lock_raw()
and srcu_read_unlock_raw(). Credit to Peter Zijlstra for suggesting
use of the existing _raw suffix instead of the earlier bulkref names.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

+29 -16
+6
Documentation/RCU/checklist.txt
··· 328 328 RCU rather than SRCU, because RCU is almost always faster and 329 329 easier to use than is SRCU. 330 330 331 + If you need to enter your read-side critical section in a 332 + hardirq or exception handler, and then exit that same read-side 333 + critical section in the task that was interrupted, then you need 334 + to srcu_read_lock_raw() and srcu_read_unlock_raw(), which avoid 335 + the lockdep checking that would otherwise this practice illegal. 336 + 331 337 Also unlike other forms of RCU, explicit initialization 332 338 and cleanup is required via init_srcu_struct() and 333 339 cleanup_srcu_struct(). These are passed a "struct srcu_struct"
+5 -5
Documentation/RCU/rcu.txt
··· 38 38 39 39 Preemptible variants of RCU (CONFIG_TREE_PREEMPT_RCU) get the 40 40 same effect, but require that the readers manipulate CPU-local 41 - counters. These counters allow limited types of blocking 42 - within RCU read-side critical sections. SRCU also uses 43 - CPU-local counters, and permits general blocking within 44 - RCU read-side critical sections. These two variants of 45 - RCU detect grace periods by sampling these counters. 41 + counters. These counters allow limited types of blocking within 42 + RCU read-side critical sections. SRCU also uses CPU-local 43 + counters, and permits general blocking within RCU read-side 44 + critical sections. These variants of RCU detect grace periods 45 + by sampling these counters. 46 46 47 47 o If I am running on a uniprocessor kernel, which can only do one 48 48 thing at a time, why should I wait for a grace period?
+5 -6
Documentation/RCU/stallwarn.txt
··· 114 114 This resulted in a series of RCU CPU stall warnings, eventually 115 115 leading the realization that the CPU had failed. 116 116 117 - The RCU, RCU-sched, and RCU-bh implementations have CPU stall 118 - warning. SRCU does not have its own CPU stall warnings, but its 119 - calls to synchronize_sched() will result in RCU-sched detecting 120 - RCU-sched-related CPU stalls. Please note that RCU only detects 121 - CPU stalls when there is a grace period in progress. No grace period, 122 - no CPU stall warnings. 117 + The RCU, RCU-sched, and RCU-bh implementations have CPU stall warning. 118 + SRCU does not have its own CPU stall warnings, but its calls to 119 + synchronize_sched() will result in RCU-sched detecting RCU-sched-related 120 + CPU stalls. Please note that RCU only detects CPU stalls when there is 121 + a grace period in progress. No grace period, no CPU stall warnings. 123 122 124 123 To diagnose the cause of the stall, inspect the stack traces. 125 124 The offending function will usually be near the top of the stack.
+13 -5
Documentation/RCU/whatisRCU.txt
··· 834 834 835 835 srcu_read_lock synchronize_srcu N/A 836 836 srcu_read_unlock synchronize_srcu_expedited 837 + srcu_read_lock_raw 838 + srcu_read_unlock_raw 837 839 srcu_dereference 838 840 839 841 SRCU: Initialization/cleanup ··· 857 855 858 856 a. Will readers need to block? If so, you need SRCU. 859 857 860 - b. What about the -rt patchset? If readers would need to block 858 + b. Is it necessary to start a read-side critical section in a 859 + hardirq handler or exception handler, and then to complete 860 + this read-side critical section in the task that was 861 + interrupted? If so, you need SRCU's srcu_read_lock_raw() and 862 + srcu_read_unlock_raw() primitives. 863 + 864 + c. What about the -rt patchset? If readers would need to block 861 865 in an non-rt kernel, you need SRCU. If readers would block 862 866 in a -rt kernel, but not in a non-rt kernel, SRCU is not 863 867 necessary. 864 868 865 - c. Do you need to treat NMI handlers, hardirq handlers, 869 + d. Do you need to treat NMI handlers, hardirq handlers, 866 870 and code segments with preemption disabled (whether 867 871 via preempt_disable(), local_irq_save(), local_bh_disable(), 868 872 or some other mechanism) as if they were explicit RCU readers? 869 873 If so, you need RCU-sched. 870 874 871 - d. Do you need RCU grace periods to complete even in the face 875 + e. Do you need RCU grace periods to complete even in the face 872 876 of softirq monopolization of one or more of the CPUs? For 873 877 example, is your code subject to network-based denial-of-service 874 878 attacks? If so, you need RCU-bh. 875 879 876 - e. Is your workload too update-intensive for normal use of 880 + f. Is your workload too update-intensive for normal use of 877 881 RCU, but inappropriate for other synchronization mechanisms? 878 882 If so, consider SLAB_DESTROY_BY_RCU. But please be careful! 879 883 880 - f. Otherwise, use RCU. 884 + g. Otherwise, use RCU. 881 885 882 886 Of course, this all assumes that you have determined that RCU is in fact 883 887 the right tool for your job.