Skip to contentSkip to conversation

lockdep: Fix lockdep_no_validate against IRQ states

tip:core/locking tip-bot for Peter Zijlstra 2 participants 3 messages Jul 21, 2011 – Jul 29, 2011

lore
Share & tools
lore
#0 lore raw
Commit-ID:  efbe2eee6dc0f179be84292bf269528b3ec365e9
Gitweb:     http://git.kernel.org/tip/efbe2eee6dc0f179be84292bf269528b3ec365e9
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Thu, 7 Jul 2011 11:39:45 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 21 Jul 2011 20:43:16 +0200

lockdep: Fix lockdep_no_validate against IRQ states

Thomas noticed that a lock marked with lockdep_set_novalidate_class() will still trigger warnings for IRQ inversions. Cure this by skipping those when marking irq state.

---
 kernel/lockdep.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/lockdep.c +3 -0
index 298c927..628276d 100644
@@ -2468,6 +2468,9 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)
 
 		BUG_ON(usage_bit >= LOCK_USAGE_STATES);
 
+		if (hlock_class(hlock)->key == &__lockdep_no_validate__)
+			continue;
+
 		if (!mark_lock(curr, hlock, usage_bit))
 			return 0;
 	}
#1 lore raw
Quoted 26 lines · tip-bot for Peter Zijlstra
Commit-ID:  efbe2eee6dc0f179be84292bf269528b3ec365e9
Gitweb:     http://git.kernel.org/tip/efbe2eee6dc0f179be84292bf269528b3ec365e9
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Thu, 7 Jul 2011 11:39:45 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 21 Jul 2011 20:43:16 +0200

lockdep: Fix lockdep_no_validate against IRQ states

Thomas noticed that a lock marked with lockdep_set_novalidate_class() will still trigger warnings for IRQ inversions. Cure this by skipping those when marking irq state.

---
 kernel/lockdep.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
kernel/lockdep.c +0 -0
index 298c927..628276d 100644

kernel/lockdep.c mark_held_locks(struct task_struct *curr, enum mark_type mark) · line 2473

Quoted 6 lines
kernel/lockdep.c +3 -0
@@ -2468,6 +2468,9 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)
 
 		BUG_ON(usage_bit >= LOCK_USAGE_STATES);
 
+		if (hlock_class(hlock)->key == &__lockdep_no_validate__)
+			continue;
+

The 2 pointers are not the same type.

kernel/lockdep.c: In function 'mark_held_locks':
kernel/lockdep.c:2471:31: warning: comparison of distinct pointer types lacks a cast

Quoted 3 lines
kernel/lockdep.c +0 -0
 		if (!mark_lock(curr, hlock, usage_bit))
 			return 0;
 	}
#2 lore raw
Quoted 10 lines · Li Zefan
Quoted 1 line

+ if (hlock_class(hlock)->key ==

&__lockdep_no_validate__)

kernel/lockdep.c mark_held_locks(struct task_struct *curr, enum mark_type mark) · line 2473

Quoted 2 lines
kernel/lockdep.c +2 -0
+                     continue;
+

The 2 pointers are not the same type.

kernel/lockdep.c: In function 'mark_held_locks':
kernel/lockdep.c:2471:31: warning: comparison of distinct pointer types lacks a cast

Yeah, I know, I've even got a fix queued up.. Thanks though.