Skip to content

Commit 0741f4d

Browse files
Chuck EbbertAndi Kleen
authored andcommitted
[PATCH] 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 <76306.1226@compuserve.com> Signed-off-by: Andi Kleen <ak@suse.de>
1 parent c7a3392 commit 0741f4d

5 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎Documentation/sysctl/kernel.txt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ show up in /proc/sys/kernel:
2727
- hotplug
2828
- java-appletviewer [ binfmt_java, obsolete ]
2929
- java-interpreter [ binfmt_java, obsolete ]
30+
- kstack_depth_to_print [ X86 only ]
3031
- l2cr [ PPC only ]
3132
- modprobe ==> Documentation/kmod.txt
3233
- msgmax
@@ -170,6 +171,13 @@ This flag controls the L2 cache of G3 processor boards. If
170171

171172
==============================================================
172173

174+
kstack_depth_to_print: (X86 only)
175+
176+
Controls the number of words to print when dumping the raw
177+
kernel stack.
178+
179+
==============================================================
180+
173181
osrelease, ostype & version:
174182

175183
# cat osrelease

‎arch/i386/kernel/traps.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ asmlinkage void alignment_check(void);
9191
asmlinkage void spurious_interrupt_bug(void);
9292
asmlinkage void machine_check(void);
9393

94-
static int kstack_depth_to_print = 24;
94+
int kstack_depth_to_print = 24;
9595
#ifdef CONFIG_STACK_UNWIND
9696
static int call_trace = 1;
9797
#else

‎arch/x86_64/kernel/traps.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
108108
preempt_enable_no_resched();
109109
}
110110

111-
static int kstack_depth_to_print = 12;
111+
int kstack_depth_to_print = 12;
112112
#ifdef CONFIG_STACK_UNWIND
113113
static int call_trace = 1;
114114
#else

‎include/asm-x86_64/stacktrace.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef _ASM_STACKTRACE_H
22
#define _ASM_STACKTRACE_H 1
33

4+
extern int kstack_depth_to_print;
5+
46
/* Generic stack tracer with callbacks */
57

68
struct stacktrace_ops {

‎kernel/sysctl.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ extern int proc_nr_files(ctl_table *table, int write, struct file *filp,
5454

5555
#ifdef CONFIG_X86
5656
#include <asm/nmi.h>
57+
#include <asm/stacktrace.h>
5758
#endif
5859

5960
#if defined(CONFIG_SYSCTL)
@@ -707,6 +708,14 @@ static ctl_table kern_table[] = {
707708
.mode = 0444,
708709
.proc_handler = &proc_dointvec,
709710
},
711+
{
712+
.ctl_name = CTL_UNNUMBERED,
713+
.procname = "kstack_depth_to_print",
714+
.data = &kstack_depth_to_print,
715+
.maxlen = sizeof(int),
716+
.mode = 0644,
717+
.proc_handler = &proc_dointvec,
718+
},
710719
#endif
711720
#if defined(CONFIG_MMU)
712721
{

0 commit comments

Comments
 (0)