Skip to contentSkip to conversation

lockdep for v2.6.24

GIT PULL New Peter Zijlstra 3 participants 5 messages Oct 15, 2007 – Oct 16, 2007

Subsystems (3)
lore
Share & tools
lore

Peter Zijlstra

author maintainer
#0 lore raw

Linus,

please pull the lockdep tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git v2.6.24-lockdep

Ingo suggested to add me to the MAINTAINERS file for lockdep/lockstat.

The rest of the pull contains a few fixes, a few annotations and a new 'feature'. The new thing is ensuring we don't hold any locks when returning to userspace. This will give a much earlier warning about imbalanced lock acquisitions.

Peter

---
Gregory Haskins (1):
lockdep: fix mismatched lockdep_depth/curr_chain_hash

Heiko Carstens (1):
lockdep: s390: connect the sysexit hook

Peter Zijlstra (10):
lockdep: maintainers
lockdep: fixup mutex annotations
lockdep: syscall exit check
lockdep: i386: connect the sysexit hook
lockdep: x86_64: connect the sysexit hook
lockdep: annotate journal_start()
lockdep: annotate rcu_read_{,un}lock{,_bh}
lockdep: annotate kprobes irq fiddling
lockdep: per filesystem inode lock class
lockdep: annotate dir vs file i_mutex

Tim Pepper (1):
lockdep: Avoid /proc/lockdep & lock_stat infinite output

 MAINTAINERS                   |    9 ++++++
 arch/s390/kernel/entry.S      |   12 ++++++++
 arch/s390/kernel/entry64.S    |    9 ++++++
 arch/x86/kernel/entry_32.S    |    4 +++
 arch/x86/kernel/entry_64.S    |   23 +++++++--------
 arch/x86/kernel/kprobes_32.c  |    7 +++++
 arch/x86/kernel/kprobes_64.c  |    7 +++++
 arch/x86/lib/thunk_64.S       |    4 +++
 fs/inode.c                    |   24 ++++++++++++++--
 fs/jbd/transaction.c          |    9 ++++++
 include/asm-x86/irqflags_32.h |   13 +++++++++
 include/asm-x86/irqflags_64.h |   14 +++++++++
 include/linux/fs.h            |    6 ++++
 include/linux/jbd.h           |    5 +++
 include/linux/lockdep.h       |    9 ++++++
 include/linux/mutex.h         |    9 ++++--
 include/linux/rcupdate.h      |   14 +++++++++
 kernel/lockdep.c              |   26 ++++++++++++++---
 kernel/lockdep_proc.c         |   61 ++++++++++++++++++++++++++++-------------
 kernel/mutex.c                |   35 +++++++++++++----------
 kernel/rcupdate.c             |    8 +++++
 21 files changed, 251 insertions(+), 57 deletions(-)
#1 lore raw
Quoted 4 lines · Peter Zijlstra

please pull the lockdep tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git v2.6.24-lockdep

Hmm. I'm now getting

	WARNING: at kernel/lockdep.c:700 look_up_lock_class()
	
	Call Trace:
	 [<ffffffff8105562a>] __lock_acquire+0x15f/0xc92
	 [<ffffffff810a5804>] do_lookup+0x83/0x1b0
	 [<ffffffff8105654a>] lock_acquire+0x5a/0x73
	 [<ffffffff810a5804>] do_lookup+0x83/0x1b0
	 [<ffffffff81052b59>] debug_mutex_lock_common+0x16/0x23
	 [<ffffffff81347d26>] mutex_lock_nested+0x10c/0x2b0
	 [<ffffffff810a5804>] do_lookup+0x83/0x1b0
	 [<ffffffff810a7b89>] __link_path_walk+0x924/0xde9
	 [<ffffffff810a80a6>] link_path_walk+0x58/0xe0
	 [<ffffffff81348ef6>] _spin_unlock+0x17/0x20
	 [<ffffffff8109cc31>] get_unused_fd_flags+0x115/0x126
	 [<ffffffff810a8432>] do_path_lookup+0x1ae/0x229
	 [<ffffffff810a8e3d>] __path_lookup_intent_open+0x56/0x96
	 [<ffffffff810a8fe0>] open_namei+0x7d/0x66c
	 [<ffffffff8109ce9f>] do_filp_open+0x1c/0x38
	 [<ffffffff81348ef6>] _spin_unlock+0x17/0x20
	 [<ffffffff8109cc31>] get_unused_fd_flags+0x115/0x126
	 [<ffffffff8109cf01>] do_sys_open+0x46/0xc3
	 [<ffffffff8100bc3e>] system_call+0x7e/0x83

which seems to be new..

Linus

#2 lore raw

PATCH 1/1 lockdep: fixup the inode dir annotation

Quoted 8 lines · Linus Torvalds
Quoted 4 lines

please pull the lockdep tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git
v2.6.24-lockdep

Hmm. I'm now getting

	WARNING: at kernel/lockdep.c:700 look_up_lock_class()

it triggered here too - the patch from Peter below was tested overnight and seems to do the trick for me.

Ingo

--------------------->
Subject: lockdep: fixup the inode dir annotation

A slight oversight tripped lockdep debugging code, each lockdep class should have but a single init site.

Rearange the code to make this true.

---
 fs/inode.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
