[Skiboot] [PATCH] Fix early backtraces
Ryan Grimm
grimm at linux.vnet.ibm.com
Fri Mar 4 07:58:12 AEDT 2016
If we fail an assert() before we add a mem region, such as missing chip-id in a
dt xscom node, we don't get a backtrace:
[836883,0] Assert fail: core/device.c:870:id != 0xffffffff
[848859,0] Aborting!
CPU 0000 Backtrace:
This patch adjusts the top_of_ram value compared to the fp stack frame to
assume one stack early on so we get a backtrace:
[440546,0] Assert fail: core/device.c:822:id != 0xffffffff
[452522,0] Aborting!
CPU 0000 Backtrace:
S: 0000000031c03b70 R: 00000000300135d0 .backtrace+0x24
S: 0000000031c03bf0 R: 0000000030017f38 ._abort+0x4c
S: 0000000031c03c70 R: 0000000030017fb4 .assert_fail+0x34
S: 0000000031c03cf0 R: 0000000030021830 .dt_get_chip_id+0x24
S: 0000000031c03d60 R: 00000000300143cc .init_chips+0x23c
S: 0000000031c03e30 R: 0000000030013ab8 .main_cpu_entry+0x110
S: 0000000031c03f00 R: 000000003000254c boot_entry+0x19c
Signed-off-by: Ryan Grimm <grimm at linux.vnet.ibm.com>
---
core/stack.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/core/stack.c b/core/stack.c
index 17f89d4..5fba6c7 100644
--- a/core/stack.c
+++ b/core/stack.c
@@ -32,10 +32,15 @@ void __nomcount __backtrace(struct bt_entry *entries, unsigned int *count)
{
unsigned int room = *count;
unsigned long *fp = __builtin_frame_address(1);
+ unsigned long top_adj = top_of_ram;
+
+ /* Assume one stack for early backtraces */
+ if (top_of_ram == SKIBOOT_BASE + SKIBOOT_SIZE)
+ top_adj = top_of_ram + STACK_SIZE;
*count = 0;
while(room) {
- if (!fp || (unsigned long)fp > top_of_ram)
+ if (!fp || (unsigned long)fp > top_adj)
break;
entries->sp = (unsigned long)fp;
entries->pc = fp[2];
--
1.9.1
More information about the Skiboot
mailing list