.. | .. |
---|
42 | 42 | #include <linux/stacktrace.h> |
---|
43 | 43 | #include <linux/debug_locks.h> |
---|
44 | 44 | #include <linux/irqflags.h> |
---|
| 45 | +#include <linux/irqstage.h> |
---|
45 | 46 | #include <linux/utsname.h> |
---|
46 | 47 | #include <linux/hash.h> |
---|
47 | 48 | #include <linux/ftrace.h> |
---|
.. | .. |
---|
104 | 105 | static arch_spinlock_t __lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; |
---|
105 | 106 | static struct task_struct *__owner; |
---|
106 | 107 | |
---|
| 108 | +static __always_inline bool lockdep_stage_disabled(void) |
---|
| 109 | +{ |
---|
| 110 | + return stage_disabled(); |
---|
| 111 | +} |
---|
| 112 | + |
---|
| 113 | +#ifdef CONFIG_IRQ_PIPELINE |
---|
| 114 | +/* |
---|
| 115 | + * If LOCKDEP is enabled, we want irqs to be disabled for both stages |
---|
| 116 | + * when traversing the lockdep code for hard and mutable locks (at the |
---|
| 117 | + * expense of massive latency overhead though). |
---|
| 118 | + */ |
---|
| 119 | +static __always_inline unsigned long lockdep_stage_test_and_disable(int *irqsoff) |
---|
| 120 | +{ |
---|
| 121 | + return test_and_lock_stage(irqsoff); |
---|
| 122 | +} |
---|
| 123 | + |
---|
| 124 | +static __always_inline unsigned long lockdep_stage_disable(void) |
---|
| 125 | +{ |
---|
| 126 | + return lockdep_stage_test_and_disable(NULL); |
---|
| 127 | +} |
---|
| 128 | + |
---|
| 129 | +static __always_inline void lockdep_stage_restore(unsigned long flags) |
---|
| 130 | +{ |
---|
| 131 | + unlock_stage(flags); |
---|
| 132 | +} |
---|
| 133 | + |
---|
| 134 | +#else |
---|
| 135 | + |
---|
| 136 | +#define lockdep_stage_test_and_disable(__irqsoff) \ |
---|
| 137 | + ({ \ |
---|
| 138 | + unsigned long __flags; \ |
---|
| 139 | + raw_local_irq_save(__flags); \ |
---|
| 140 | + *(__irqsoff) = irqs_disabled_flags(__flags); \ |
---|
| 141 | + __flags; \ |
---|
| 142 | + }) |
---|
| 143 | + |
---|
| 144 | +#define lockdep_stage_disable() \ |
---|
| 145 | + ({ \ |
---|
| 146 | + unsigned long __flags; \ |
---|
| 147 | + raw_local_irq_save(__flags); \ |
---|
| 148 | + __flags; \ |
---|
| 149 | + }) |
---|
| 150 | + |
---|
| 151 | +#define lockdep_stage_restore(__flags) raw_local_irq_restore(__flags) |
---|
| 152 | + |
---|
| 153 | +#endif /* !CONFIG_IRQ_PIPELINE */ |
---|
| 154 | + |
---|
107 | 155 | static inline void lockdep_lock(void) |
---|
108 | 156 | { |
---|
109 | | - DEBUG_LOCKS_WARN_ON(!irqs_disabled()); |
---|
| 157 | + DEBUG_LOCKS_WARN_ON(!hard_irqs_disabled()); |
---|
110 | 158 | |
---|
111 | 159 | __this_cpu_inc(lockdep_recursion); |
---|
112 | 160 | arch_spin_lock(&__lock); |
---|
.. | .. |
---|
115 | 163 | |
---|
116 | 164 | static inline void lockdep_unlock(void) |
---|
117 | 165 | { |
---|
118 | | - DEBUG_LOCKS_WARN_ON(!irqs_disabled()); |
---|
| 166 | + DEBUG_LOCKS_WARN_ON(!hard_irqs_disabled()); |
---|
119 | 167 | |
---|
120 | 168 | if (debug_locks && DEBUG_LOCKS_WARN_ON(__owner != current)) |
---|
121 | 169 | return; |
---|
.. | .. |
---|
882 | 930 | /* |
---|
883 | 931 | * We do an RCU walk of the hash, see lockdep_free_key_range(). |
---|
884 | 932 | */ |
---|
885 | | - if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
---|
| 933 | + if (DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())) |
---|
886 | 934 | return NULL; |
---|
887 | 935 | |
---|
888 | 936 | hlist_for_each_entry_rcu_notrace(class, hash_head, hash_entry) { |
---|
.. | .. |
---|
1179 | 1227 | return; |
---|
1180 | 1228 | hash_head = keyhashentry(key); |
---|
1181 | 1229 | |
---|
1182 | | - raw_local_irq_save(flags); |
---|
| 1230 | + flags = lockdep_stage_disable(); |
---|
1183 | 1231 | if (!graph_lock()) |
---|
1184 | 1232 | goto restore_irqs; |
---|
1185 | 1233 | hlist_for_each_entry_rcu(k, hash_head, hash_entry) { |
---|
.. | .. |
---|
1190 | 1238 | out_unlock: |
---|
1191 | 1239 | graph_unlock(); |
---|
1192 | 1240 | restore_irqs: |
---|
1193 | | - raw_local_irq_restore(flags); |
---|
| 1241 | + lockdep_stage_restore(flags); |
---|
1194 | 1242 | } |
---|
1195 | 1243 | EXPORT_SYMBOL_GPL(lockdep_register_key); |
---|
1196 | 1244 | |
---|
.. | .. |
---|
1239 | 1287 | struct lock_class *class; |
---|
1240 | 1288 | int idx; |
---|
1241 | 1289 | |
---|
1242 | | - DEBUG_LOCKS_WARN_ON(!irqs_disabled()); |
---|
| 1290 | + DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled()); |
---|
1243 | 1291 | |
---|
1244 | 1292 | class = look_up_lock_class(lock, subclass); |
---|
1245 | 1293 | if (likely(class)) |
---|
.. | .. |
---|
2035 | 2083 | |
---|
2036 | 2084 | __bfs_init_root(&this, class); |
---|
2037 | 2085 | |
---|
2038 | | - raw_local_irq_save(flags); |
---|
| 2086 | + flags = lockdep_stage_disable(); |
---|
2039 | 2087 | lockdep_lock(); |
---|
2040 | 2088 | ret = __lockdep_count_forward_deps(&this); |
---|
2041 | 2089 | lockdep_unlock(); |
---|
2042 | | - raw_local_irq_restore(flags); |
---|
| 2090 | + lockdep_stage_restore(flags); |
---|
2043 | 2091 | |
---|
2044 | 2092 | return ret; |
---|
2045 | 2093 | } |
---|
.. | .. |
---|
2061 | 2109 | |
---|
2062 | 2110 | __bfs_init_root(&this, class); |
---|
2063 | 2111 | |
---|
2064 | | - raw_local_irq_save(flags); |
---|
| 2112 | + flags = lockdep_stage_disable(); |
---|
2065 | 2113 | lockdep_lock(); |
---|
2066 | 2114 | ret = __lockdep_count_backward_deps(&this); |
---|
2067 | 2115 | lockdep_unlock(); |
---|
2068 | | - raw_local_irq_restore(flags); |
---|
| 2116 | + lockdep_stage_restore(flags); |
---|
2069 | 2117 | |
---|
2070 | 2118 | return ret; |
---|
2071 | 2119 | } |
---|
.. | .. |
---|
4170 | 4218 | */ |
---|
4171 | 4219 | void lockdep_hardirqs_on_prepare(unsigned long ip) |
---|
4172 | 4220 | { |
---|
| 4221 | + unsigned long flags; |
---|
| 4222 | + |
---|
4173 | 4223 | if (unlikely(!debug_locks)) |
---|
4174 | 4224 | return; |
---|
4175 | 4225 | |
---|
.. | .. |
---|
4192 | 4242 | return; |
---|
4193 | 4243 | } |
---|
4194 | 4244 | |
---|
| 4245 | + flags = hard_cond_local_irq_save(); |
---|
| 4246 | + |
---|
4195 | 4247 | /* |
---|
4196 | 4248 | * We're enabling irqs and according to our state above irqs weren't |
---|
4197 | 4249 | * already enabled, yet we find the hardware thinks they are in fact |
---|
4198 | 4250 | * enabled.. someone messed up their IRQ state tracing. |
---|
4199 | 4251 | */ |
---|
4200 | | - if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
---|
4201 | | - return; |
---|
| 4252 | + if (DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())) |
---|
| 4253 | + goto out; |
---|
4202 | 4254 | |
---|
4203 | 4255 | /* |
---|
4204 | 4256 | * See the fine text that goes along with this variable definition. |
---|
4205 | 4257 | */ |
---|
4206 | 4258 | if (DEBUG_LOCKS_WARN_ON(early_boot_irqs_disabled)) |
---|
4207 | | - return; |
---|
| 4259 | + goto out; |
---|
4208 | 4260 | |
---|
4209 | 4261 | /* |
---|
4210 | 4262 | * Can't allow enabling interrupts while in an interrupt handler, |
---|
4211 | 4263 | * that's general bad form and such. Recursion, limited stack etc.. |
---|
4212 | 4264 | */ |
---|
4213 | | - if (DEBUG_LOCKS_WARN_ON(lockdep_hardirq_context())) |
---|
4214 | | - return; |
---|
| 4265 | + if (DEBUG_LOCKS_WARN_ON(running_inband() && lockdep_hardirq_context())) |
---|
| 4266 | + goto out; |
---|
4215 | 4267 | |
---|
4216 | 4268 | current->hardirq_chain_key = current->curr_chain_key; |
---|
4217 | 4269 | |
---|
4218 | 4270 | lockdep_recursion_inc(); |
---|
4219 | 4271 | __trace_hardirqs_on_caller(); |
---|
4220 | 4272 | lockdep_recursion_finish(); |
---|
| 4273 | +out: |
---|
| 4274 | + hard_cond_local_irq_restore(flags); |
---|
4221 | 4275 | } |
---|
4222 | 4276 | EXPORT_SYMBOL_GPL(lockdep_hardirqs_on_prepare); |
---|
4223 | 4277 | |
---|
4224 | 4278 | void noinstr lockdep_hardirqs_on(unsigned long ip) |
---|
4225 | 4279 | { |
---|
4226 | 4280 | struct irqtrace_events *trace = ¤t->irqtrace; |
---|
| 4281 | + unsigned long flags; |
---|
4227 | 4282 | |
---|
4228 | 4283 | if (unlikely(!debug_locks)) |
---|
4229 | 4284 | return; |
---|
.. | .. |
---|
4261 | 4316 | return; |
---|
4262 | 4317 | } |
---|
4263 | 4318 | |
---|
| 4319 | + flags = hard_cond_local_irq_save(); |
---|
| 4320 | + |
---|
4264 | 4321 | /* |
---|
4265 | 4322 | * We're enabling irqs and according to our state above irqs weren't |
---|
4266 | 4323 | * already enabled, yet we find the hardware thinks they are in fact |
---|
4267 | 4324 | * enabled.. someone messed up their IRQ state tracing. |
---|
4268 | 4325 | */ |
---|
4269 | | - if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
---|
4270 | | - return; |
---|
| 4326 | + if (DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())) |
---|
| 4327 | + goto out; |
---|
4271 | 4328 | |
---|
4272 | 4329 | /* |
---|
4273 | 4330 | * Ensure the lock stack remained unchanged between |
---|
.. | .. |
---|
4282 | 4339 | trace->hardirq_enable_ip = ip; |
---|
4283 | 4340 | trace->hardirq_enable_event = ++trace->irq_events; |
---|
4284 | 4341 | debug_atomic_inc(hardirqs_on_events); |
---|
| 4342 | +out: |
---|
| 4343 | + hard_cond_local_irq_restore(flags); |
---|
4285 | 4344 | } |
---|
4286 | 4345 | EXPORT_SYMBOL_GPL(lockdep_hardirqs_on); |
---|
4287 | 4346 | |
---|
.. | .. |
---|
4290 | 4349 | */ |
---|
4291 | 4350 | void noinstr lockdep_hardirqs_off(unsigned long ip) |
---|
4292 | 4351 | { |
---|
| 4352 | + unsigned long flags; |
---|
| 4353 | + |
---|
4293 | 4354 | if (unlikely(!debug_locks)) |
---|
4294 | 4355 | return; |
---|
4295 | 4356 | |
---|
.. | .. |
---|
4304 | 4365 | } else if (__this_cpu_read(lockdep_recursion)) |
---|
4305 | 4366 | return; |
---|
4306 | 4367 | |
---|
| 4368 | + flags = hard_cond_local_irq_save(); |
---|
| 4369 | + |
---|
4307 | 4370 | /* |
---|
4308 | 4371 | * So we're supposed to get called after you mask local IRQs, but for |
---|
4309 | 4372 | * some reason the hardware doesn't quite think you did a proper job. |
---|
4310 | 4373 | */ |
---|
4311 | | - if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
---|
4312 | | - return; |
---|
| 4374 | + if (DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())) |
---|
| 4375 | + goto out; |
---|
4313 | 4376 | |
---|
4314 | 4377 | if (lockdep_hardirqs_enabled()) { |
---|
4315 | 4378 | struct irqtrace_events *trace = ¤t->irqtrace; |
---|
.. | .. |
---|
4324 | 4387 | } else { |
---|
4325 | 4388 | debug_atomic_inc(redundant_hardirqs_off); |
---|
4326 | 4389 | } |
---|
| 4390 | +out: |
---|
| 4391 | + hard_cond_local_irq_restore(flags); |
---|
4327 | 4392 | } |
---|
4328 | 4393 | EXPORT_SYMBOL_GPL(lockdep_hardirqs_off); |
---|
4329 | 4394 | |
---|
.. | .. |
---|
4333 | 4398 | void lockdep_softirqs_on(unsigned long ip) |
---|
4334 | 4399 | { |
---|
4335 | 4400 | struct irqtrace_events *trace = ¤t->irqtrace; |
---|
| 4401 | + unsigned long flags; |
---|
4336 | 4402 | |
---|
4337 | 4403 | if (unlikely(!lockdep_enabled())) |
---|
4338 | 4404 | return; |
---|
| 4405 | + |
---|
| 4406 | + flags = hard_cond_local_irq_save(); |
---|
4339 | 4407 | |
---|
4340 | 4408 | /* |
---|
4341 | 4409 | * We fancy IRQs being disabled here, see softirq.c, avoids |
---|
4342 | 4410 | * funny state and nesting things. |
---|
4343 | 4411 | */ |
---|
4344 | | - if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
---|
4345 | | - return; |
---|
| 4412 | + if (DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())) |
---|
| 4413 | + goto out; |
---|
4346 | 4414 | |
---|
4347 | 4415 | if (current->softirqs_enabled) { |
---|
4348 | 4416 | debug_atomic_inc(redundant_softirqs_on); |
---|
4349 | | - return; |
---|
| 4417 | + goto out; |
---|
4350 | 4418 | } |
---|
4351 | 4419 | |
---|
4352 | 4420 | lockdep_recursion_inc(); |
---|
.. | .. |
---|
4365 | 4433 | if (lockdep_hardirqs_enabled()) |
---|
4366 | 4434 | mark_held_locks(current, LOCK_ENABLED_SOFTIRQ); |
---|
4367 | 4435 | lockdep_recursion_finish(); |
---|
| 4436 | +out: |
---|
| 4437 | + hard_cond_local_irq_restore(flags); |
---|
4368 | 4438 | } |
---|
4369 | 4439 | |
---|
4370 | 4440 | /* |
---|
.. | .. |
---|
4372 | 4442 | */ |
---|
4373 | 4443 | void lockdep_softirqs_off(unsigned long ip) |
---|
4374 | 4444 | { |
---|
| 4445 | + unsigned long flags; |
---|
| 4446 | + |
---|
4375 | 4447 | if (unlikely(!lockdep_enabled())) |
---|
4376 | 4448 | return; |
---|
| 4449 | + |
---|
| 4450 | + flags = hard_cond_local_irq_save(); |
---|
4377 | 4451 | |
---|
4378 | 4452 | /* |
---|
4379 | 4453 | * We fancy IRQs being disabled here, see softirq.c |
---|
4380 | 4454 | */ |
---|
4381 | | - if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
---|
4382 | | - return; |
---|
| 4455 | + if (DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())) |
---|
| 4456 | + goto out; |
---|
4383 | 4457 | |
---|
4384 | 4458 | if (current->softirqs_enabled) { |
---|
4385 | 4459 | struct irqtrace_events *trace = ¤t->irqtrace; |
---|
.. | .. |
---|
4397 | 4471 | DEBUG_LOCKS_WARN_ON(!softirq_count()); |
---|
4398 | 4472 | } else |
---|
4399 | 4473 | debug_atomic_inc(redundant_softirqs_off); |
---|
| 4474 | +out: |
---|
| 4475 | + hard_cond_local_irq_restore(flags); |
---|
4400 | 4476 | } |
---|
4401 | 4477 | |
---|
4402 | 4478 | static int |
---|
.. | .. |
---|
4751 | 4827 | if (DEBUG_LOCKS_WARN_ON(!lockdep_enabled())) |
---|
4752 | 4828 | return; |
---|
4753 | 4829 | |
---|
4754 | | - raw_local_irq_save(flags); |
---|
| 4830 | + flags = lockdep_stage_disable(); |
---|
4755 | 4831 | lockdep_recursion_inc(); |
---|
4756 | 4832 | register_lock_class(lock, subclass, 1); |
---|
4757 | 4833 | lockdep_recursion_finish(); |
---|
4758 | | - raw_local_irq_restore(flags); |
---|
| 4834 | + lockdep_stage_restore(flags); |
---|
4759 | 4835 | } |
---|
4760 | 4836 | } |
---|
4761 | 4837 | EXPORT_SYMBOL_GPL(lockdep_init_map_type); |
---|
.. | .. |
---|
5085 | 5161 | struct held_lock *hlock; |
---|
5086 | 5162 | int first_idx = idx; |
---|
5087 | 5163 | |
---|
5088 | | - if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
---|
| 5164 | + if (DEBUG_LOCKS_WARN_ON(!lockdep_stage_disabled())) |
---|
5089 | 5165 | return 0; |
---|
5090 | 5166 | |
---|
5091 | 5167 | for (hlock = curr->held_locks + idx; idx < depth; idx++, hlock++) { |
---|
.. | .. |
---|
5397 | 5473 | static noinstr void check_flags(unsigned long flags) |
---|
5398 | 5474 | { |
---|
5399 | 5475 | #if defined(CONFIG_PROVE_LOCKING) && defined(CONFIG_DEBUG_LOCKDEP) |
---|
5400 | | - if (!debug_locks) |
---|
| 5476 | + /* |
---|
| 5477 | + * irq_pipeline: we can't and don't want to check the |
---|
| 5478 | + * consistency of the irq tracer when running over the |
---|
| 5479 | + * pipeline entry or oob stage contexts, since the inband |
---|
| 5480 | + * stall bit does not reflect the current irq state there. |
---|
| 5481 | + */ |
---|
| 5482 | + if (on_pipeline_entry() || running_oob() || !debug_locks) |
---|
5401 | 5483 | return; |
---|
5402 | 5484 | |
---|
5403 | 5485 | /* Get the warning out.. */ |
---|
.. | .. |
---|
5444 | 5526 | if (unlikely(!lockdep_enabled())) |
---|
5445 | 5527 | return; |
---|
5446 | 5528 | |
---|
5447 | | - raw_local_irq_save(flags); |
---|
| 5529 | + flags = lockdep_stage_disable(); |
---|
5448 | 5530 | lockdep_recursion_inc(); |
---|
5449 | 5531 | check_flags(flags); |
---|
5450 | 5532 | if (__lock_set_class(lock, name, key, subclass, ip)) |
---|
5451 | 5533 | check_chain_key(current); |
---|
5452 | 5534 | lockdep_recursion_finish(); |
---|
5453 | | - raw_local_irq_restore(flags); |
---|
| 5535 | + lockdep_stage_restore(flags); |
---|
5454 | 5536 | } |
---|
5455 | 5537 | EXPORT_SYMBOL_GPL(lock_set_class); |
---|
5456 | 5538 | |
---|
.. | .. |
---|
5461 | 5543 | if (unlikely(!lockdep_enabled())) |
---|
5462 | 5544 | return; |
---|
5463 | 5545 | |
---|
5464 | | - raw_local_irq_save(flags); |
---|
| 5546 | + flags = lockdep_stage_disable(); |
---|
5465 | 5547 | lockdep_recursion_inc(); |
---|
5466 | 5548 | check_flags(flags); |
---|
5467 | 5549 | if (__lock_downgrade(lock, ip)) |
---|
5468 | 5550 | check_chain_key(current); |
---|
5469 | 5551 | lockdep_recursion_finish(); |
---|
5470 | | - raw_local_irq_restore(flags); |
---|
| 5552 | + lockdep_stage_restore(flags); |
---|
5471 | 5553 | } |
---|
5472 | 5554 | EXPORT_SYMBOL_GPL(lock_downgrade); |
---|
5473 | 5555 | |
---|
.. | .. |
---|
5532 | 5614 | struct lockdep_map *nest_lock, unsigned long ip) |
---|
5533 | 5615 | { |
---|
5534 | 5616 | unsigned long flags; |
---|
| 5617 | + int irqsoff; |
---|
5535 | 5618 | |
---|
5536 | 5619 | trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip); |
---|
5537 | 5620 | |
---|
.. | .. |
---|
5558 | 5641 | return; |
---|
5559 | 5642 | } |
---|
5560 | 5643 | |
---|
5561 | | - raw_local_irq_save(flags); |
---|
| 5644 | + flags = lockdep_stage_test_and_disable(&irqsoff); |
---|
5562 | 5645 | check_flags(flags); |
---|
5563 | 5646 | |
---|
5564 | 5647 | lockdep_recursion_inc(); |
---|
5565 | 5648 | __lock_acquire(lock, subclass, trylock, read, check, |
---|
5566 | | - irqs_disabled_flags(flags), nest_lock, ip, 0, 0); |
---|
| 5649 | + irqsoff, nest_lock, ip, 0, 0); |
---|
5567 | 5650 | lockdep_recursion_finish(); |
---|
5568 | | - raw_local_irq_restore(flags); |
---|
| 5651 | + lockdep_stage_restore(flags); |
---|
5569 | 5652 | } |
---|
5570 | 5653 | EXPORT_SYMBOL_GPL(lock_acquire); |
---|
5571 | 5654 | |
---|
.. | .. |
---|
5578 | 5661 | if (unlikely(!lockdep_enabled())) |
---|
5579 | 5662 | return; |
---|
5580 | 5663 | |
---|
5581 | | - raw_local_irq_save(flags); |
---|
| 5664 | + flags = lockdep_stage_disable(); |
---|
5582 | 5665 | check_flags(flags); |
---|
5583 | 5666 | |
---|
5584 | 5667 | lockdep_recursion_inc(); |
---|
5585 | 5668 | if (__lock_release(lock, ip)) |
---|
5586 | 5669 | check_chain_key(current); |
---|
5587 | 5670 | lockdep_recursion_finish(); |
---|
5588 | | - raw_local_irq_restore(flags); |
---|
| 5671 | + lockdep_stage_restore(flags); |
---|
5589 | 5672 | } |
---|
5590 | 5673 | EXPORT_SYMBOL_GPL(lock_release); |
---|
5591 | 5674 | |
---|
.. | .. |
---|
5597 | 5680 | if (unlikely(!lockdep_enabled())) |
---|
5598 | 5681 | return 1; /* avoid false negative lockdep_assert_held() */ |
---|
5599 | 5682 | |
---|
5600 | | - raw_local_irq_save(flags); |
---|
| 5683 | + flags = lockdep_stage_disable(); |
---|
5601 | 5684 | check_flags(flags); |
---|
5602 | 5685 | |
---|
5603 | 5686 | lockdep_recursion_inc(); |
---|
5604 | 5687 | ret = __lock_is_held(lock, read); |
---|
5605 | 5688 | lockdep_recursion_finish(); |
---|
5606 | | - raw_local_irq_restore(flags); |
---|
| 5689 | + lockdep_stage_restore(flags); |
---|
5607 | 5690 | |
---|
5608 | 5691 | return ret; |
---|
5609 | 5692 | } |
---|
.. | .. |
---|
5618 | 5701 | if (unlikely(!lockdep_enabled())) |
---|
5619 | 5702 | return cookie; |
---|
5620 | 5703 | |
---|
5621 | | - raw_local_irq_save(flags); |
---|
| 5704 | + flags = lockdep_stage_disable(); |
---|
5622 | 5705 | check_flags(flags); |
---|
5623 | 5706 | |
---|
5624 | 5707 | lockdep_recursion_inc(); |
---|
5625 | 5708 | cookie = __lock_pin_lock(lock); |
---|
5626 | 5709 | lockdep_recursion_finish(); |
---|
5627 | | - raw_local_irq_restore(flags); |
---|
| 5710 | + lockdep_stage_restore(flags); |
---|
5628 | 5711 | |
---|
5629 | 5712 | return cookie; |
---|
5630 | 5713 | } |
---|
.. | .. |
---|
5637 | 5720 | if (unlikely(!lockdep_enabled())) |
---|
5638 | 5721 | return; |
---|
5639 | 5722 | |
---|
5640 | | - raw_local_irq_save(flags); |
---|
| 5723 | + flags = lockdep_stage_disable(); |
---|
5641 | 5724 | check_flags(flags); |
---|
5642 | 5725 | |
---|
5643 | 5726 | lockdep_recursion_inc(); |
---|
5644 | 5727 | __lock_repin_lock(lock, cookie); |
---|
5645 | 5728 | lockdep_recursion_finish(); |
---|
5646 | | - raw_local_irq_restore(flags); |
---|
| 5729 | + lockdep_stage_restore(flags); |
---|
5647 | 5730 | } |
---|
5648 | 5731 | EXPORT_SYMBOL_GPL(lock_repin_lock); |
---|
5649 | 5732 | |
---|
.. | .. |
---|
5654 | 5737 | if (unlikely(!lockdep_enabled())) |
---|
5655 | 5738 | return; |
---|
5656 | 5739 | |
---|
5657 | | - raw_local_irq_save(flags); |
---|
| 5740 | + flags = lockdep_stage_disable(); |
---|
5658 | 5741 | check_flags(flags); |
---|
5659 | 5742 | |
---|
5660 | 5743 | lockdep_recursion_inc(); |
---|
5661 | 5744 | __lock_unpin_lock(lock, cookie); |
---|
5662 | 5745 | lockdep_recursion_finish(); |
---|
5663 | | - raw_local_irq_restore(flags); |
---|
| 5746 | + lockdep_stage_restore(flags); |
---|
5664 | 5747 | } |
---|
5665 | 5748 | EXPORT_SYMBOL_GPL(lock_unpin_lock); |
---|
5666 | 5749 | |
---|
.. | .. |
---|
5790 | 5873 | if (unlikely(!lock_stat || !lockdep_enabled())) |
---|
5791 | 5874 | return; |
---|
5792 | 5875 | |
---|
5793 | | - raw_local_irq_save(flags); |
---|
| 5876 | + flags = lockdep_stage_disable(); |
---|
5794 | 5877 | check_flags(flags); |
---|
5795 | 5878 | lockdep_recursion_inc(); |
---|
5796 | 5879 | __lock_contended(lock, ip); |
---|
5797 | 5880 | lockdep_recursion_finish(); |
---|
5798 | | - raw_local_irq_restore(flags); |
---|
| 5881 | + lockdep_stage_restore(flags); |
---|
5799 | 5882 | } |
---|
5800 | 5883 | EXPORT_SYMBOL_GPL(lock_contended); |
---|
5801 | 5884 | |
---|
.. | .. |
---|
5808 | 5891 | if (unlikely(!lock_stat || !lockdep_enabled())) |
---|
5809 | 5892 | return; |
---|
5810 | 5893 | |
---|
5811 | | - raw_local_irq_save(flags); |
---|
| 5894 | + flags = lockdep_stage_disable(); |
---|
5812 | 5895 | check_flags(flags); |
---|
5813 | 5896 | lockdep_recursion_inc(); |
---|
5814 | 5897 | __lock_acquired(lock, ip); |
---|
5815 | 5898 | lockdep_recursion_finish(); |
---|
5816 | | - raw_local_irq_restore(flags); |
---|
| 5899 | + lockdep_stage_restore(flags); |
---|
5817 | 5900 | } |
---|
5818 | 5901 | EXPORT_SYMBOL_GPL(lock_acquired); |
---|
5819 | 5902 | #endif |
---|
.. | .. |
---|
5828 | 5911 | unsigned long flags; |
---|
5829 | 5912 | int i; |
---|
5830 | 5913 | |
---|
5831 | | - raw_local_irq_save(flags); |
---|
| 5914 | + flags = lockdep_stage_disable(); |
---|
5832 | 5915 | lockdep_init_task(current); |
---|
5833 | 5916 | memset(current->held_locks, 0, MAX_LOCK_DEPTH*sizeof(struct held_lock)); |
---|
5834 | 5917 | nr_hardirq_chains = 0; |
---|
.. | .. |
---|
5837 | 5920 | debug_locks = 1; |
---|
5838 | 5921 | for (i = 0; i < CHAINHASH_SIZE; i++) |
---|
5839 | 5922 | INIT_HLIST_HEAD(chainhash_table + i); |
---|
5840 | | - raw_local_irq_restore(flags); |
---|
| 5923 | + lockdep_stage_restore(flags); |
---|
5841 | 5924 | } |
---|
5842 | 5925 | |
---|
5843 | 5926 | /* Remove a class from a lock chain. Must be called with the graph lock held. */ |
---|
.. | .. |
---|
6014 | 6097 | if (WARN_ON_ONCE(ch != &delayed_free.rcu_head)) |
---|
6015 | 6098 | return; |
---|
6016 | 6099 | |
---|
6017 | | - raw_local_irq_save(flags); |
---|
| 6100 | + flags = lockdep_stage_disable(); |
---|
6018 | 6101 | lockdep_lock(); |
---|
6019 | 6102 | |
---|
6020 | 6103 | /* closed head */ |
---|
.. | .. |
---|
6028 | 6111 | call_rcu_zapped(delayed_free.pf + delayed_free.index); |
---|
6029 | 6112 | |
---|
6030 | 6113 | lockdep_unlock(); |
---|
6031 | | - raw_local_irq_restore(flags); |
---|
| 6114 | + lockdep_stage_restore(flags); |
---|
6032 | 6115 | } |
---|
6033 | 6116 | |
---|
6034 | 6117 | /* |
---|
.. | .. |
---|
6071 | 6154 | |
---|
6072 | 6155 | init_data_structures_once(); |
---|
6073 | 6156 | |
---|
6074 | | - raw_local_irq_save(flags); |
---|
| 6157 | + flags = lockdep_stage_disable(); |
---|
6075 | 6158 | lockdep_lock(); |
---|
6076 | 6159 | pf = get_pending_free(); |
---|
6077 | 6160 | __lockdep_free_key_range(pf, start, size); |
---|
6078 | 6161 | call_rcu_zapped(pf); |
---|
6079 | 6162 | lockdep_unlock(); |
---|
6080 | | - raw_local_irq_restore(flags); |
---|
| 6163 | + lockdep_stage_restore(flags); |
---|
6081 | 6164 | |
---|
6082 | 6165 | /* |
---|
6083 | 6166 | * Wait for any possible iterators from look_up_lock_class() to pass |
---|
.. | .. |
---|
6097 | 6180 | |
---|
6098 | 6181 | init_data_structures_once(); |
---|
6099 | 6182 | |
---|
6100 | | - raw_local_irq_save(flags); |
---|
| 6183 | + flags = lockdep_stage_disable(); |
---|
6101 | 6184 | lockdep_lock(); |
---|
6102 | 6185 | __lockdep_free_key_range(pf, start, size); |
---|
6103 | 6186 | __free_zapped_classes(pf); |
---|
6104 | 6187 | lockdep_unlock(); |
---|
6105 | | - raw_local_irq_restore(flags); |
---|
| 6188 | + lockdep_stage_restore(flags); |
---|
6106 | 6189 | } |
---|
6107 | 6190 | |
---|
6108 | 6191 | void lockdep_free_key_range(void *start, unsigned long size) |
---|
.. | .. |
---|
6173 | 6256 | unsigned long flags; |
---|
6174 | 6257 | int locked; |
---|
6175 | 6258 | |
---|
6176 | | - raw_local_irq_save(flags); |
---|
| 6259 | + flags = lockdep_stage_disable(); |
---|
6177 | 6260 | locked = graph_lock(); |
---|
6178 | 6261 | if (!locked) |
---|
6179 | 6262 | goto out_irq; |
---|
.. | .. |
---|
6184 | 6267 | |
---|
6185 | 6268 | graph_unlock(); |
---|
6186 | 6269 | out_irq: |
---|
6187 | | - raw_local_irq_restore(flags); |
---|
| 6270 | + lockdep_stage_restore(flags); |
---|
6188 | 6271 | } |
---|
6189 | 6272 | |
---|
6190 | 6273 | /* |
---|
.. | .. |
---|
6196 | 6279 | struct pending_free *pf = delayed_free.pf; |
---|
6197 | 6280 | unsigned long flags; |
---|
6198 | 6281 | |
---|
6199 | | - raw_local_irq_save(flags); |
---|
| 6282 | + flags = lockdep_stage_disable(); |
---|
6200 | 6283 | lockdep_lock(); |
---|
6201 | 6284 | __lockdep_reset_lock(pf, lock); |
---|
6202 | 6285 | __free_zapped_classes(pf); |
---|
6203 | 6286 | lockdep_unlock(); |
---|
6204 | | - raw_local_irq_restore(flags); |
---|
| 6287 | + lockdep_stage_restore(flags); |
---|
6205 | 6288 | } |
---|
6206 | 6289 | |
---|
6207 | 6290 | void lockdep_reset_lock(struct lockdep_map *lock) |
---|
.. | .. |
---|
6234 | 6317 | if (WARN_ON_ONCE(static_obj(key))) |
---|
6235 | 6318 | return; |
---|
6236 | 6319 | |
---|
6237 | | - raw_local_irq_save(flags); |
---|
| 6320 | + flags = lockdep_stage_disable(); |
---|
6238 | 6321 | lockdep_lock(); |
---|
6239 | 6322 | |
---|
6240 | 6323 | hlist_for_each_entry_rcu(k, hash_head, hash_entry) { |
---|
.. | .. |
---|
6251 | 6334 | call_rcu_zapped(pf); |
---|
6252 | 6335 | } |
---|
6253 | 6336 | lockdep_unlock(); |
---|
6254 | | - raw_local_irq_restore(flags); |
---|
| 6337 | + lockdep_stage_restore(flags); |
---|
6255 | 6338 | |
---|
6256 | 6339 | /* Wait until is_dynamic_key() has finished accessing k->hash_entry. */ |
---|
6257 | 6340 | synchronize_rcu(); |
---|
.. | .. |
---|
6342 | 6425 | if (unlikely(!debug_locks)) |
---|
6343 | 6426 | return; |
---|
6344 | 6427 | |
---|
6345 | | - raw_local_irq_save(flags); |
---|
| 6428 | + flags = lockdep_stage_disable(); |
---|
6346 | 6429 | for (i = 0; i < curr->lockdep_depth; i++) { |
---|
6347 | 6430 | hlock = curr->held_locks + i; |
---|
6348 | 6431 | |
---|
.. | .. |
---|
6353 | 6436 | print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock); |
---|
6354 | 6437 | break; |
---|
6355 | 6438 | } |
---|
6356 | | - raw_local_irq_restore(flags); |
---|
| 6439 | + lockdep_stage_restore(flags); |
---|
6357 | 6440 | } |
---|
6358 | 6441 | EXPORT_SYMBOL_GPL(debug_check_no_locks_freed); |
---|
6359 | 6442 | |
---|