From: Al Viro <viro@zeniv.linux.org.uk>
To: Michal Simek <monstr@monstr.eu>
Cc: Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [for-linus][PATCH 3/3] ftrace/microblaze: Do not find "true_parent" for return address
Date: Fri, 13 Dec 2024 17:29:47 +0000 [thread overview]
Message-ID: <20241213172947.GJ3387508@ZenIV> (raw)
In-Reply-To: <eb7933ae-3462-49de-b76d-16ca652d714e@monstr.eu>
On Fri, Dec 13, 2024 at 04:39:29PM +0100, Michal Simek wrote:
> > diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
> > index 74c353164ca1..a75d107a45f8 100644
> > --- a/kernel/trace/trace_functions.c
> > +++ b/kernel/trace/trace_functions.c
> > @@ -176,7 +176,8 @@ static void function_trace_start(struct trace_array *tr)
> > tracing_reset_online_cpus(&tr->array_buffer);
> > }
> > -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > +/* Microblaze currently doesn't implement kernel_stack_pointer() */
>
> Does it mean that this function should depends on
> ARCH_HAS_CURRENT_STACK_POINTER instead of name the architecture?
Nope. ARCH_HAS_CURRENT_STACK_POINTER == "there's a current_stack_pointer variable"
(presumably something like register unsigned long current_stack_pointer asm("r1");
in case of microblaze). kernel_stack_pointer() is "here's pt_regs, give me the
kernel stack pointer stored in it (assuming it _is_ stored there)".
And what ftrace code really want is "here's the structure formed by _mcount();
give me the kernel stack pointer at the time of _mcount() entry". _IF_ that
structure is pt_regs (fairly common) and if there's kernel_stack_pointer(),
we get the default implementation of that helper in linux/ftrace_regs.h:
#define ftrace_regs_get_stack_pointer(fregs) \
kernel_stack_pointer(&arch_ftrace_regs(fregs)->regs)
If it's not pt_regs, you are expected to define HAVE_ARCH_FTRACE_REGS, define
struct __arch_ftrace_regs to match whatever layout you are using and provide
the set of ftrace_regs_...() helpers.
From my reading of your mcount.S, the layout is, indeed, different and
r1 is not stored there at all - something like
struct __arch_ftrace_regs {
unsigned long r2, r3, r4, r6;
unsigned long r7, r8, r9, r10;
unsigned long r11, r12, r13, r14;
unsigned long r16, r17, r18, r19;
unsigned long r20, r21, r22, r23;
unsigned long r24, r25, r26, r27;
unsigned long r28, r29, r30, r31;
unsigned long r5;
}
static inline unsigned long ftrace_regs_get_stack_pointer(struct ftrace_regs *regs)
{
return (unsigned long)regs + sizeof(struct __arch_ftrace_regs) + 4;
}
next prev parent reply other threads:[~2024-12-13 17:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 15:26 [for-linus][PATCH 0/3] ftrace: Fixes for 6.13 Steven Rostedt
2024-12-13 15:26 ` [for-linus][PATCH 1/3] tracing: Fix trace output when pointer hash is disabled Steven Rostedt
2024-12-13 15:26 ` [for-linus][PATCH 2/3] fgraph: Still initialize idle shadow stacks when starting Steven Rostedt
2024-12-13 15:26 ` [for-linus][PATCH 3/3] ftrace/microblaze: Do not find "true_parent" for return address Steven Rostedt
2024-12-13 15:39 ` Michal Simek
2024-12-13 17:00 ` Steven Rostedt
2024-12-13 17:29 ` Al Viro [this message]
2024-12-13 20:20 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241213172947.GJ3387508@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=monstr@monstr.eu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox