Skip to content

Commit 85718fa

Browse files
committed
[IA64] Add CONFIG_STACKTRACE_SUPPORT
Several Linux features are dependent on stack trace support. Add it so they can be enabled. Signed-off-by: Tony Luck <[email protected]>
1 parent 57aebd7 commit 85718fa

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

arch/ia64/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ config NEED_SG_DMA_LENGTH
6262
config SWIOTLB
6363
bool
6464

65+
config STACKTRACE_SUPPORT
66+
def_bool y
67+
6568
config GENERIC_LOCKBREAK
6669
def_bool n
6770

arch/ia64/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ obj-$(CONFIG_AUDIT) += audit.o
3434
obj-$(CONFIG_PCI_MSI) += msi_ia64.o
3535
mca_recovery-y += mca_drv.o mca_drv_asm.o
3636
obj-$(CONFIG_IA64_MC_ERR_INJECT)+= err_inject.o
37+
obj-$(CONFIG_STACKTRACE) += stacktrace.o
3738

3839
obj-$(CONFIG_PARAVIRT) += paravirt.o paravirtentry.o \
3940
paravirt_patch.o

arch/ia64/kernel/stacktrace.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* arch/ia64/kernel/stacktrace.c
3+
*
4+
* Stack trace management functions
5+
*
6+
*/
7+
#include <linux/sched.h>
8+
#include <linux/stacktrace.h>
9+
#include <linux/module.h>
10+
11+
static void
12+
ia64_do_save_stack(struct unw_frame_info *info, void *arg)
13+
{
14+
struct stack_trace *trace = arg;
15+
unsigned long ip;
16+
int skip = trace->skip;
17+
18+
trace->nr_entries = 0;
19+
do {
20+
unw_get_ip(info, &ip);
21+
if (ip == 0)
22+
break;
23+
if (skip == 0) {
24+
trace->entries[trace->nr_entries++] = ip;
25+
if (trace->nr_entries == trace->max_entries)
26+
break;
27+
} else
28+
skip--;
29+
} while (unw_unwind(info) >= 0);
30+
}
31+
32+
/*
33+
* Save stack-backtrace addresses into a stack_trace buffer.
34+
*/
35+
void save_stack_trace(struct stack_trace *trace)
36+
{
37+
unw_init_running(ia64_do_save_stack, trace);
38+
}
39+
EXPORT_SYMBOL(save_stack_trace);

0 commit comments

Comments
 (0)