diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2011-02-23 12:42:14 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-05-06 02:16:57 -0400 |
commit | fc2ecf7ec76c5ee150b83dcefc863fa03fd365fb (patch) | |
tree | 2fcdfaf97cf5b9d7a1cfce9e2c8c041c38ea7dfe | |
parent | 5ece5bab3ed8594ce2c85c6c6e6b82109db36ca7 (diff) |
rcu: Enable DEBUG_OBJECTS_RCU_HEAD from !PREEMPT
The prohibition of DEBUG_OBJECTS_RCU_HEAD from !PREEMPT was due to the
fixup actions. So just produce a warning from !PREEMPT.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
-rw-r--r-- | kernel/rcupdate.c | 26 | ||||
-rw-r--r-- | lib/Kconfig.debug | 2 |
2 files changed, 22 insertions, 6 deletions
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index f3240e987928..b54d6d18258c 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -142,7 +142,14 @@ static int rcuhead_fixup_init(void *addr, enum debug_obj_state state) | |||
142 | * Ensure that queued callbacks are all executed. | 142 | * Ensure that queued callbacks are all executed. |
143 | * If we detect that we are nested in a RCU read-side critical | 143 | * If we detect that we are nested in a RCU read-side critical |
144 | * section, we should simply fail, otherwise we would deadlock. | 144 | * section, we should simply fail, otherwise we would deadlock. |
145 | * In !PREEMPT configurations, there is no way to tell if we are | ||
146 | * in a RCU read-side critical section or not, so we never | ||
147 | * attempt any fixup and just print a warning. | ||
145 | */ | 148 | */ |
149 | #ifndef CONFIG_PREEMPT | ||
150 | WARN_ON(1); | ||
151 | return 0; | ||
152 | #endif | ||
146 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || | 153 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || |
147 | irqs_disabled()) { | 154 | irqs_disabled()) { |
148 | WARN_ON(1); | 155 | WARN_ON(1); |
@@ -184,7 +191,14 @@ static int rcuhead_fixup_activate(void *addr, enum debug_obj_state state) | |||
184 | * Ensure that queued callbacks are all executed. | 191 | * Ensure that queued callbacks are all executed. |
185 | * If we detect that we are nested in a RCU read-side critical | 192 | * If we detect that we are nested in a RCU read-side critical |
186 | * section, we should simply fail, otherwise we would deadlock. | 193 | * section, we should simply fail, otherwise we would deadlock. |
194 | * In !PREEMPT configurations, there is no way to tell if we are | ||
195 | * in a RCU read-side critical section or not, so we never | ||
196 | * attempt any fixup and just print a warning. | ||
187 | */ | 197 | */ |
198 | #ifndef CONFIG_PREEMPT | ||
199 | WARN_ON(1); | ||
200 | return 0; | ||
201 | #endif | ||
188 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || | 202 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || |
189 | irqs_disabled()) { | 203 | irqs_disabled()) { |
190 | WARN_ON(1); | 204 | WARN_ON(1); |
@@ -214,12 +228,14 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state) | |||
214 | * Ensure that queued callbacks are all executed. | 228 | * Ensure that queued callbacks are all executed. |
215 | * If we detect that we are nested in a RCU read-side critical | 229 | * If we detect that we are nested in a RCU read-side critical |
216 | * section, we should simply fail, otherwise we would deadlock. | 230 | * section, we should simply fail, otherwise we would deadlock. |
217 | * Note that the machinery to reliably determine whether | 231 | * In !PREEMPT configurations, there is no way to tell if we are |
218 | * or not we are in an RCU read-side critical section | 232 | * in a RCU read-side critical section or not, so we never |
219 | * exists only in the preemptible RCU implementations | 233 | * attempt any fixup and just print a warning. |
220 | * (TINY_PREEMPT_RCU and TREE_PREEMPT_RCU), which is why | ||
221 | * DEBUG_OBJECTS_RCU_HEAD is disallowed if !PREEMPT. | ||
222 | */ | 234 | */ |
235 | #ifndef CONFIG_PREEMPT | ||
236 | WARN_ON(1); | ||
237 | return 0; | ||
238 | #endif | ||
223 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || | 239 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || |
224 | irqs_disabled()) { | 240 | irqs_disabled()) { |
225 | WARN_ON(1); | 241 | WARN_ON(1); |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 93ce6de3300d..3aa278046d78 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -337,7 +337,7 @@ config DEBUG_OBJECTS_WORK | |||
337 | 337 | ||
338 | config DEBUG_OBJECTS_RCU_HEAD | 338 | config DEBUG_OBJECTS_RCU_HEAD |
339 | bool "Debug RCU callbacks objects" | 339 | bool "Debug RCU callbacks objects" |
340 | depends on DEBUG_OBJECTS && PREEMPT | 340 | depends on DEBUG_OBJECTS |
341 | help | 341 | help |
342 | Enable this to turn on debugging of RCU list heads (call_rcu() usage). | 342 | Enable this to turn on debugging of RCU list heads (call_rcu() usage). |
343 | 343 | ||