Skip to content

Commit

Permalink
[PATCH] x86: add sysctl for kstack_depth_to_print
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chuck Ebbert authored and Andi Kleen committed Dec 7, 2006
1 parent c7a3392 commit 0741f4d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Documentation/sysctl/kernel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -170,6 +171,13 @@ This flag controls the L2 cache of G3 processor boards. If

==============================================================

kstack_depth_to_print: (X86 only)

Controls the number of words to print when dumping the raw
kernel stack.

==============================================================

osrelease, ostype & version:

# cat osrelease
Expand Down
2 changes: 1 addition & 1 deletion arch/i386/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,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
Expand Down
2 changes: 1 addition & 1 deletion arch/x86_64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
preempt_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
Expand Down
2 changes: 2 additions & 0 deletions include/asm-x86_64/stacktrace.h
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern int proc_nr_files(ctl_table *table, int write, struct file *filp,

#ifdef CONFIG_X86
#include <asm/nmi.h>
#include <asm/stacktrace.h>
#endif

#if defined(CONFIG_SYSCTL)
Expand Down Expand Up @@ -707,6 +708,14 @@ static ctl_table kern_table[] = {
.mode = 0444,
.proc_handler = &proc_dointvec,
},
{
.ctl_name = CTL_UNNUMBERED,
.procname = "kstack_depth_to_print",
.data = &kstack_depth_to_print,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
#endif
#if defined(CONFIG_MMU)
{
Expand Down

0 comments on commit 0741f4d

Please sign in to comment.