All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
@ 2006-09-26 14:44 Atsushi Nemoto
  2006-09-26 15:16 ` Atsushi Nemoto
  2006-09-26 15:58 ` Franck Bui-Huu
  0 siblings, 2 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2006-09-26 14:44 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf, mingo

Implement stacktrace interface by using unwind_stack().
And enable lockdep support.

This is a patch againt linux-mips.org git tree.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

 arch/mips/Kconfig             |    8 ++
 arch/mips/kernel/Makefile     |    1 
 arch/mips/kernel/process.c    |    1 
 arch/mips/kernel/stacktrace.c |  113 ++++++++++++++++++++++++++++++++++++++++++
 arch/mips/kernel/traps.c      |   37 +------------
 include/asm-mips/stacktrace.h |   44 ++++++++++++++++
 6 files changed, 170 insertions(+), 34 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 929b9b4..c8bcf0e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1836,6 +1836,14 @@ config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
 
+config LOCKDEP_SUPPORT
+	bool
+	default y
+
+config STACKTRACE_SUPPORT
+	bool
+	default y
+
 source "init/Kconfig"
 
 menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 881c467..cd9cec9 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -11,6 +11,7 @@ obj-y		+= cpu-probe.o branch.o entry.o g
 binfmt_irix-objs	:= irixelf.o irixinv.o irixioctl.o irixsig.o	\
 			   irix5sys.o sysirix.o
 
+obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-$(CONFIG_MODULES)		+= mips_ksyms.o module.o
 
 obj-$(CONFIG_APM)		+= apm.o
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 951bf9c..277fdce 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -40,6 +40,7 @@ #include <asm/io.h>
 #include <asm/elf.h>
 #include <asm/isadep.h>
 #include <asm/inst.h>
+#include <asm/stacktrace.h>
 #ifdef CONFIG_MIPS_MT_SMTC
 #include <asm/mipsmtregs.h>
 extern void smtc_idle_loop_hook(void);
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
new file mode 100644
index 0000000..c258088
--- /dev/null
+++ b/arch/mips/kernel/stacktrace.c
@@ -0,0 +1,113 @@
+/*
+ * arch/mips/kernel/stacktrace.c
+ *
+ * Stack trace management functions
+ *
+ *  Copyright (C) 2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
+ */
+#include <linux/sched.h>
+#include <linux/stacktrace.h>
+#include <asm/stacktrace.h>
+
+/*
+ * Save stack-backtrace addresses into a stack_trace buffer:
+ */
+static inline void
+save_raw_context_stack(struct stack_trace *trace, unsigned int skip,
+		       unsigned long reg29)
+{
+	unsigned long *sp = (unsigned long *)reg29;
+	unsigned long addr;
+
+	while (!kstack_end(sp)) {
+		addr = *sp++;
+		if (__kernel_text_address(addr)) {
+			if (!skip)
+				trace->entries[trace->nr_entries++] = addr;
+			else
+				skip--;
+			if (trace->nr_entries >= trace->max_entries)
+				break;
+		}
+	}
+}
+
+static inline struct pt_regs *
+save_context_stack(struct stack_trace *trace, unsigned int skip,
+		   struct task_struct *task, struct pt_regs *regs)
+{
+	unsigned long sp = regs->regs[29];
+#ifdef CONFIG_KALLSYMS
+	unsigned long ra = regs->regs[31];
+	unsigned long pc = regs->cp0_epc;
+	extern void ret_from_irq(void);
+
+	if (raw_show_trace || !__kernel_text_address(pc)) {
+		save_raw_context_stack(trace, skip, sp);
+		return NULL;
+	}
+	do {
+		if (!skip)
+			trace->entries[trace->nr_entries++] = pc;
+		else
+			skip--;
+		if (trace->nr_entries >= trace->max_entries)
+			break;
+		/*
+		 * If we reached the bottom of interrupt context,
+		 * return saved pt_regs.
+		 */
+		if (pc == (unsigned long)ret_from_irq) {
+			unsigned long stack_page =
+				(unsigned long)task_stack_page(task);
+			if (!stack_page ||
+			    sp < stack_page ||
+			    sp > stack_page + THREAD_SIZE - 32)
+				break;
+			return (struct pt_regs *)sp;
+		}
+		pc = unwind_stack(task, &sp, pc, ra);
+		ra = 0;
+	} while (pc);
+#else
+	save_raw_context_stack(sp);
+#endif
+
+	return NULL;
+}
+
+/*
+ * Save stack-backtrace addresses into a stack_trace buffer.
+ * If all_contexts is set, all contexts (hardirq, softirq and process)
+ * are saved. If not set then only the current context is saved.
+ */
+void save_stack_trace(struct stack_trace *trace,
+		      struct task_struct *task, int all_contexts,
+		      unsigned int skip)
+{
+	struct pt_regs dummyregs;
+	struct pt_regs *regs = &dummyregs;
+
+	WARN_ON(trace->nr_entries || !trace->max_entries);
+
+	if (task && task != current) {
+		regs->regs[29] = task->thread.reg29;
+		regs->regs[31] = 0;
+		regs->cp0_epc = task->thread.reg31;
+	} else {
+		if (!task)
+			task = current;
+		prepare_frametrace(regs);
+	}
+
+	while (1) {
+		regs = save_context_stack(trace, skip, task, regs);
+		if (!all_contexts || !regs ||
+		    trace->nr_entries >= trace->max_entries)
+			break;
+		trace->entries[trace->nr_entries++] = ULONG_MAX;
+		if (trace->nr_entries >= trace->max_entries)
+			break;
+		skip = 0;
+	}
+}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index e51d8fd..440b865 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -41,6 +41,7 @@ #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/watch.h>
 #include <asm/types.h>
