[PATCH RFC 4/8] powerpc: stacktrace: Make callbacks use new prototype with frame info
He Zhe
zhe.he at windriver.com
Mon Apr 18 06:22:13 PDT 2022
stack_trace_consume_fn has been changed to
bool (*stack_trace_consume_fn)(void *cookie, struct frame_info *fi);
to be able to pass more information.
Turn to use pc in struct frame_info in arch_stack_walk callbacks without
functinoal change.
Signed-off-by: He Zhe <zhe.he at windriver.com>
---
arch/powerpc/kernel/stacktrace.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
index a2443d61728e..8640e9acfa29 100644
--- a/arch/powerpc/kernel/stacktrace.c
+++ b/arch/powerpc/kernel/stacktrace.c
@@ -28,9 +28,13 @@ void __no_sanitize_address arch_stack_walk(stack_trace_consume_fn consume_entry,
struct task_struct *task, struct pt_regs *regs)
{
unsigned long sp;
+ struct frame_info fi;
- if (regs && !consume_entry(cookie, regs->nip))
- return;
+ if (regs) {
+ fi.pc = regs->nip;
+ if (!consume_entry(cookie, &fi))
+ return;
+ }
if (regs)
sp = regs->gpr[1];
@@ -41,15 +45,15 @@ void __no_sanitize_address arch_stack_walk(stack_trace_consume_fn consume_entry,
for (;;) {
unsigned long *stack = (unsigned long *) sp;
- unsigned long newsp, ip;
+ unsigned long newsp;
if (!validate_sp(sp, task, STACK_FRAME_OVERHEAD))
return;
newsp = stack[0];
- ip = stack[STACK_FRAME_LR_SAVE];
+ fi.pc = stack[STACK_FRAME_LR_SAVE];
- if (!consume_entry(cookie, ip))
+ if (!consume_entry(cookie, &fi))
return;
sp = newsp;
@@ -71,6 +75,7 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
unsigned long stack_end;
int graph_idx = 0;
bool firstframe;
+ struct frame_info fi;
stack_end = stack_page + THREAD_SIZE;
if (!is_idle_task(task)) {
@@ -159,7 +164,8 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
return -EINVAL;
#endif
- if (!consume_entry(cookie, ip))
+ fi.pc = ip;
+ if (!consume_entry(cookie, &fi))
return -EINVAL;
}
return 0;
--
2.25.1
More information about the linux-riscv
mailing list