diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-03-12 19:54:14 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-06-10 16:45:25 -0400 |
commit | 99f88919f8fa8a8b01b5306c59c9977b94604df8 (patch) | |
tree | 8e92937651258199944fed1ae2b612f0f693be00 | |
parent | efc151c33b971148894789dc7c5589dec46d4348 (diff) |
rcu: Remove srcu_read_lock_raw() and srcu_read_unlock_raw().
These interfaces never did get used, so this commit removes them,
their rcutorture tests, and documentation referencing them.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
-rw-r--r-- | Documentation/RCU/checklist.txt | 6 | ||||
-rw-r--r-- | Documentation/RCU/torture.txt | 6 | ||||
-rw-r--r-- | Documentation/RCU/whatisRCU.txt | 22 | ||||
-rw-r--r-- | include/linux/srcu.h | 43 | ||||
-rw-r--r-- | kernel/rcutorture.c | 39 |
5 files changed, 7 insertions, 109 deletions
diff --git a/Documentation/RCU/checklist.txt b/Documentation/RCU/checklist.txt index 79e789b8b8ea..7703ec73a9bb 100644 --- a/Documentation/RCU/checklist.txt +++ b/Documentation/RCU/checklist.txt | |||
@@ -354,12 +354,6 @@ over a rather long period of time, but improvements are always welcome! | |||
354 | using RCU rather than SRCU, because RCU is almost always faster | 354 | using RCU rather than SRCU, because RCU is almost always faster |
355 | and easier to use than is SRCU. | 355 | and easier to use than is SRCU. |
356 | 356 | ||
357 | If you need to enter your read-side critical section in a | ||
358 | hardirq or exception handler, and then exit that same read-side | ||
359 | critical section in the task that was interrupted, then you need | ||
360 | to srcu_read_lock_raw() and srcu_read_unlock_raw(), which avoid | ||
361 | the lockdep checking that would otherwise this practice illegal. | ||
362 | |||
363 | Also unlike other forms of RCU, explicit initialization | 357 | Also unlike other forms of RCU, explicit initialization |
364 | and cleanup is required via init_srcu_struct() and | 358 | and cleanup is required via init_srcu_struct() and |
365 | cleanup_srcu_struct(). These are passed a "struct srcu_struct" | 359 | cleanup_srcu_struct(). These are passed a "struct srcu_struct" |
diff --git a/Documentation/RCU/torture.txt b/Documentation/RCU/torture.txt index 7dce8a17eac2..d8a502387397 100644 --- a/Documentation/RCU/torture.txt +++ b/Documentation/RCU/torture.txt | |||
@@ -182,12 +182,6 @@ torture_type The type of RCU to test, with string values as follows: | |||
182 | "srcu_expedited": srcu_read_lock(), srcu_read_unlock() and | 182 | "srcu_expedited": srcu_read_lock(), srcu_read_unlock() and |
183 | synchronize_srcu_expedited(). | 183 | synchronize_srcu_expedited(). |
184 | 184 | ||
185 | "srcu_raw": srcu_read_lock_raw(), srcu_read_unlock_raw(), | ||
186 | and call_srcu(). | ||
187 | |||
188 | "srcu_raw_sync": srcu_read_lock_raw(), srcu_read_unlock_raw(), | ||
189 | and synchronize_srcu(). | ||
190 | |||
191 | "sched": preempt_disable(), preempt_enable(), and | 185 | "sched": preempt_disable(), preempt_enable(), and |
192 | call_rcu_sched(). | 186 | call_rcu_sched(). |
193 | 187 | ||
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index 10df0b82f459..0f0fb7c432c2 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt | |||
@@ -842,9 +842,7 @@ SRCU: Critical sections Grace period Barrier | |||
842 | 842 | ||
843 | srcu_read_lock synchronize_srcu srcu_barrier | 843 | srcu_read_lock synchronize_srcu srcu_barrier |
844 | srcu_read_unlock call_srcu | 844 | srcu_read_unlock call_srcu |
845 | srcu_read_lock_raw synchronize_srcu_expedited | 845 | srcu_dereference synchronize_srcu_expedited |
846 | srcu_read_unlock_raw | ||
847 | srcu_dereference | ||
848 | 846 | ||
849 | SRCU: Initialization/cleanup | 847 | SRCU: Initialization/cleanup |
850 | init_srcu_struct | 848 | init_srcu_struct |
@@ -865,38 +863,32 @@ list can be helpful: | |||
865 | 863 | ||
866 | a. Will readers need to block? If so, you need SRCU. | 864 | a. Will readers need to block? If so, you need SRCU. |
867 | 865 | ||
868 | b. Is it necessary to start a read-side critical section in a | 866 | b. What about the -rt patchset? If readers would need to block |
869 | hardirq handler or exception handler, and then to complete | ||
870 | this read-side critical section in the task that was | ||
871 | interrupted? If so, you need SRCU's srcu_read_lock_raw() and | ||
872 | srcu_read_unlock_raw() primitives. | ||
873 | |||
874 | c. What about the -rt patchset? If readers would need to block | ||
875 | in an non-rt kernel, you need SRCU. If readers would block | 867 | in an non-rt kernel, you need SRCU. If readers would block |
876 | in a -rt kernel, but not in a non-rt kernel, SRCU is not | 868 | in a -rt kernel, but not in a non-rt kernel, SRCU is not |
877 | necessary. | 869 | necessary. |
878 | 870 | ||
879 | d. Do you need to treat NMI handlers, hardirq handlers, | 871 | c. Do you need to treat NMI handlers, hardirq handlers, |
880 | and code segments with preemption disabled (whether | 872 | and code segments with preemption disabled (whether |
881 | via preempt_disable(), local_irq_save(), local_bh_disable(), | 873 | via preempt_disable(), local_irq_save(), local_bh_disable(), |
882 | or some other mechanism) as if they were explicit RCU readers? | 874 | or some other mechanism) as if they were explicit RCU readers? |
883 | If so, RCU-sched is the only choice that will work for you. | 875 | If so, RCU-sched is the only choice that will work for you. |
884 | 876 | ||
885 | e. Do you need RCU grace periods to complete even in the face | 877 | d. Do you need RCU grace periods to complete even in the face |
886 | of softirq monopolization of one or more of the CPUs? For | 878 | of softirq monopolization of one or more of the CPUs? For |
887 | example, is your code subject to network-based denial-of-service | 879 | example, is your code subject to network-based denial-of-service |
888 | attacks? If so, you need RCU-bh. | 880 | attacks? If so, you need RCU-bh. |
889 | 881 | ||
890 | f. Is your workload too update-intensive for normal use of | 882 | e. Is your workload too update-intensive for normal use of |
891 | RCU, but inappropriate for other synchronization mechanisms? | 883 | RCU, but inappropriate for other synchronization mechanisms? |
892 | If so, consider SLAB_DESTROY_BY_RCU. But please be careful! | 884 | If so, consider SLAB_DESTROY_BY_RCU. But please be careful! |
893 | 885 | ||
894 | g. Do you need read-side critical sections that are respected | 886 | f. Do you need read-side critical sections that are respected |
895 | even though they are in the middle of the idle loop, during | 887 | even though they are in the middle of the idle loop, during |
896 | user-mode execution, or on an offlined CPU? If so, SRCU is the | 888 | user-mode execution, or on an offlined CPU? If so, SRCU is the |
897 | only choice that will work for you. | 889 | only choice that will work for you. |
898 | 890 | ||
899 | h. Otherwise, use RCU. | 891 | g. Otherwise, use RCU. |
900 | 892 | ||
901 | Of course, this all assumes that you have determined that RCU is in fact | 893 | Of course, this all assumes that you have determined that RCU is in fact |
902 | the right tool for your job. | 894 | the right tool for your job. |
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 04f4121a23ae..c114614ed172 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
@@ -237,47 +237,4 @@ static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) | |||
237 | __srcu_read_unlock(sp, idx); | 237 | __srcu_read_unlock(sp, idx); |
238 | } | 238 | } |
239 | 239 | ||
240 | /** | ||
241 | * srcu_read_lock_raw - register a new reader for an SRCU-protected structure. | ||
242 | * @sp: srcu_struct in which to register the new reader. | ||
243 | * | ||
244 | * Enter an SRCU read-side critical section. Similar to srcu_read_lock(), | ||
245 | * but avoids the RCU-lockdep checking. This means that it is legal to | ||
246 | * use srcu_read_lock_raw() in one context, for example, in an exception | ||
247 | * handler, and then have the matching srcu_read_unlock_raw() in another | ||
248 | * context, for example in the task that took the exception. | ||
249 | * | ||
250 | * However, the entire SRCU read-side critical section must reside within a | ||
251 | * single task. For example, beware of using srcu_read_lock_raw() in | ||
252 | * a device interrupt handler and srcu_read_unlock() in the interrupted | ||
253 | * task: This will not work if interrupts are threaded. | ||
254 | */ | ||
255 | static inline int srcu_read_lock_raw(struct srcu_struct *sp) | ||
256 | { | ||
257 | unsigned long flags; | ||
258 | int ret; | ||
259 | |||
260 | local_irq_save(flags); | ||
261 | ret = __srcu_read_lock(sp); | ||
262 | local_irq_restore(flags); | ||
263 | return ret; | ||
264 | } | ||
265 | |||
266 | /** | ||
267 | * srcu_read_unlock_raw - unregister reader from an SRCU-protected structure. | ||
268 | * @sp: srcu_struct in which to unregister the old reader. | ||
269 | * @idx: return value from corresponding srcu_read_lock_raw(). | ||
270 | * | ||
271 | * Exit an SRCU read-side critical section without lockdep-RCU checking. | ||
272 | * See srcu_read_lock_raw() for more details. | ||
273 | */ | ||
274 | static inline void srcu_read_unlock_raw(struct srcu_struct *sp, int idx) | ||
275 | { | ||
276 | unsigned long flags; | ||
277 | |||
278 | local_irq_save(flags); | ||
279 | __srcu_read_unlock(sp, idx); | ||
280 | local_irq_restore(flags); | ||
281 | } | ||
282 | |||
283 | #endif | 240 | #endif |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index e1f3a8c96724..b1fa5510388d 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -695,44 +695,6 @@ static struct rcu_torture_ops srcu_sync_ops = { | |||
695 | .name = "srcu_sync" | 695 | .name = "srcu_sync" |
696 | }; | 696 | }; |
697 | 697 | ||
698 | static int srcu_torture_read_lock_raw(void) __acquires(&srcu_ctl) | ||
699 | { | ||
700 | return srcu_read_lock_raw(&srcu_ctl); | ||
701 | } | ||
702 | |||
703 | static void srcu_torture_read_unlock_raw(int idx) __releases(&srcu_ctl) | ||
704 | { | ||
705 | srcu_read_unlock_raw(&srcu_ctl, idx); | ||
706 | } | ||
707 | |||
708 | static struct rcu_torture_ops srcu_raw_ops = { | ||
709 | .init = rcu_sync_torture_init, | ||
710 | .readlock = srcu_torture_read_lock_raw, | ||
711 | .read_delay = srcu_read_delay, | ||
712 | .readunlock = srcu_torture_read_unlock_raw, | ||
713 | .completed = srcu_torture_completed, | ||
714 | .deferred_free = srcu_torture_deferred_free, | ||
715 | .sync = srcu_torture_synchronize, | ||
716 | .call = NULL, | ||
717 | .cb_barrier = NULL, | ||
718 | .stats = srcu_torture_stats, | ||
719 | .name = "srcu_raw" | ||
720 | }; | ||
721 | |||
722 | static struct rcu_torture_ops srcu_raw_sync_ops = { | ||
723 | .init = rcu_sync_torture_init, | ||
724 | .readlock = srcu_torture_read_lock_raw, | ||
725 | .read_delay = srcu_read_delay, | ||
726 | .readunlock = srcu_torture_read_unlock_raw, | ||
727 | .completed = srcu_torture_completed, | ||
728 | .deferred_free = rcu_sync_torture_deferred_free, | ||
729 | .sync = srcu_torture_synchronize, | ||
730 | .call = NULL, | ||
731 | .cb_barrier = NULL, | ||
732 | .stats = srcu_torture_stats, | ||
733 | .name = "srcu_raw_sync" | ||
734 | }; | ||
735 | |||
736 | static void srcu_torture_synchronize_expedited(void) | 698 | static void srcu_torture_synchronize_expedited(void) |
737 | { | 699 | { |
738 | synchronize_srcu_expedited(&srcu_ctl); | 700 | synchronize_srcu_expedited(&srcu_ctl); |
@@ -1983,7 +1945,6 @@ rcu_torture_init(void) | |||
1983 | { &rcu_ops, &rcu_sync_ops, &rcu_expedited_ops, | 1945 | { &rcu_ops, &rcu_sync_ops, &rcu_expedited_ops, |
1984 | &rcu_bh_ops, &rcu_bh_sync_ops, &rcu_bh_expedited_ops, | 1946 | &rcu_bh_ops, &rcu_bh_sync_ops, &rcu_bh_expedited_ops, |
1985 | &srcu_ops, &srcu_sync_ops, &srcu_expedited_ops, | 1947 | &srcu_ops, &srcu_sync_ops, &srcu_expedited_ops, |
1986 | &srcu_raw_ops, &srcu_raw_sync_ops, | ||
1987 | &sched_ops, &sched_sync_ops, &sched_expedited_ops, }; | 1948 | &sched_ops, &sched_sync_ops, &sched_expedited_ops, }; |
1988 | 1949 | ||
1989 | mutex_lock(&fullstop_mutex); | 1950 | mutex_lock(&fullstop_mutex); |