diff mbox series

[v16,01/18] tracing: Use arch_ftrace_regs() for ftrace_regs_*() macros

Message ID 172895572290.107311.16057631001860177198.stgit@devnote2 (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply
bpf/vmtest-bpf-PR fail merge-conflict

Commit Message

Masami Hiramatsu (Google) Oct. 15, 2024, 1:28 a.m. UTC
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Since the arch_ftrace_get_regs(fregs) is only valid when the
FL_SAVE_REGS is set, we need to use `&arch_ftrace_regs()->regs` for
ftrace_regs_*() APIs because those APIs are for ftrace_regs, not
complete pt_regs.

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 include/linux/ftrace_regs.h |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Steven Rostedt Oct. 15, 2024, 9:27 p.m. UTC | #1
FYI, for anything to do with function hooks (fentry), the subject should be
"ftrace:" not "tracing:".

Tracing has to do with the tracing infrastructure, whereas ftrace is the
function hook infrastructure.

I just accepted the first two patches of this series and made the changes
to the subjects.

If a change is for function graph infrastructure specifically, you can use
"fgraph:" instead.

-- Steve


On Tue, 15 Oct 2024 10:28:43 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> 
> Since the arch_ftrace_get_regs(fregs) is only valid when the
> FL_SAVE_REGS is set, we need to use `&arch_ftrace_regs()->regs` for
> ftrace_regs_*() APIs because those APIs are for ftrace_regs, not
> complete pt_regs.
>
Masami Hiramatsu (Google) Oct. 15, 2024, 11:25 p.m. UTC | #2
On Tue, 15 Oct 2024 17:27:57 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> 
> FYI, for anything to do with function hooks (fentry), the subject should be
> "ftrace:" not "tracing:".

Ah, yes.

> 
> Tracing has to do with the tracing infrastructure, whereas ftrace is the
> function hook infrastructure.
> 
> I just accepted the first two patches of this series and made the changes
> to the subjects.

OK, thanks!

> 
> If a change is for function graph infrastructure specifically, you can use
> "fgraph:" instead.

Just to confirm, is "function_graph:" for function graph tracer itself?

Thank you,

> 
> -- Steve
> 
> 
> On Tue, 15 Oct 2024 10:28:43 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> 
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > 
> > Since the arch_ftrace_get_regs(fregs) is only valid when the
> > FL_SAVE_REGS is set, we need to use `&arch_ftrace_regs()->regs` for
> > ftrace_regs_*() APIs because those APIs are for ftrace_regs, not
> > complete pt_regs.
> >
Steven Rostedt Oct. 15, 2024, 11:28 p.m. UTC | #3
On Wed, 16 Oct 2024 08:25:41 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> > 
> > If a change is for function graph infrastructure specifically, you can use
> > "fgraph:" instead.  
> 
> Just to confirm, is "function_graph:" for function graph tracer itself?

If it is for the function graph tracer, I would use "function_graph:"
if it's for the function graph infrastructure, I would use "fgraph:"

Thanks,

-- Steve
diff mbox series

Patch

diff --git a/include/linux/ftrace_regs.h b/include/linux/ftrace_regs.h
index dea6a0851b74..b78a0a60515b 100644
--- a/include/linux/ftrace_regs.h
+++ b/include/linux/ftrace_regs.h
@@ -17,17 +17,17 @@  struct __arch_ftrace_regs {
 struct ftrace_regs;
 
 #define ftrace_regs_get_instruction_pointer(fregs) \
-	instruction_pointer(arch_ftrace_get_regs(fregs))
+	instruction_pointer(&arch_ftrace_regs(fregs)->regs)
 #define ftrace_regs_get_argument(fregs, n) \
-	regs_get_kernel_argument(arch_ftrace_get_regs(fregs), n)
+	regs_get_kernel_argument(&arch_ftrace_regs(fregs)->regs, n)
 #define ftrace_regs_get_stack_pointer(fregs) \
-	kernel_stack_pointer(arch_ftrace_get_regs(fregs))
+	kernel_stack_pointer(&arch_ftrace_regs(fregs)->regs)
 #define ftrace_regs_return_value(fregs) \
-	regs_return_value(arch_ftrace_get_regs(fregs))
+	regs_return_value(&arch_ftrace_regs(fregs)->regs)
 #define ftrace_regs_set_return_value(fregs, ret) \
-	regs_set_return_value(arch_ftrace_get_regs(fregs), ret)
+	regs_set_return_value(&arch_ftrace_regs(fregs)->regs, ret)
 #define ftrace_override_function_with_return(fregs) \
-	override_function_with_return(arch_ftrace_get_regs(fregs))
+	override_function_with_return(&arch_ftrace_regs(fregs)->regs)
 #define ftrace_regs_query_register_offset(name) \
 	regs_query_register_offset(name)