Signed-off-by: Gregory Haskins <ghaskins@xxxxxxxxxx> --- arch/x86_64/kernel/stacktrace.c | 10 ++++++++-- include/linux/stacktrace.h | 1 + kernel/latency_trace.c | 12 ++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/x86_64/kernel/stacktrace.c b/arch/x86_64/kernel/stacktrace.c index cb91091..054f627 100644 --- a/arch/x86_64/kernel/stacktrace.c +++ b/arch/x86_64/kernel/stacktrace.c @@ -24,7 +24,7 @@ static int save_stack_stack(void *data, char *name) return -1; } -static void save_stack_address(void *data, unsigned long addr) +static void _save_stack_address(void *data, unsigned long addr) { struct stack_trace *trace = (struct stack_trace *)data; if (trace->skip > 0) { @@ -39,7 +39,7 @@ static struct stacktrace_ops save_stack_ops = { .warning = save_stack_warning, .warning_symbol = save_stack_warning_symbol, .stack = save_stack_stack, - .address = save_stack_address, + .address = _save_stack_address, }; /* @@ -52,3 +52,9 @@ void save_stack_trace(struct stack_trace *trace) trace->entries[trace->nr_entries++] = ULONG_MAX; } EXPORT_SYMBOL(save_stack_trace); + +void save_stack_address(struct stack_trace *trace, unsigned long addr) +{ + _save_stack_address(trace, addr); +} +EXPORT_SYMBOL(save_stack_address); diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index e7fa657..5acad27 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h @@ -9,6 +9,7 @@ struct stack_trace { }; extern void save_stack_trace(struct stack_trace *trace); +extern void save_stack_address(struct stack_trace *trace, unsigned long addr); extern void print_stack_trace(struct stack_trace *trace, int spaces); #else diff --git a/kernel/latency_trace.c b/kernel/latency_trace.c index 9b83262..82c04ac 100644 --- a/kernel/latency_trace.c +++ b/kernel/latency_trace.c @@ -2058,6 +2058,18 @@ void notrace add_preempt_count(unsigned int val) trace->entries = current->preempt_trace[idx].data; save_stack_trace(trace); + + /* + * If we couldnt get our trace, the first entry will + * have the ULONG_MAX marker. In that case, we + * rewind and save our simple two level stack + */ + if ((trace->nr_entries == 1) + && (trace->entries[0] == ULONG_MAX)) { + trace->nr_entries = 0; + save_stack_address(trace, eip); + save_stack_address(trace, parent_eip); + } } } #endif - To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html