Skip to contentSkip to conversation

core/stacktrace changes for v2.6.27

GIT PULL Ingo Molnar 3 participants 5 messages Jul 14, 2008 – Jul 18, 2008

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest core/stacktrace git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core/stacktrace

Thanks,

Ingo

------------------>
Ingo Molnar (3):
debugging: make stacktrace independent from DEBUG_KERNEL
stacktrace: fix modular build, export print_stack_trace and save_stack_trace
stacktrace: export save_stack_trace[_tsk]

Johannes Berg (1):
stacktrace: don't crash on invalid stack trace structs

Stephen Rothwell (1):
stacktrace: fix build failure on sparc64

Vegard Nossum (3):
stacktrace: print_stack_trace() cleanup
stacktrace: add saved stack traces to backtrace self-test
backtrace: replace timer with tasklet + completions

 arch/arm/kernel/stacktrace.c     |    1 +
 arch/avr32/kernel/stacktrace.c   |    1 +
 arch/mips/kernel/stacktrace.c    |    1 +
 arch/powerpc/kernel/stacktrace.c |    1 +
 arch/s390/kernel/stacktrace.c    |    2 +
 arch/sh/kernel/stacktrace.c      |    1 +
 arch/sparc64/kernel/stacktrace.c |    2 +
 arch/x86/kernel/stacktrace.c     |    2 +
 kernel/backtracetest.c           |   65 +++++++++++++++++++++++++++++++------
 kernel/stacktrace.c              |   14 +++++---
 lib/Kconfig.debug                |    4 ++-
 11 files changed, 76 insertions(+), 18 deletions(-)
arch/arm/kernel/stacktrace.c +1 -0
index ae31deb..6b3ffde 100644
@@ -66,4 +66,5 @@ void save_stack_trace(struct stack_trace *trace)
 
 	walk_stackframe(fp, base, base + THREAD_SIZE, save_trace, &data);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
 #endif
arch/avr32/kernel/stacktrace.c +1 -0
index 9a68190..f4bdb44 100644
@@ -51,3 +51,4 @@ void save_stack_trace(struct stack_trace *trace)
 		fp = frame->fp;
 	}
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
arch/mips/kernel/stacktrace.c +1 -0
index ebd9db8..5eb4681 100644
@@ -73,3 +73,4 @@ void save_stack_trace(struct stack_trace *trace)
 	prepare_frametrace(regs);
 	save_context_stack(trace, regs);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
arch/powerpc/kernel/stacktrace.c +1 -0
index 9629440..9861f17 100644
@@ -44,3 +44,4 @@ void save_stack_trace(struct stack_trace *trace)
 		sp = newsp;
 	}
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
arch/s390/kernel/stacktrace.c +2 -0
index 85e46a5..57571f1 100644
@@ -81,6 +81,7 @@ void save_stack_trace(struct stack_trace *trace)
 			   S390_lowcore.thread_info,
 			   S390_lowcore.thread_info + THREAD_SIZE, 1);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
 
 void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
@@ -93,3 +94,4 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 	if (trace->nr_entries < trace->max_entries)
 		trace->entries[trace->nr_entries++] = ULONG_MAX;
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
arch/sh/kernel/stacktrace.c +1 -0
index d41e561..1b2ae35 100644
@@ -34,3 +34,4 @@ void save_stack_trace(struct stack_trace *trace)
 		}
 	}
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
arch/sparc64/kernel/stacktrace.c +2 -0
index c73ce3f..b3e3737 100644
@@ -1,6 +1,7 @@
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
 #include <linux/thread_info.h>
+#include <linux/module.h>
 #include <asm/ptrace.h>
 #include <asm/stacktrace.h>
 
@@ -47,3 +48,4 @@ void save_stack_trace(struct stack_trace *trace)
 			trace->entries[trace->nr_entries++] = pc;
 	} while (trace->nr_entries < trace->max_entries);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
arch/x86/kernel/stacktrace.c +2 -0
index c28c342..a03e7f6 100644
@@ -74,6 +74,7 @@ void save_stack_trace(struct stack_trace *trace)
 	if (trace->nr_entries < trace->max_entries)
 		trace->entries[trace->nr_entries++] = ULONG_MAX;
 }
+EXPORT_SYMBOL_GPL(save_stack_trace);
 
 void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
