[Skiboot] [PATCH 5/7] core/stack: Convert stack check code to not use backtrace wrapper

Andrew Donnellan andrew.donnellan at au1.ibm.com
Mon Mar 18 15:28:58 AEDT 2019


We're about to get rid of __backtrace() and __print_backtrace(), convert
the stack check code to not use them.

Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>

---

Someone wanna review this to make sure I haven't subtly broken it?
---
 core/stack.c  | 10 +++++-----
 include/cpu.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/core/stack.c b/core/stack.c
index f7eca1ffb0ff..2e47cd4dbd4a 100644
--- a/core/stack.c
+++ b/core/stack.c
@@ -175,13 +175,12 @@ void __nomcount __mcount_stack_check(uint64_t sp, uint64_t lr)
 
 	/* Capture lowest stack for this thread */
 	if (mark < c->stack_bot_mark) {
-		unsigned int count = CPU_BACKTRACE_SIZE;
 		lock(&stack_check_lock);
 		c->stack_bot_mark = mark;
 		c->stack_bot_pc = lr;
 		c->stack_bot_tok = c->current_token;
-		__backtrace(c->stack_bot_bt, &count);
-		c->stack_bot_bt_count = count;
+		backtrace_create(c->stack_bot_bt, CPU_BACKTRACE_SIZE,
+				 &c->stack_bot_bt_metadata);
 		unlock(&stack_check_lock);
 	}
 
@@ -232,8 +231,9 @@ void check_stacks(void)
 		      " pc=%08llx token=%lld\n",
 		      lowest->pir, lowest->stack_bot_mark, lowest->stack_bot_pc,
 		      lowest->stack_bot_tok);
-		__print_backtrace(lowest->pir, lowest->stack_bot_bt,
-				  lowest->stack_bot_bt_count, NULL, NULL, true);
+		backtrace_print(lowest->stack_bot_bt,
+				&lowest->stack_bot_bt_metadata,
+				NULL, NULL, true);
 		unlock(&stack_check_lock);
 	}
 
diff --git a/include/cpu.h b/include/cpu.h
index 06d5c0d11229..39071a191793 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -81,7 +81,7 @@ struct cpu_thread {
 	uint64_t			stack_bot_tok;
 #define CPU_BACKTRACE_SIZE	60
 	struct bt_entry			stack_bot_bt[CPU_BACKTRACE_SIZE];
-	unsigned int			stack_bot_bt_count;
+	struct bt_metadata		stack_bot_bt_metadata;
 #endif
 	struct lock			job_lock;
 	struct list_head		job_queue;
-- 
2.11.0



More information about the Skiboot mailing list