fs/inode.c +9 -9
Index: linux/fs/inode.c
===================================================================
@@ -568,16 +568,16 @@ EXPORT_SYMBOL(new_inode);
 void unlock_new_inode(struct inode *inode)
 {
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
-	struct file_system_type *type = inode->i_sb->s_type;
-	/*
-	 * ensure nobody is actually holding i_mutex
-	 */
-	mutex_destroy(&inode->i_mutex);
-	mutex_init(&inode->i_mutex);
-	if (inode->i_mode & S_IFDIR)
+	if (inode->i_mode & S_IFDIR) {
+		struct file_system_type *type = inode->i_sb->s_type;
+
+		/*
+		 * ensure nobody is actually holding i_mutex
+		 */
+		mutex_destroy(&inode->i_mutex);
+		mutex_init(&inode->i_mutex);
 		lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key);
-	else
-		lockdep_set_class(&inode->i_mutex, &type->i_mutex_key);
+	}
 #endif
 	/*
 	 * This is special!  We do not need the spinlock
author maintainer
#3 lore raw
In reply to Linus Torvalds
Quoted 32 lines · Linus Torvalds
Quoted 4 lines · Peter Zijlstra

please pull the lockdep tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git v2.6.24-lockdep

Hmm. I'm now getting

	WARNING: at kernel/lockdep.c:700 look_up_lock_class()
	
	Call Trace:
	 [<ffffffff8105562a>] __lock_acquire+0x15f/0xc92
	 [<ffffffff810a5804>] do_lookup+0x83/0x1b0
	 [<ffffffff8105654a>] lock_acquire+0x5a/0x73
	 [<ffffffff810a5804>] do_lookup+0x83/0x1b0
	 [<ffffffff81052b59>] debug_mutex_lock_common+0x16/0x23
	 [<ffffffff81347d26>] mutex_lock_nested+0x10c/0x2b0
	 [<ffffffff810a5804>] do_lookup+0x83/0x1b0
	 [<ffffffff810a7b89>] __link_path_walk+0x924/0xde9
	 [<ffffffff810a80a6>] link_path_walk+0x58/0xe0
	 [<ffffffff81348ef6>] _spin_unlock+0x17/0x20
	 [<ffffffff8109cc31>] get_unused_fd_flags+0x115/0x126
	 [<ffffffff810a8432>] do_path_lookup+0x1ae/0x229
	 [<ffffffff810a8e3d>] __path_lookup_intent_open+0x56/0x96
	 [<ffffffff810a8fe0>] open_namei+0x7d/0x66c
	 [<ffffffff8109ce9f>] do_filp_open+0x1c/0x38
	 [<ffffffff81348ef6>] _spin_unlock+0x17/0x20
	 [<ffffffff8109cc31>] get_unused_fd_flags+0x115/0x126
	 [<ffffffff8109cf01>] do_sys_open+0x46/0xc3
	 [<ffffffff8100bc3e>] system_call+0x7e/0x83
Quoted 1 line

which seems to be new..

Yeah, Ingo just told me about that too :-(

Seems I dropped a patch in my test runs.. Anyway, pushed a fix into the above tree.

author maintainer
#4 lore raw
In reply to Linus Torvalds

Linus,

please re-pull

git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git v2.6.24-lockdep

[ I just commited the two new patches to the end of the branch you
pulled before, and assumed git will be smart enough to not try and again merge the patches you pulled before ]

in order to receive:

Peter Zijlstra (2):
lockdep: fixup the inode dir annotation
lockdep: fix fault vs irq tracing

 arch/x86/mm/fault_32.c |   10 ++++++++++
 arch/x86/mm/fault_64.c |   10 ++++++++++
 fs/inode.c             |   18 +++++++++---------
 3 files changed, 29 insertions(+), 9 deletions(-)
arch/x86/mm/fault_32.c +10 -0
index fcb38e7..c0cba93 100644
@@ -308,6 +308,16 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
 	int write, si_code;
 	int fault;
 
+#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
+	/*
+	 * We can fault from pretty much anywhere, fix up the IRQ state.
+	 */
+	if (raw_irqs_disabled())
+		trace_hardirqs_off();
+	else
+		trace_hardirqs_on();
+#endif
+
 	/* get the address */
         address = read_cr2();
 
arch/x86/mm/fault_64.c +10 -0
index 54816ad..162bddd 100644
@@ -311,6 +311,16 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
 	unsigned long flags;
 	siginfo_t info;
 
+#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
+	/*
+	 * We can fault from pretty much anywhere, fix up the IRQ state.
+	 */
+	if (raw_irqs_disabled())
+		trace_hardirqs_off();
+	else
+		trace_hardirqs_on();
+#endif
+
 	tsk = current;
 	mm = tsk->mm;
 	prefetchw(&mm->mmap_sem);
fs/inode.c +9 -9
index f97de0a..21dab18 100644
@@ -568,16 +568,16 @@ EXPORT_SYMBOL(new_inode);
 void unlock_new_inode(struct inode *inode)
 {
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
-	struct file_system_type *type = inode->i_sb->s_type;
-	/*
-	 * ensure nobody is actually holding i_mutex
-	 */
-	mutex_destroy(&inode->i_mutex);
-	mutex_init(&inode->i_mutex);
-	if (inode->i_mode & S_IFDIR)
+	if (inode->i_mode & S_IFDIR) {
+		struct file_system_type *type = inode->i_sb->s_type;
+
+		/*
+		 * ensure nobody is actually holding i_mutex
+		 */
+		mutex_destroy(&inode->i_mutex);
+		mutex_init(&inode->i_mutex);
 		lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key);
-	else
-		lockdep_set_class(&inode->i_mutex, &type->i_mutex_key);
+	}
 #endif
 	/*
 	 * This is special!  We do not need the spinlock