@@ -81,3 +82,4 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 	if (trace->nr_entries < trace->max_entries)
 		trace->entries[trace->nr_entries++] = ULONG_MAX;
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
kernel/backtracetest.c +54 -11

84 lines not on this page · raw message

kernel/stacktrace.c +8 -6
index b71816e..94b527e 100644
@@ -6,19 +6,21 @@
  *  Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <[email protected]>
  */
 #include <linux/sched.h>
+#include <linux/module.h>
 #include <linux/kallsyms.h>
 #include <linux/stacktrace.h>
 
 void print_stack_trace(struct stack_trace *trace, int spaces)
 {
-	int i, j;
+	int i;
 
-	for (i = 0; i < trace->nr_entries; i++) {
-		unsigned long ip = trace->entries[i];
+	if (WARN_ON(!trace->entries))
+		return;
 
-		for (j = 0; j < spaces + 1; j++)
-			printk(" ");
-		print_ip_sym(ip);
+	for (i = 0; i < trace->nr_entries; i++) {
+		printk("%*c", 1 + spaces, ' ');
+		print_ip_sym(trace->entries[i]);
 	}
 }
+EXPORT_SYMBOL_GPL(print_stack_trace);
 
lib/Kconfig.debug +3 -1
index d2099f4..6263e2d 100644
@@ -419,7 +419,6 @@ config DEBUG_LOCKING_API_SELFTESTS
 
 config STACKTRACE
 	bool
-	depends on DEBUG_KERNEL
 	depends on STACKTRACE_SUPPORT
 
 config DEBUG_KOBJECT
@@ -563,6 +562,9 @@ config BACKTRACE_SELF_TEST
 	  for distributions or general kernels, but only for kernel
 	  developers working on architecture code.
 
+	  Note that if you want to also test saved backtraces, you will
+	  have to enable STACKTRACE as well.
+
 	  Say N if you are unsure.
 
 config LKDTM
#1 lore raw

Hi Ingo,

Quoted 4 lines · On Mon, 14 Jul 2008 16:44:20 +0200 Ingo Molnar <[email protected]> wrote:

Please pull the latest core/stacktrace git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core/stacktrace

This presumably needs the patch I posted today against linux-next that fixes the powerpc allmodconfig build.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#2 lore raw
Quoted 10 lines · Stephen Rothwell

Hi Ingo,

Quoted 4 lines · On Mon, 14 Jul 2008 16:44:20 +0200 Ingo Molnar <[email protected]> wrote:

Please pull the latest core/stacktrace git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core/stacktrace

This presumably needs the patch I posted today against linux-next that fixes the powerpc allmodconfig build.

hm - but you sent that against the generic-ipi tree :-)

but i agree - the patch is below, Linus please apply.

Ingo

---------------->
commit 7798ed0f57b4d137e660fbf5be1e1528e40f89ac

Author: Stephen Rothwell <[email protected]>
Date:   Mon Jul 14 19:55:03 2008 +1000

generic-ipi: powerpc/generic-ipi tree build failure

Today's linux-next build (powerpc allmodconfig) failed like this:

ERROR: ".save_stack_trace" [tests/backtracetest.ko] undefined!

But save_stack_trace is exported in arch/powerpc/kernel/stacktrace.c

I couldn't figure it out until I noticed these earlier warnings:

arch/powerpc/kernel/stacktrace.c:47: warning: data definition has no type or storage class arch/powerpc/kernel/stacktrace.c:47: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL' arch/powerpc/kernel/stacktrace.c:47: warning: parameter names (without types) in function declaration

I applied the patch below.

---
 arch/powerpc/kernel/stacktrace.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/kernel/stacktrace.c +1 -0
