Skip to contentSkip to conversation

lockdep: Do not record irq state in debug_check_no_locks_freed()

PATCH Superseded Steven Rostedt 2 participants 3 messages Apr 4, 2018 Locking primitives

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lockdep: Do not record irq state in debug_check_no_locks_freed()

From: Steven Rostedt (VMware) <[email protected]>

While debugging where things were going wrong with mapping enabling/disabling interrupts with the lockdep state and actual real enabling and disabling interrupts, I had to silent the irq disabling/enabling in debug_check_no_locks_freed() because it was always showing up as it was called before the splat was.

Use raw_local_irq_save/restore() for debug_check_no_locks_freed() as it hides useful information about where interrupts were used incorrectly last.

---

kernel/locking/lockdep.c +2 -2
index 89b5f83f1969..8c145dc1315b 100644
@@ -4407,7 +4407,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
 	if (unlikely(!debug_locks))
 		return;
 
-	local_irq_save(flags);
+	raw_local_irq_save(flags);
 	for (i = 0; i < curr->lockdep_depth; i++) {
 		hlock = curr->held_locks + i;
 
@@ -4418,7 +4418,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
 		print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock);
 		break;
 	}
-	local_irq_restore(flags);
+	raw_local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
 
maintainer
#1 lore raw
Quoted 28 lines · Steven Rostedt

From: Steven Rostedt (VMware) <[email protected]>

While debugging where things were going wrong with mapping enabling/disabling interrupts with the lockdep state and actual real enabling and disabling interrupts, I had to silent the irq disabling/enabling in debug_check_no_locks_freed() because it was always showing up as it was called before the splat was.

Use raw_local_irq_save/restore() for debug_check_no_locks_freed() as it hides useful information about where interrupts were used incorrectly last.

---

kernel/locking/lockdep.c +1 -1
index 89b5f83f1969..8c145dc1315b 100644
@@ -4407,7 +4407,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
 	if (unlikely(!debug_locks))
 		return;
 
-	local_irq_save(flags);
+	raw_local_irq_save(flags);
 	for (i = 0; i < curr->lockdep_depth; i++) {
 		hlock = curr->held_locks + i;
 

kernel/locking/lockdep.c void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len) · line 4423

Quoted 7 lines
kernel/locking/lockdep.c +1 -1
@@ -4418,7 +4418,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len)
 		print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock);
 		break;
 	}
-	local_irq_restore(flags);
+	raw_local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);

Makes sense, could you convert all of them just to make sure there aren't any left?

#2 lore raw
Quoted 3 lines · On Wed, 4 Apr 2018 18:23:05 +0200 Peter Zijlstra <[email protected]> wrote:

Makes sense, could you convert all of them just to make sure there aren't any left?

There's a few others. I'll send another patch.

-- Steve