X86: add sysctl for kstack_depth_to_print
Subsystems (2)
PATCH 1/1 X86: add sysctl for kstack_depth_to_print
Add sysctl for kstack_depth_to_print. This lets users change the amount of raw stack data printed in dump_stack() without having to reboot.
Signed-off-by Chuck Ebbert <[email protected]>
---
Tested on i386; compiled on x86_64.
Documentation/sysctl/kernel.txt | 8 ++++++++ arch/i386/kernel/traps.c | 2 +- arch/x86_64/kernel/traps.c | 2 +- include/asm-x86_64/stacktrace.h | 2 ++ include/linux/sysctl.h | 1 + kernel/sysctl.c | 9 +++++++++ 6 files changed, 22 insertions(+), 2 deletions(-)
kernel/sysctl.c +9 -0
@@ -54,6 +54,7 @@ extern int proc_nr_files(ctl_table *tabl#ifdef CONFIG_X86 #include <asm/nmi.h> +#include <asm/stacktrace.h> #endif #if defined(CONFIG_SYSCTL )
@@ -707,6 +708,14 @@ static ctl_table kern_table[] = { .mode = 0444, .proc_handler = &proc_dointvec, }, + { + .ctl_name = KERN_KSTACK_DEPTH_TO_PRINT, + .procname = "kstack_depth_to_print", + .data = &kstack_depth_to_print, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec, + },#endif #if defined(CONFIG_MMU ) {
arch/i386/kernel/traps.c +1 -1
@@ -94,7 +94,7 @@ asmlinkage void alignment_check(void); asmlinkage void spurious_interrupt_bug(void); asmlinkage void machine_check(void); -static int kstack_depth_to_print =24 ; +int kstack_depth_to_print =24 ;#ifdef CONFIG_STACK_UNWIND static int call_trace =1 ;#else
include/asm-x86_64/stacktrace.h +2 -0
@@ -1,6 +1,8 @@#ifndef _ASM_STACKTRACE_H#define _ASM_STACKTRACE_H 1 +extern int kstack_depth_to_print; +/* Generic stack tracer with callbacks */ struct stacktrace_ops {
include/linux/sysctl.h +1 -0
@@ -160,6 +160,7 @@ enumKERN_MAX_LOCK_DEPTH =74 ,KERN_NMI_WATCHDOG =75 ,/* int: enable/disable nmi watchdog */ KERN_PANIC_ON_NMI =76 ,/* int: whether we will panic on an unrecovered */ + KERN_KSTACK_DEPTH_TO_PRINT=78, /* int: # words to print in show_stack() */ };
Documentation/sysctl/kernel.txt +8 -0
@@ -27,6 +27,7 @@ show up in /proc/sys/kernel: - hotplug - java-appletviewer [ binfmt_java, obsolete ] - java-interpreter [ binfmt_java, obsolete ] +- kstack_depth_to_print [ X86 only ] - l2cr [ PPC only ] - modprobe ==> Documentation/kmod.txt - msgmax
@@ -170,6 +171,13 @@ This flag controls the L2 cache of G3 pr ============================================================== +kstack_depth_to_print: (X86 only) + +Controls the number of words to print when dumping the raw +kernel stack. + +============================================================== + osrelease, ostype & version: # cat osrelease
arch/x86_64/kernel/traps.c +1 -1
@@ -108,7 +108,7 @@ static inline void preempt_conditional_cpreempt_enable_no_resched (); } -static int kstack_depth_to_print =12 ; +int kstack_depth_to_print =12 ;#ifdef CONFIG_STACK_UNWIND static int call_trace =1 ;#else
Signature · 2 lines
Chuck "Even supernovas have their duller moments."
Quoted 3 lines · Chuck Ebbert
Add sysctl for
kstack_depth_to_print. This lets users change the amount of raw stack data printed indump_stack()without having to reboot.
Added thanks
-Andi