Skip to contentSkip to conversation

powerpc: allow configuring max stack dump depth

PATCH Superseded Johannes Berg 2 participants 6 messages Nov 1, 2008 – Nov 20, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: allow configuring max stack dump depth

On my screen, when something crashes, I only have space for maybe 16 functions of the stack trace before the information above it scrolls off the screen. It's easy to hack the kernel to print out only that much, but it's harder to remember to do it. This patch introduces a config option for it so that I can keep the setting in my config.

---
 arch/powerpc/Kconfig.debug    |    7 +++++++
 arch/powerpc/kernel/process.c |    2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig.debug +7 -0
@@ -2,6 +2,13 @@ menu "Kernel hacking"
 
 source "lib/Kconfig.debug"
 
+config PRINT_STACK_DEPTH
+	int "Stack depth to print"
+	default 64
+	help
+	  This option allows you to set the stack depth that the kernel
+	  prints out in case your display is too small.
+
 config DEBUG_STACKOVERFLOW
 	bool "Check for stack overflows"
 	depends on DEBUG_KERNEL
arch/powerpc/kernel/process.c +1 -1
@@ -998,7 +998,7 @@ unsigned long get_wchan(struct task_stru
 	return 0;
 }
 
-static int kstack_depth_to_print = 64;
+static int kstack_depth_to_print = CONFIG_PRINT_STACK_DEPTH;
 
 void show_stack(struct task_struct *tsk, unsigned long *stack)
 {
#1 lore raw
Quoted 6 lines · Johannes Berg

On my screen, when something crashes, I only have space for maybe 16 functions of the stack trace before the information above it scrolls off the screen. It's easy to hack the kernel to print out only that much, but it's harder to remember to do it. This patch introduces a config option for it so that I can keep the setting in my config.

Could you make it depend on DEBUG_KERNEL or ADVANCED or something?

arch/powerpc/Kconfig.debug menu "Kernel hacking" · line 10

Quoted 3 lines
arch/powerpc/Kconfig.debug +3 -0
+	help
+	  This option allows you to set the stack depth that the kernel
+	  prints out in case your display is too small.

The "in case" is a little ambiguous here. I suggest:

+	  This option allows you to set the maximum depth that the kernel
+	  prints in stack traces.  This can be useful if your display
+	  is too small.

Paul.

#2 lore raw

PATCH v2 1/1 powerpc: allow configuring max stack dump depth

On my screen, when something crashes, I only have space for maybe 16 functions of the stack trace before the information above it scrolls off the screen. It's easy to hack the kernel to print out only that much, but it's harder to remember to do it. This patch introduces a config option for it so that I can keep the setting in my config.

---
Sure, here's an updated version. I used DEBUG_KERNEL since the ADVANCED_CONFIGURATION help text implies it's for MM and can cause the kernel to not boot, not something this config is related to.

Thanks for your comments.

 arch/powerpc/Kconfig.debug    |   10 ++++++++++
 arch/powerpc/kernel/process.c |    2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig.debug +10 -0
@@ -2,6 +2,16 @@ menu "Kernel hacking"
 
 source "lib/Kconfig.debug"
 
+config PRINT_STACK_DEPTH
+	int "Stack depth to print"
+	depends on DEBUG_KERNEL
+	default 64
+	help
+	  This option allows you to set the stack depth that the kernel
+	  prints in stack traces. This can be useful if your display is
+	  too small and stack traces cause important information to
+	  scroll off the screen.
+
 config DEBUG_STACKOVERFLOW
 	bool "Check for stack overflows"
 	depends on DEBUG_KERNEL
arch/powerpc/kernel/process.c +1 -1
@@ -998,7 +998,7 @@ unsigned long get_wchan(struct task_stru
 	return 0;
 }
 
-static int kstack_depth_to_print = 64;
+static int kstack_depth_to_print = CONFIG_PRINT_STACK_DEPTH;
 
 void show_stack(struct task_struct *tsk, unsigned long *stack)
 {
#3 lore raw
Quoted 7 lines · Johannes Berg

On my screen, when something crashes, I only have space for maybe 16 functions of the stack trace before the information above it scrolls off the screen. It's easy to hack the kernel to print out only that much, but it's harder to remember to do it. This patch introduces a config option for it so that I can keep the setting in my config.

Quoted 5 lines

---
Sure, here's an updated version. I used DEBUG_KERNEL since the ADVANCED_CONFIGURATION help text implies it's for MM and can cause the kernel to not boot, not something this config is related to.

Um, with this I get a compile error when DEBUG_KERNEL=n:

CC arch/powerpc/kernel/process.o
/home/paulus/kernel/powerpc/arch/powerpc/kernel/process.c:1001: error: 'CONFIG_PRINT_STACK_DEPTH' undeclared here (not in a function) make[2]: *** [arch/powerpc/kernel/process.o] Error 1

I think it needs to look like this:

+config PRINT_STACK_DEPTH
+ int "Stack depth to print" if DEBUG_KERNEL
+ default 64
+ help

+	  This option allows you to set the stack depth that the kernel
+	  prints in stack traces. This can be useful if your display is
+	  too small and stack traces cause important information to
+	  scroll off the screen.

+

Paul.

#4 lore raw
Quoted 15 lines · Paul Mackerras
Quoted 7 lines · Johannes Berg

On my screen, when something crashes, I only have space for maybe 16 functions of the stack trace before the information above it scrolls off the screen. It's easy to hack the kernel to print out only that much, but it's harder to remember to do it. This patch introduces a config option for it so that I can keep the setting in my config.

Quoted 5 lines

---
Sure, here's an updated version. I used DEBUG_KERNEL since the ADVANCED_CONFIGURATION help text implies it's for MM and can cause the kernel to not boot, not something this config is related to.

Quoted 5 lines

Um, with this I get a compile error when DEBUG_KERNEL=n:

CC arch/powerpc/kernel/process.o
/home/paulus/kernel/powerpc/arch/powerpc/kernel/process.c:1001: error: 'CONFIG_PRINT_STACK_DEPTH' undeclared here (not in a function) make[2]: *** [arch/powerpc/kernel/process.o] Error 1

Ouch, clearly I haven't been paying attention, my mistake. Sorry about that.

Review

Quoted 4 lines

I think it needs to look like this:

(quoted diff) +2 -0
+config PRINT_STACK_DEPTH
+	int "Stack depth to print" if DEBUG_KERNEL

Yes, that's better, thanks.

johannes

#5 lore raw

PATCH v3 1/1 powerpc: allow configuring max stack dump depth

In reply to Paul Mackerras

On my screen, when something crashes, I only have space for maybe 16 functions of the stack trace before the information above it scrolls off the screen. It's easy to hack the kernel to print out only that much, but it's harder to remember to do it. This patch introduces a config option for it so that I can keep the setting in my config.

---
v3 corrects the stupid Kconfig dependency mistake

 arch/powerpc/Kconfig.debug    |    9 +++++++++
 arch/powerpc/kernel/process.c |    2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig.debug +9 -0
@@ -2,6 +2,15 @@ menu "Kernel hacking"
 
 source "lib/Kconfig.debug"
 
+config PRINT_STACK_DEPTH
+	int "Stack depth to print" if DEBUG_KERNEL
+	default 64
+	help
+	  This option allows you to set the stack depth that the kernel
+	  prints in stack traces. This can be useful if your display is
+	  too small and stack traces cause important information to
+	  scroll off the screen.
+
 config DEBUG_STACKOVERFLOW
 	bool "Check for stack overflows"
 	depends on DEBUG_KERNEL
arch/powerpc/kernel/process.c +1 -1
@@ -998,7 +998,7 @@ unsigned long get_wchan(struct task_stru
 	return 0;
 }
 
-static int kstack_depth_to_print = 64;
+static int kstack_depth_to_print = CONFIG_PRINT_STACK_DEPTH;
 
 void show_stack(struct task_struct *tsk, unsigned long *stack)
 {