Skip to content

Commit 0610154

Browse files
author
Vasily Gorbik
committed
s390/test_unwind: print verbose unwinding results
Add stack name, sp and reliable information into test unwinding results. Also consider ip outside of kernel text as failure if the state is reported reliable. Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 7868249 commit 0610154

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

arch/s390/kernel/dumpstack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const char *stack_type_name(enum stack_type type)
3838
return "unknown";
3939
}
4040
}
41+
EXPORT_SYMBOL_GPL(stack_type_name);
4142

4243
static inline bool in_stack(unsigned long sp, struct stack_info *info,
4344
enum stack_type type, unsigned long low,

arch/s390/lib/test_unwind.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,19 @@ static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
5656
unsigned long addr = unwind_get_return_address(&state);
5757
char sym[KSYM_SYMBOL_LEN];
5858

59-
if (!addr || frame_count == max_frames)
59+
if (frame_count++ == max_frames)
6060
break;
61+
if (state.reliable && !addr) {
62+
pr_err("unwind state reliable but addr is 0\n");
63+
return -EINVAL;
64+
}
6165
sprint_symbol(sym, addr);
6266
if (bt_pos < BT_BUF_SIZE) {
63-
bt_pos += snprintf(bt + bt_pos, BT_BUF_SIZE - bt_pos, "%s\n", sym);
67+
bt_pos += snprintf(bt + bt_pos, BT_BUF_SIZE - bt_pos,
68+
state.reliable ? " [%-7s%px] %pSR\n" :
69+
"([%-7s%px] %pSR)\n",
70+
stack_type_name(state.stack_info.type),
71+
(void *)state.sp, (void *)state.ip);
6472
if (bt_pos >= BT_BUF_SIZE)
6573
pr_err("backtrace buffer is too small\n");
6674
}

0 commit comments

Comments
 (0)