+#include <asm/stacktrace.h>
 
 extern asmlinkage void handle_int(void);
 extern asmlinkage void handle_tlbm(void);
@@ -92,16 +93,14 @@ #endif
 }
 
 #ifdef CONFIG_KALLSYMS
-static int raw_show_trace;
+int raw_show_trace;
 static int __init set_raw_show_trace(char *str)
 {
 	raw_show_trace = 1;
 	return 1;
 }
 __setup("raw_show_trace", set_raw_show_trace);
-
-extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
-				  unsigned long pc, unsigned long ra);
+#endif
 
 static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
 {
@@ -121,9 +120,6 @@ static void show_backtrace(struct task_s
 	} while (pc);
 	printk("\n");
 }
-#else
-#define show_backtrace(task, r) show_raw_backtrace((r)->regs[29]);
-#endif
 
 /*
  * This routine abuses get_user()/put_user() to reference pointers
@@ -158,28 +154,6 @@ static void show_stacktrace(struct task_
 	show_backtrace(task, regs);
 }
 
-static __always_inline void prepare_frametrace(struct pt_regs *regs)
-{
-	__asm__ __volatile__(
-		".set push\n\t"
-		".set noat\n\t"
-#ifdef CONFIG_64BIT
-		"1: dla $1, 1b\n\t"
-		"sd $1, %0\n\t"
-		"sd $29, %1\n\t"
-		"sd $31, %2\n\t"
-#else
-		"1: la $1, 1b\n\t"
-		"sw $1, %0\n\t"
-		"sw $29, %1\n\t"
-		"sw $31, %2\n\t"
-#endif
-		".set pop\n\t"
-		: "=m" (regs->cp0_epc),
-		"=m" (regs->regs[29]), "=m" (regs->regs[31])
-		: : "memory");
-}
-
 void show_stack(struct task_struct *task, unsigned long *sp)
 {
 	struct pt_regs regs;
@@ -206,11 +180,6 @@ void dump_stack(void)
 {
 	struct pt_regs regs;
 
-	/*
-	 * Remove any garbage that may be in regs (specially func
-	 * addresses) to avoid show_raw_backtrace() to report them
-	 */
-	memset(&regs, 0, sizeof(regs));
 	prepare_frametrace(&regs);
 	show_backtrace(current, &regs);
 }
