1 From foo@baz Wed Aug 22 10:28:26 CEST 2018
2 From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
3 Date: Wed, 4 Apr 2018 14:06:30 -0400
4 Subject: locking/lockdep: Do not record IRQ state within lockdep code
6 From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
8 [ Upstream commit fcc784be837714a9173b372ff9fb9b514590dad9 ]
10 While debugging where things were going wrong with mapping
11 enabling/disabling interrupts with the lockdep state and actual real
12 enabling and disabling interrupts, I had to silent the IRQ
13 disabling/enabling in debug_check_no_locks_freed() because it was
14 always showing up as it was called before the splat was.
16 Use raw_local_irq_save/restore() for not only debug_check_no_locks_freed()
17 but for all internal lockdep functions, as they hide useful information
18 about where interrupts were used incorrectly last.
20 Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
21 Cc: Andrew Morton <akpm@linux-foundation.org>
22 Cc: Linus Torvalds <torvalds@linux-foundation.org>
23 Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
24 Cc: Peter Zijlstra <peterz@infradead.org>
25 Cc: Thomas Gleixner <tglx@linutronix.de>
26 Cc: Will Deacon <will.deacon@arm.com>
27 Link: https://lkml.kernel.org/lkml/20180404140630.3f4f4c7a@gandalf.local.home
28 Signed-off-by: Ingo Molnar <mingo@kernel.org>
29 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
30 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32 kernel/locking/lockdep.c | 12 ++++++------
33 1 file changed, 6 insertions(+), 6 deletions(-)
35 --- a/kernel/locking/lockdep.c
36 +++ b/kernel/locking/lockdep.c
37 @@ -1264,11 +1264,11 @@ unsigned long lockdep_count_forward_deps
41 - local_irq_save(flags);
42 + raw_local_irq_save(flags);
43 arch_spin_lock(&lockdep_lock);
44 ret = __lockdep_count_forward_deps(&this);
45 arch_spin_unlock(&lockdep_lock);
46 - local_irq_restore(flags);
47 + raw_local_irq_restore(flags);
51 @@ -1291,11 +1291,11 @@ unsigned long lockdep_count_backward_dep
55 - local_irq_save(flags);
56 + raw_local_irq_save(flags);
57 arch_spin_lock(&lockdep_lock);
58 ret = __lockdep_count_backward_deps(&this);
59 arch_spin_unlock(&lockdep_lock);
60 - local_irq_restore(flags);
61 + raw_local_irq_restore(flags);
65 @@ -4123,7 +4123,7 @@ void debug_check_no_locks_freed(const vo
66 if (unlikely(!debug_locks))
69 - local_irq_save(flags);
70 + raw_local_irq_save(flags);
71 for (i = 0; i < curr->lockdep_depth; i++) {
72 hlock = curr->held_locks + i;
74 @@ -4134,7 +4134,7 @@ void debug_check_no_locks_freed(const vo
75 print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock);
78 - local_irq_restore(flags);
79 + raw_local_irq_restore(flags);
81 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);