index 9861f17..3cf0d94 100644
@@ -12,6 +12,7 @@
 
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
+#include <linux/module.h>
 #include <asm/ptrace.h>
 
 /*
#3 lore raw
Quoted 55 lines · Ingo Molnar
Quoted 10 lines · Stephen Rothwell

Hi Ingo,

Quoted 4 lines · On Mon, 14 Jul 2008 16:44:20 +0200 Ingo Molnar <[email protected]> wrote:

Please pull the latest core/stacktrace git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git core/stacktrace

This presumably needs the patch I posted today against linux-next that fixes the powerpc allmodconfig build.

hm - but you sent that against the generic-ipi tree :-)

but i agree - the patch is below, Linus please apply.

Ingo

---------------->
commit 7798ed0f57b4d137e660fbf5be1e1528e40f89ac

Author: Stephen Rothwell <[email protected]>
Date:   Mon Jul 14 19:55:03 2008 +1000

generic-ipi: powerpc/generic-ipi tree build failure

Today's linux-next build (powerpc allmodconfig) failed like this:

ERROR: ".save_stack_trace" [tests/backtracetest.ko] undefined!

But save_stack_trace is exported in arch/powerpc/kernel/stacktrace.c

I couldn't figure it out until I noticed these earlier warnings:

arch/powerpc/kernel/stacktrace.c:47: warning: data definition has no type or storage class arch/powerpc/kernel/stacktrace.c:47: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL' arch/powerpc/kernel/stacktrace.c:47: warning: parameter names (without types) in function declaration

I applied the patch below.

---
 arch/powerpc/kernel/stacktrace.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/kernel/stacktrace.c +0 -0
index 9861f17..3cf0d94 100644

arch/powerpc/kernel/stacktrace.c line 16

Quoted 5 lines
arch/powerpc/kernel/stacktrace.c +1 -0
@@ -12,6 +12,7 @@
 
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
+#include <linux/module.h>
 #include <asm/ptrace.h>

s390 and probably other architectures will suffer from the same compile bug. I sent you the patch below against linux-next to fix this problem a couple of days ago:
http://marc.info/?l=linux-next&m=121577286607960&w=2

Subject: [PATCH] Add module.h include to stacktrace.c.

From: Heiko Carstens <[email protected]>

Fixes this:

CC arch/s390/kernel/stacktrace.o
arch/s390/kernel/stacktrace.c:84: warning: data definition has no type or storage class arch/s390/kernel/stacktrace.c:84: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL' arch/s390/kernel/stacktrace.c:84: warning: parameter names (without types) in function declaration arch/s390/kernel/stacktrace.c:97: warning: data definition has no type or storage class arch/s390/kernel/stacktrace.c:97: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL' arch/s390/kernel/stacktrace.c:97: warning: parameter names (without types) in function declaration

caused by "stacktrace: export save_stack_trace[_tsk]"

---
 arch/avr32/kernel/stacktrace.c   |    1 +
 arch/mips/kernel/stacktrace.c    |    1 +
 arch/powerpc/kernel/stacktrace.c |    1 +
 arch/s390/kernel/stacktrace.c    |    1 +
 arch/sh/kernel/stacktrace.c      |    1 +
 5 files changed, 5 insertions(+)
arch/s390/kernel/stacktrace.c +1 -0
Index: linux-next/arch/s390/kernel/stacktrace.c
===================================================================
@@ -10,6 +10,7 @@
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
 #include <linux/kallsyms.h>
+#include <linux/module.h>
 
 static unsigned long save_context_stack(struct stack_trace *trace,
 					unsigned long sp,
arch/avr32/kernel/stacktrace.c +1 -0
Index: linux-next/arch/avr32/kernel/stacktrace.c
===================================================================
@@ -10,6 +10,7 @@
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
 #include <linux/thread_info.h>
+#include <linux/module.h>
 
 register unsigned long current_frame_pointer asm("r7");
 
arch/mips/kernel/stacktrace.c +1 -0
Index: linux-next/arch/mips/kernel/stacktrace.c
===================================================================
@@ -7,6 +7,7 @@
  */
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
+#include <linux/module.h
 #include <asm/stacktrace.h>
 
 /*
arch/powerpc/kernel/stacktrace.c +1 -0
Index: linux-next/arch/powerpc/kernel/stacktrace.c
===================================================================
@@ -12,6 +12,7 @@
 
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
+#include <linux/module.h>
 #include <asm/ptrace.h>
 
 /*
arch/sh/kernel/stacktrace.c +1 -0
Index: linux-next/arch/sh/kernel/stacktrace.c
===================================================================
@@ -12,6 +12,7 @@
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
 #include <linux/thread_info.h>
+#include <linux/module.h>
 #include <asm/ptrace.h>
 
 /*
author Applied
#4 lore raw
Quoted 7 lines · Heiko Carstens

s390 and probably other architectures will suffer from the same compile bug. I sent you the patch below against linux-next to fix this problem a couple of days ago:
http://marc.info/?l=linux-next&m=121577286607960&w=2

Subject: [PATCH] Add module.h include to stacktrace.c.

applied to tip/core/urgent, thanks Heiko.

Ingo