]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/locking-lockdep-do-not-record-irq-state-within-lockdep-code.patch
Linux 4.9.124
[thirdparty/kernel/stable-queue.git] / queue-4.4 / locking-lockdep-do-not-record-irq-state-within-lockdep-code.patch
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
5
6 From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
7
8 [ Upstream commit fcc784be837714a9173b372ff9fb9b514590dad9 ]
9
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.
15
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.
19
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>
31 ---
32 kernel/locking/lockdep.c | 12 ++++++------
33 1 file changed, 6 insertions(+), 6 deletions(-)
34
35 --- a/kernel/locking/lockdep.c
36 +++ b/kernel/locking/lockdep.c
37 @@ -1264,11 +1264,11 @@ unsigned long lockdep_count_forward_deps
38 this.parent = NULL;
39 this.class = class;
40
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);
48
49 return ret;
50 }
51 @@ -1291,11 +1291,11 @@ unsigned long lockdep_count_backward_dep
52 this.parent = NULL;
53 this.class = class;
54
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);
62
63 return ret;
64 }
65 @@ -4123,7 +4123,7 @@ void debug_check_no_locks_freed(const vo
66 if (unlikely(!debug_locks))
67 return;
68
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;
73
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);
76 break;
77 }
78 - local_irq_restore(flags);
79 + raw_local_irq_restore(flags);
80 }
81 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
82