diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2020-04-27 21:08:07 +1000 |
---|---|---|
committer | Oliver O'Halloran <oohall@gmail.com> | 2020-06-11 12:52:55 +1000 |
commit | dca0d5345631fb8d116eaf015416a6a51ead6028 (patch) | |
tree | b915839cd60658fbd16e971262b881cd153b8864 /core/stack.c | |
parent | ac08f4aa9c772eb03b2460500c64b77822f05bf4 (diff) | |
download | skiboot-dca0d5345631fb8d116eaf015416a6a51ead6028.zip skiboot-dca0d5345631fb8d116eaf015416a6a51ead6028.tar.gz skiboot-dca0d5345631fb8d116eaf015416a6a51ead6028.tar.bz2 |
core: interrupt markers for stack traces
Use magic marker in the exception stack frame that is used by the
unwinder to decode the interrupt type and NIA. The below example trace
comes from a modified skiboot that uses virtual memory, but any
interrupt type will appear similarly.
CPU 0000 Backtrace:
S: 0000000031c13580 R: 0000000030028210 .vm_dsi+0x360
S: 0000000031c13630 R: 000000003003b0dc .exception_entry+0x4fc
S: 0000000031c13830 R: 0000000030001f4c exception_entry_foo+0x4
--- Interrupt 0x300 at 000000003002431c ---
S: 0000000031c13b40 R: 000000003002430c .make_free.isra.0+0x110
S: 0000000031c13bd0 R: 0000000030025198 .mem_alloc+0x4a0
S: 0000000031c13c80 R: 0000000030028bac .__memalign+0x48
S: 0000000031c13d10 R: 0000000030028da4 .__zalloc+0x18
S: 0000000031c13d90 R: 000000003002fb34 .opal_init_msg+0x34
S: 0000000031c13e20 R: 00000000300234b4 .main_cpu_entry+0x61c
S: 0000000031c13f00 R: 00000000300031b8 boot_entry+0x1b0
--- OPAL boot ---
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[oliver: the new stackentry fields made our test heaps too small]
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
fixup! core: interrupt markers for stack traces
Diffstat (limited to 'core/stack.c')
-rw-r--r-- | core/stack.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/stack.c b/core/stack.c index 688ef70..2df960b 100644 --- a/core/stack.c +++ b/core/stack.c @@ -35,6 +35,12 @@ static void __nomcount __backtrace_create(struct bt_entry *entries, if (!fp || (unsigned long)fp > top_adj) break; eframe = (struct stack_frame *)fp; + if (eframe->magic == STACK_INT_MAGIC) { + entries->exception_type = eframe->type; + entries->exception_pc = eframe->pc; + } else { + entries->exception_type = 0; + } entries->sp = (unsigned long)fp; entries->pc = fp[2]; entries++; @@ -99,6 +105,11 @@ void backtrace_print(struct bt_entry *entries, struct bt_metadata *metadata, if (symbols) l += snprintf_symbol(buf + l, max - l, entries->pc); l += snprintf(buf + l, max - l, "\n"); + if (entries->exception_type) { + l += snprintf(buf + l, max - l, + " --- Interrupt 0x%lx at %016lx ---\n", + entries->exception_type, entries->exception_pc); + } entries++; } if (metadata->token <= OPAL_LAST) |