aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2020-04-27 21:08:07 +1000
committerOliver O'Halloran <oohall@gmail.com>2020-06-11 12:52:55 +1000
commitdca0d5345631fb8d116eaf015416a6a51ead6028 (patch)
treeb915839cd60658fbd16e971262b881cd153b8864 /core
parentac08f4aa9c772eb03b2460500c64b77822f05bf4 (diff)
downloadskiboot-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')
-rw-r--r--core/exceptions.c2
-rw-r--r--core/stack.c11
-rw-r--r--core/test/run-malloc.c2
-rw-r--r--core/test/run-mem_range_is_reserved.c2
-rw-r--r--core/test/run-mem_region.c2
-rw-r--r--core/test/run-mem_region_next.c2
-rw-r--r--core/test/run-mem_region_release_unused.c2
-rw-r--r--core/test/run-mem_region_release_unused_noalloc.c2
-rw-r--r--core/test/run-mem_region_reservations.c2
9 files changed, 20 insertions, 7 deletions
diff --git a/core/exceptions.c b/core/exceptions.c
index dacc02a..fd069aa 100644
--- a/core/exceptions.c
+++ b/core/exceptions.c
@@ -65,6 +65,8 @@ void exception_entry(struct stack_frame *stack)
nip = stack->srr0;
msr = stack->srr1;
}
+ stack->msr = msr;
+ stack->pc = nip;
if (!(msr & MSR_RI))
fatal = true;
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)
diff --git a/core/test/run-malloc.c b/core/test/run-malloc.c
index 6018e99..10cc64e 100644
--- a/core/test/run-malloc.c
+++ b/core/test/run-malloc.c
@@ -36,7 +36,7 @@ static inline void real_free(void *p)
#include "mem_region-malloc.h"
-#define TEST_HEAP_ORDER 12
+#define TEST_HEAP_ORDER 16
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
struct dt_node *dt_root;
diff --git a/core/test/run-mem_range_is_reserved.c b/core/test/run-mem_range_is_reserved.c
index 22c9213..9891dbd 100644
--- a/core/test/run-mem_range_is_reserved.c
+++ b/core/test/run-mem_range_is_reserved.c
@@ -65,7 +65,7 @@ bool lock_held_by_me(struct lock *l)
return l->lock_val;
}
-#define TEST_HEAP_ORDER 14
+#define TEST_HEAP_ORDER 16
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
static void add_mem_node(uint64_t start, uint64_t len)
diff --git a/core/test/run-mem_region.c b/core/test/run-mem_region.c
index 66fa630..50da803 100644
--- a/core/test/run-mem_region.c
+++ b/core/test/run-mem_region.c
@@ -64,7 +64,7 @@ bool lock_held_by_me(struct lock *l)
return l->lock_val;
}
-#define TEST_HEAP_ORDER 12
+#define TEST_HEAP_ORDER 16
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
static bool heap_empty(void)
diff --git a/core/test/run-mem_region_next.c b/core/test/run-mem_region_next.c
index 07c4709..4f2f73c 100644
--- a/core/test/run-mem_region_next.c
+++ b/core/test/run-mem_region_next.c
@@ -58,7 +58,7 @@ bool lock_held_by_me(struct lock *l)
}
-#define TEST_HEAP_ORDER 12
+#define TEST_HEAP_ORDER 16
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
int main(void)
diff --git a/core/test/run-mem_region_release_unused.c b/core/test/run-mem_region_release_unused.c
index 16090f8..463f542 100644
--- a/core/test/run-mem_region_release_unused.c
+++ b/core/test/run-mem_region_release_unused.c
@@ -63,7 +63,7 @@ bool lock_held_by_me(struct lock *l)
return l->lock_val;
}
-#define TEST_HEAP_ORDER 12
+#define TEST_HEAP_ORDER 16
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
static void add_mem_node(uint64_t start, uint64_t len)
diff --git a/core/test/run-mem_region_release_unused_noalloc.c b/core/test/run-mem_region_release_unused_noalloc.c
index 2ebf966..d7adc5a 100644
--- a/core/test/run-mem_region_release_unused_noalloc.c
+++ b/core/test/run-mem_region_release_unused_noalloc.c
@@ -63,7 +63,7 @@ bool lock_held_by_me(struct lock *l)
return l->lock_val;
}
-#define TEST_HEAP_ORDER 12
+#define TEST_HEAP_ORDER 16
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
static void add_mem_node(uint64_t start, uint64_t len)
diff --git a/core/test/run-mem_region_reservations.c b/core/test/run-mem_region_reservations.c
index 0ead70a..c24652f 100644
--- a/core/test/run-mem_region_reservations.c
+++ b/core/test/run-mem_region_reservations.c
@@ -62,7 +62,7 @@ bool lock_held_by_me(struct lock *l)
return l->lock_val;
}
-#define TEST_HEAP_ORDER 14
+#define TEST_HEAP_ORDER 16
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
static void add_mem_node(uint64_t start, uint64_t len)