lkml.org 
[lkml]   [2022]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC 4/8] powerpc: stacktrace: Make callbacks use new prototype with frame info
Date
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@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
\
 
 \ /
  Last update: 2022-04-18 16:39    [W:0.298 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site