* Please help, I want kprobe.multi support on arm64, but regs is replaced by args
@ 2023-06-25 8:27 Jackie Liu
2023-06-27 17:06 ` Masami Hiramatsu
0 siblings, 1 reply; 3+ messages in thread
From: Jackie Liu @ 2023-06-25 8:27 UTC (permalink / raw)
To: Mark Rutland, linux-arm-kernel,
rostedt@goodmis.org >> Steven Rostedt, Masami Hiramatsu,
Jiri Olsa
Hi, Mark Rutland and other developers.
I am trying to implement the rethook of the arm64 platform, referring to
the code of other architectures, it can already run normally on the v6.1
branch, but after commit 26299b3f6ba2 ("ftrace: arm64: move from REGS to
ARGS"), regs is no longer supported, resulting in CONFIG_FPROBE is also
not supported (although RETHOOK is implemented). I try to revert the
patch, and kprobe.multi can be run correctly. Now, what should I do?
Should I roll back this patch or find a way to run fprobe without regs?
Any help is welcome.
--
Jackie Liu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Please help, I want kprobe.multi support on arm64, but regs is replaced by args
2023-06-25 8:27 Please help, I want kprobe.multi support on arm64, but regs is replaced by args Jackie Liu
@ 2023-06-27 17:06 ` Masami Hiramatsu
2023-06-28 0:50 ` Jackie Liu
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2023-06-27 17:06 UTC (permalink / raw)
To: Jackie Liu
Cc: Mark Rutland, linux-arm-kernel,
rostedt@goodmis.org >> Steven Rostedt, Jiri Olsa,
Linux Trace Kernel, bpf
Hi Jackie,
That is actiall what I'm working on now :)
Here is my previous implementation (but not applicable because now we need to
remove kretprobe trampoline with it.)
https://lore.kernel.org/all/164735287344.1084943.9787335632585653418.stgit@devnote2/
Let me explain my idea. I would like to replace the kretprobe with fprobe
exit handler so that we can intgrate the function return hook with fgraph tracer.
Currently fprobe entry/exit handler uses pt_regs, but I will replace it with
ftrace_regs. And this means rethook has to work with ftrace_regs and it can not
support kretprobes anymore on some arch (HAVE_RETHOOK but
!HAVE_DYNAMIC_FTRACE_WITH_REGS).
There are many good reasons, like;
- On some arch (e.g. arm64) can not emulate full pt_regs.
- Saving full register on function entry/exit is not efficient.
- Enabling both fgraph tracer and rethook are redundant.
This requires some changes on kprobe users like BPF and SystemTap, so I need to
talk with them about
- Moving onto the fprobe to trace function entry/exit.
- Using ftrace_regs API to access function argument and return value.
Anyway, I'll add CONFIG_DYNAMIC_FTRACE_WITH_REGS dependency to them until
in-kernel stuffs are ready. It ensures ftrace_regs can be converted to
pt_regs.
I also introduced fprobe events, so I will send a series of patches how to do
that (fprobe entry side has been done, working on rethook side).
Thank you,
On Sun, 25 Jun 2023 16:27:44 +0800
Jackie Liu <liu.yun@linux.dev> wrote:
> Hi, Mark Rutland and other developers.
>
> I am trying to implement the rethook of the arm64 platform, referring to
> the code of other architectures, it can already run normally on the v6.1
> branch, but after commit 26299b3f6ba2 ("ftrace: arm64: move from REGS to
> ARGS"), regs is no longer supported, resulting in CONFIG_FPROBE is also
> not supported (although RETHOOK is implemented). I try to revert the
> patch, and kprobe.multi can be run correctly. Now, what should I do?
> Should I roll back this patch or find a way to run fprobe without regs?
>
> Any help is welcome.
>
> --
> Jackie Liu
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Please help, I want kprobe.multi support on arm64, but regs is replaced by args
2023-06-27 17:06 ` Masami Hiramatsu
@ 2023-06-28 0:50 ` Jackie Liu
0 siblings, 0 replies; 3+ messages in thread
From: Jackie Liu @ 2023-06-28 0:50 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Mark Rutland, linux-arm-kernel,
rostedt@goodmis.org >> Steven Rostedt, Jiri Olsa,
Linux Trace Kernel, bpf
Hi, Masami.
在 2023/6/28 01:06, Masami Hiramatsu (Google) 写道:
> Hi Jackie,
>
> That is actiall what I'm working on now :)
>
> Here is my previous implementation (but not applicable because now we need to
> remove kretprobe trampoline with it.)
> https://lore.kernel.org/all/164735287344.1084943.9787335632585653418.stgit@devnote2/
>
> Let me explain my idea. I would like to replace the kretprobe with fprobe
> exit handler so that we can intgrate the function return hook with fgraph tracer.
> Currently fprobe entry/exit handler uses pt_regs, but I will replace it with
> ftrace_regs. And this means rethook has to work with ftrace_regs and it can not
> support kretprobes anymore on some arch (HAVE_RETHOOK but
> !HAVE_DYNAMIC_FTRACE_WITH_REGS).
>
> There are many good reasons, like;
>
> - On some arch (e.g. arm64) can not emulate full pt_regs.
> - Saving full register on function entry/exit is not efficient.
> - Enabling both fgraph tracer and rethook are redundant.
>
> This requires some changes on kprobe users like BPF and SystemTap, so I need to
> talk with them about
>
> - Moving onto the fprobe to trace function entry/exit.
> - Using ftrace_regs API to access function argument and return value.
>
> Anyway, I'll add CONFIG_DYNAMIC_FTRACE_WITH_REGS dependency to them until
> in-kernel stuffs are ready. It ensures ftrace_regs can be converted to
> pt_regs.
This is a great idea, thank you for your excellent work. We really need
it on arm64.
--
Jackie
>
> I also introduced fprobe events, so I will send a series of patches how to do
> that (fprobe entry side has been done, working on rethook side).
>
> Thank you,
>
>
> On Sun, 25 Jun 2023 16:27:44 +0800
> Jackie Liu <liu.yun@linux.dev> wrote:
>
>> Hi, Mark Rutland and other developers.
>>
>> I am trying to implement the rethook of the arm64 platform, referring to
>> the code of other architectures, it can already run normally on the v6.1
>> branch, but after commit 26299b3f6ba2 ("ftrace: arm64: move from REGS to
>> ARGS"), regs is no longer supported, resulting in CONFIG_FPROBE is also
>> not supported (although RETHOOK is implemented). I try to revert the
>> patch, and kprobe.multi can be run correctly. Now, what should I do?
>> Should I roll back this patch or find a way to run fprobe without regs?
>>
>> Any help is welcome.
>>
>> --
>> Jackie Liu
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-28 0:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-25 8:27 Please help, I want kprobe.multi support on arm64, but regs is replaced by args Jackie Liu
2023-06-27 17:06 ` Masami Hiramatsu
2023-06-28 0:50 ` Jackie Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).