diff --git a/include/asm-mips/stacktrace.h b/include/asm-mips/stacktrace.h
new file mode 100644
index 0000000..231f6f8
--- /dev/null
+++ b/include/asm-mips/stacktrace.h
@@ -0,0 +1,44 @@
+#ifndef _ASM_STACKTRACE_H
+#define _ASM_STACKTRACE_H
+
+#include <asm/ptrace.h>
+
+#ifdef CONFIG_KALLSYMS
+extern int raw_show_trace;
+extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
+				  unsigned long pc, unsigned long ra);
+#else
+#define raw_show_trace 1
+#define unwind_stack(task, sp, pc, ra)	0
+#endif
+
+static __always_inline void prepare_frametrace(struct pt_regs *regs)
+{
+#ifndef CONFIG_KALLSYMS
+	/*
+	 * Remove any garbage that may be in regs (specially func
+	 * addresses) to avoid show_raw_backtrace() to report them
+	 */
+	memset(regs, 0, sizeof(*regs));
+#endif
+	__asm__ __volatile__(
+		".set push\n\t"
+		".set noat\n\t"
+#ifdef CONFIG_64BIT
+		"1: dla $1, 1b\n\t"
+		"sd $1, %0\n\t"
+		"sd $29, %1\n\t"
+		"sd $31, %2\n\t"
+#else
+		"1: la $1, 1b\n\t"
+		"sw $1, %0\n\t"
+		"sw $29, %1\n\t"
+		"sw $31, %2\n\t"
+#endif
+		".set pop\n\t"
+		: "=m" (regs->cp0_epc),
+		"=m" (regs->regs[29]), "=m" (regs->regs[31])
+		: : "memory");
+}
+
+#endif /* _ASM_STACKTRACE_H */

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
  2006-09-26 14:44 [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT Atsushi Nemoto
@ 2006-09-26 15:16 ` Atsushi Nemoto
  2006-09-28 10:26   ` Atsushi Nemoto
  2006-09-26 15:58 ` Franck Bui-Huu
  1 sibling, 1 reply; 7+ messages in thread
From: Atsushi Nemoto @ 2006-09-26 15:16 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf, mingo

On Tue, 26 Sep 2006 23:44:01 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> Implement stacktrace interface by using unwind_stack().
> And enable lockdep support.

And I got this output when I booted kernel 2.6.18 using nfsroot:

--- snip ---
Mounting remote filesystems...

=======================================================
[ INFO: possible circular locking dependency detected ]
-------------------------------------------------------
mount/1381 is trying to acquire lock:
 (&mm->mmap_sem){----}, at: [<80032370>] do_page_fault+0xf0/0x3e0

but task is already holding lock:
 (sk_lock-AF_INET){--..}, at: [<802a55ac>] tcp_recvmsg+0x44/0x920

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sk_lock-AF_INET){--..}:
       [<80075ac0>] __lock_acquire+0xd7c/0xe98
       [<80076098>] lock_acquire+0xa4/0xf8
       [<8026a9ec>] lock_sock+0xec/0x11c
       [<802be8cc>] udp_sendmsg+0x20c/0x5cc
       [<802c772c>] inet_sendmsg+0x58/0x9c
       [<80267270>] sock_sendmsg+0xb0/0x104
       [<802672f0>] kernel_sendmsg+0x2c/0x48
       [<802e9924>] xs_udp_send_request+0x1d8/0x354
       [<802e65dc>] xprt_transmit+0x70/0x284
       [<802e3140>] call_transmit+0x204/0x2e4
       [<802eb16c>] __rpc_execute+0xa8/0x2bc
       [<802eb3e8>] rpc_execute+0x40/0x54
       [<8013434c>] nfs_execute_read+0x50/0x84
       [<80134c60>] nfs_pagein_one+0x2e4/0x388
       [<80134e18>] nfs_readpages+0x114/0x21c
       [<8008ce7c>] __do_page_cache_readahead+0x214/0x33c
       [<8008d550>] do_page_cache_readahead+0x6c/0x9c
       [<80087498>] filemap_nopage+0x178/0x560
       [<800953e4>] __handle_mm_fault+0x178/0xb70
       [<80032504>] do_page_fault+0x284/0x3e0
       [<800339c0>] tlb_do_page_fault_1+0x104/0x114

-> #0 (&mm->mmap_sem){----}:
       [<80075960>] __lock_acquire+0xc1c/0xe98
       [<80076098>] lock_acquire+0xa4/0xf8
       [<80070bb0>] down_read+0x38/0x58
       [<80032370>] do_page_fault+0xf0/0x3e0
       [<800339c0>] tlb_do_page_fault_1+0x104/0x114

other info that might help us debug this:

1 lock held by mount/1381:
 #0:  (sk_lock-AF_INET){--..}, at: [<802a55ac>] tcp_recvmsg+0x44/0x920

stack backtrace:
Call Trace:
[<8002de48>] dump_stack+0x10/0x44
[<80074d28>] print_circular_bug_tail+0x70/0x8c
[<80075960>] __lock_acquire+0xc1c/0xe98
[<80076098>] lock_acquire+0xa4/0xf8
[<80070bb0>] down_read+0x38/0x58
[<80032370>] do_page_fault+0xf0/0x3e0
[<800339c0>] tlb_do_page_fault_1+0x104/0x114
--- snip ---


I'm not familiar with lockdep output.  Is this a real dependency bug
or lack of annotation on somewhere, or something other ?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
  2006-09-26 14:44 [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT Atsushi Nemoto
  2006-09-26 15:16 ` Atsushi Nemoto
@ 2006-09-26 15:58 ` Franck Bui-Huu
  2006-09-26 16:11   ` Atsushi Nemoto
  1 sibling, 1 reply; 7+ messages in thread
From: Franck Bui-Huu @ 2006-09-26 15:58 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, ralf, mingo

Hi Atsushi

Atsushi Nemoto wrote:
> Implement stacktrace interface by using unwind_stack().
> And enable lockdep support.
> 
[snip]
> + */
> +static inline void
> +save_raw_context_stack(struct stack_trace *trace, unsigned int skip,
> +		       unsigned long reg29)
> +{
[snip]
> +
> +static inline struct pt_regs *
> +save_context_stack(struct stack_trace *trace, unsigned int skip,
> +		   struct task_struct *task, struct pt_regs *regs)
> +{
> +	unsigned long sp = regs->regs[29];

Any reasons why marking these 2 functions as inlined ? IMHO gcc is now
good enough for this decision.

		Franck

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
  2006-09-26 15:58 ` Franck Bui-Huu
@ 2006-09-26 16:11   ` Atsushi Nemoto
  0 siblings, 0 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2006-09-26 16:11 UTC (permalink / raw)
  To: vagabon.xyz; +Cc: linux-mips, ralf, mingo

On Tue, 26 Sep 2006 17:58:12 +0200, Franck Bui-Huu <vagabon.xyz@gmail.com> wrote:
> > +static inline void
> > +save_raw_context_stack(struct stack_trace *trace, unsigned int skip,
> > +		       unsigned long reg29)
> > +{
> [snip]
> > +
> > +static inline struct pt_regs *
> > +save_context_stack(struct stack_trace *trace, unsigned int skip,
> > +		   struct task_struct *task, struct pt_regs *regs)
> > +{
> > +	unsigned long sp = regs->regs[29];
> 
> Any reasons why marking these 2 functions as inlined ? IMHO gcc is now
> good enough for this decision.

Indeed.  I just made them inlined because I used i386's stacktrace.c
as a template :-)

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
  2006-09-26 15:16 ` Atsushi Nemoto
@ 2006-09-28 10:26   ` Atsushi Nemoto
  2006-09-28 10:42     ` Ralf Baechle
  0 siblings, 1 reply; 7+ messages in thread
From: Atsushi Nemoto @ 2006-09-28 10:26 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf, mingo

On Wed, 27 Sep 2006 00:16:31 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> And I got this output when I booted kernel 2.6.18 using nfsroot:

With updated stacktrace (now it shows all kernel context), I got:

--- snip ---
Mounting remote filesystems...

=======================================================
[ INFO: possible circular locking dependency detected ]
-------------------------------------------------------
mount/1383 is trying to acquire lock:
 (&mm->mmap_sem){----}, at: [<80032370>] do_page_fault+0xf0/0x3e0

but task is already holding lock:
 (sk_lock-AF_INET){--..}, at: [<802a55ac>] tcp_recvmsg+0x44/0x920

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sk_lock-AF_INET){--..}:
       [<80075ac0>] __lock_acquire+0xd7c/0xe98
       [<80076098>] lock_acquire+0xa4/0xf8
       [<8026a9ec>] lock_sock+0xec/0x11c
       [<802be8cc>] udp_sendmsg+0x20c/0x5cc
       [<802c772c>] inet_sendmsg+0x58/0x9c
       [<80267270>] sock_sendmsg+0xb0/0x104
       [<802672f0>] kernel_sendmsg+0x2c/0x48
       [<802e9924>] xs_udp_send_request+0x1d8/0x354
       [<802e65dc>] xprt_transmit+0x70/0x284
       [<802e3140>] call_transmit+0x204/0x2e4
       [<802eb16c>] __rpc_execute+0xa8/0x2bc
       [<802eb3e8>] rpc_execute+0x40/0x54
       [<8013434c>] nfs_execute_read+0x50/0x84
       [<80134c60>] nfs_pagein_one+0x2e4/0x388
       [<80134e18>] nfs_readpages+0x114/0x21c
       [<8008ce7c>] __do_page_cache_readahead+0x214/0x33c
       [<8008d550>] do_page_cache_readahead+0x6c/0x9c
       [<80087498>] filemap_nopage+0x178/0x560
       [<800953e4>] __handle_mm_fault+0x178/0xb70
       [<80032504>] do_page_fault+0x284/0x3e0
       [<80025d00>] ret_from_exception+0x0/0x10
       [<80189af4>] __bzero+0x38/0x80
       [<800e5554>] padzero+0x6c/0x8c
       [<800e6eb8>] load_elf_binary+0x878/0x16d0
       [<800b8b08>] search_binary_handler+0xf8/0x450
       [<800baa90>] do_execve+0x13c/0x224
       [<8002b904>] sys_execve+0x54/0x88
       [<80030cc0>] stack_done+0x20/0x3c

-> #0 (&mm->mmap_sem){----}:
       [<80075960>] __lock_acquire+0xc1c/0xe98
       [<80076098>] lock_acquire+0xa4/0xf8
       [<80070bb0>] down_read+0x38/0x58
       [<80032370>] do_page_fault+0xf0/0x3e0
       [<80025d00>] ret_from_exception+0x0/0x10
       [<8018910c>] both_aligned+0x2c/0x64
       [<802712b4>] memcpy_toiovec+0x8c/0xbc
       [<80271d74>] skb_copy_datagram_iovec+0x208/0x2a4
       [<802a5bdc>] tcp_recvmsg+0x674/0x920
       [<80269e5c>] sock_common_recvmsg+0x4c/0x70
       [<80266a58>] do_sock_read+0xb0/0xd8
       [<80267668>] sock_aio_read+0x80/0x88
       [<800a8bfc>] do_sync_read+0xe4/0x14c
       [<800a99f4>] vfs_read+0x1a8/0x1b0
       [<800a9f9c>] sys_read+0x5c/0xb0
       [<80030cc0>] stack_done+0x20/0x3c

other info that might help us debug this:

1 lock held by mount/1383:
 #0:  (sk_lock-AF_INET){--..}, at: [<802a55ac>] tcp_recvmsg+0x44/0x920

stack backtrace:
Call Trace:
[<8002de48>] dump_stack+0x10/0x44
[<80074d28>] print_circular_bug_tail+0x70/0x8c
[<80075960>] __lock_acquire+0xc1c/0xe98
[<80076098>] lock_acquire+0xa4/0xf8
[<80070bb0>] down_read+0x38/0x58
[<80032370>] do_page_fault+0xf0/0x3e0
[<80025d00>] ret_from_exception+0x0/0x10

--- snip ---


Does this output say socket I/O and a page-fault on NFS can cause a
deadlock?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
  2006-09-28 10:26   ` Atsushi Nemoto
@ 2006-09-28 10:42     ` Ralf Baechle
  2006-09-29  9:32       ` Atsushi Nemoto
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2006-09-28 10:42 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, mingo

On Thu, Sep 28, 2006 at 07:26:37PM +0900, Atsushi Nemoto wrote:

> On Wed, 27 Sep 2006 00:16:31 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> > And I got this output when I booted kernel 2.6.18 using nfsroot:
> 
> With updated stacktrace (now it shows all kernel context), I got:

Thanks.  Now the lockdep output makes sense.  At a glance it also looks
like this case isn't a false positive ...

  Ralf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT
  2006-09-28 10:42     ` Ralf Baechle
@ 2006-09-29  9:32       ` Atsushi Nemoto
  0 siblings, 0 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2006-09-29  9:32 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, mingo

On Thu, 28 Sep 2006 11:42:47 +0100, Ralf Baechle <ralf@linux-mips.org> wrote:
> > > And I got this output when I booted kernel 2.6.18 using nfsroot:
> > 
> > With updated stacktrace (now it shows all kernel context), I got:
> 
> Thanks.  Now the lockdep output makes sense.  At a glance it also looks
> like this case isn't a false positive ...

And here is a updated lockdep output with "nfsroot=host:dir,tcp"
option.  In previous output, I used NFS over TCP but not specified
",tcp" on nfsroot.

Also I found this happens only NFS over TCP on Debian 3.1 (sarge).  If
I used NFS over UDP or Debian 4.0 (etch), lockdep does not show
anything.  I can not tell why the version of Debian affect this...


--- snip ---
Mounting remote filesystems...

=======================================================
[ INFO: possible circular locking dependency detected ]
-------------------------------------------------------
mount/1425 is trying to acquire lock:
 (&mm->mmap_sem){----}, at: [<80031b70>] do_page_fault+0xf0/0x3c0

but task is already holding lock:
 (sk_lock-AF_INET){--..}, at: [<802a7170>] tcp_recvmsg+0x44/0x920

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sk_lock-AF_INET){--..}:
       [<8007383c>] __lock_acquire+0xd80/0xe9c
       [<80073e14>] lock_acquire+0xa4/0xf8
       [<8026bc98>] lock_sock+0xec/0x11c
       [<802a62f8>] tcp_sendmsg+0x40/0xc60
       [<802c9194>] inet_sendmsg+0x58/0x9c
       [<8026858c>] sock_sendmsg+0xb0/0x104
       [<8026860c>] kernel_sendmsg+0x2c/0x48
       [<802ebd70>] xs_tcp_send_request+0x134/0x3f8
       [<802ea408>] xprt_transmit+0x70/0x284
       [<802e70b0>] call_transmit+0x1fc/0x2dc
       [<802ef194>] __rpc_execute+0xa8/0x2bc
       [<802ef410>] rpc_execute+0x40/0x54
       [<8013411c>] nfs_execute_read+0x50/0x84
       [<80134a64>] nfs_pagein_one+0x2e4/0x388
       [<80134ec0>] nfs_readpages+0x128/0x230
       [<8008a2b4>] __do_page_cache_readahead+0x20c/0x328
       [<8008a97c>] do_page_cache_readahead+0x6c/0x9c
       [<800848e8>] filemap_nopage+0x17c/0x564
       [<8009285c>] __handle_mm_fault+0x178/0xc18
       [<80031d00>] do_page_fault+0x280/0x3c0
       [<80025c00>] ret_from_exception+0x0/0x10
       [<8018b7b4>] __bzero+0x38/0x80
       [<800e2e24>] padzero+0x6c/0x8c
       [<800e4864>] load_elf_binary+0x8ac/0x16e8
       [<800b61c8>] search_binary_handler+0xe8/0x420
       [<800b805c>] do_execve+0x13c/0x224
       [<8002b554>] sys_execve+0x54/0x88
       [<80030780>] stack_done+0x20/0x3c

-> #0 (&mm->mmap_sem){----}:
       [<800736dc>] __lock_acquire+0xc20/0xe9c
       [<80073e14>] lock_acquire+0xa4/0xf8
       [<8006e930>] down_read+0x38/0x58
       [<80031b70>] do_page_fault+0xf0/0x3c0
       [<80025c00>] ret_from_exception+0x0/0x10
       [<8018adcc>] both_aligned+0x2c/0x64
       [<80272504>] memcpy_toiovec+0x8c/0xbc
       [<80272fc4>] skb_copy_datagram_iovec+0x208/0x2a4
       [<802a77a0>] tcp_recvmsg+0x674/0x920
       [<8026b0dc>] sock_common_recvmsg+0x4c/0x70
       [<80267a88>] do_sock_read+0xb0/0xd8
       [<80268984>] sock_aio_read+0x80/0x88
       [<800a633c>] do_sync_read+0xe4/0x14c
       [<800a7134>] vfs_read+0x1a8/0x1b0
       [<800a76e0>] sys_read+0x5c/0xb0
       [<80030780>] stack_done+0x20/0x3c

other info that might help us debug this:

1 lock held by mount/1425:
 #0:  (sk_lock-AF_INET){--..}, at: [<802a7170>] tcp_recvmsg+0x44/0x920

stack backtrace:
Call Trace:
[<8002da54>] dump_stack+0x10/0x44
[<80072aa0>] print_circular_bug_tail+0x70/0x8c
[<800736dc>] __lock_acquire+0xc20/0xe9c
[<80073e14>] lock_acquire+0xa4/0xf8
[<8006e930>] down_read+0x38/0x58
[<80031b70>] do_page_fault+0xf0/0x3c0
[<80025c00>] ret_from_exception+0x0/0x10
[<8018adcc>] both_aligned+0x2c/0x64
[<80272504>] memcpy_toiovec+0x8c/0xbc
[<80272fc4>] skb_copy_datagram_iovec+0x208/0x2a4
[<802a77a0>] tcp_recvmsg+0x674/0x920
[<8026b0dc>] sock_common_recvmsg+0x4c/0x70
[<80267a88>] do_sock_read+0xb0/0xd8
[<80268984>] sock_aio_read+0x80/0x88
[<800a633c>] do_sync_read+0xe4/0x14c
[<800a7134>] vfs_read+0x1a8/0x1b0
[<800a76e0>] sys_read+0x5c/0xb0
[<80030780>] stack_done+0x20/0x3c
--- snip ---


Any idea?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-09-29  9:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-26 14:44 [PATCH 2/3] [MIPS] lockdep: add STACKTRACE_SUPPORT and enable LOCKDEP_SUPPORT Atsushi Nemoto
2006-09-26 15:16 ` Atsushi Nemoto
2006-09-28 10:26   ` Atsushi Nemoto
2006-09-28 10:42     ` Ralf Baechle
2006-09-29  9:32       ` Atsushi Nemoto
2006-09-26 15:58 ` Franck Bui-Huu
2006-09-26 16:11   ` Atsushi Nemoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.