From: Mark Rutland <mark.rutland@arm.com>
To: Florent Revest <revest@chromium.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
bpf@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org,
rostedt@goodmis.org, mhiramat@kernel.org, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org,
jolsa@kernel.org, xukuohai@huaweicloud.com, lihuafei1@huawei.com
Subject: Re: [PATCH v6 3/5] samples: ftrace: Save required argument registers in sample trampolines
Date: Thu, 6 Apr 2023 11:22:09 +0100 [thread overview]
Message-ID: <ZC6dUacJjFVDyDGz@FVFF77S0Q05N> (raw)
In-Reply-To: <20230405180250.2046566-4-revest@chromium.org>
On Wed, Apr 05, 2023 at 08:02:48PM +0200, Florent Revest wrote:
> The ftrace-direct-too sample traces the handle_mm_fault function whose
> signature changed since the introduction of the sample. Since:
> commit bce617edecad ("mm: do page fault accounting in handle_mm_fault")
> handle_mm_fault now has 4 arguments. Therefore, the sample trampoline
> should save 4 argument registers.
>
> s390 saves all argument registers already so it does not need a change
> but x86_64 needs an extra push and pop.
>
> This also evolves the signature of the tracing function to make it
> mirror the signature of the traced function.
>
> Signed-off-by: Florent Revest <revest@chromium.org>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Thanks for this!
Mark.
> ---
> samples/ftrace/ftrace-direct-too.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/samples/ftrace/ftrace-direct-too.c b/samples/ftrace/ftrace-direct-too.c
> index f28e7b99840f..71ed4ee8cb4a 100644
> --- a/samples/ftrace/ftrace-direct-too.c
> +++ b/samples/ftrace/ftrace-direct-too.c
> @@ -5,14 +5,14 @@
> #include <linux/ftrace.h>
> #include <asm/asm-offsets.h>
>
> -extern void my_direct_func(struct vm_area_struct *vma,
> - unsigned long address, unsigned int flags);
> +extern void my_direct_func(struct vm_area_struct *vma, unsigned long address,
> + unsigned int flags, struct pt_regs *regs);
>
> -void my_direct_func(struct vm_area_struct *vma,
> - unsigned long address, unsigned int flags)
> +void my_direct_func(struct vm_area_struct *vma, unsigned long address,
> + unsigned int flags, struct pt_regs *regs)
> {
> - trace_printk("handle mm fault vma=%p address=%lx flags=%x\n",
> - vma, address, flags);
> + trace_printk("handle mm fault vma=%p address=%lx flags=%x regs=%p\n",
> + vma, address, flags, regs);
> }
>
> extern void my_tramp(void *);
> @@ -34,7 +34,9 @@ asm (
> " pushq %rdi\n"
> " pushq %rsi\n"
> " pushq %rdx\n"
> +" pushq %rcx\n"
> " call my_direct_func\n"
> +" popq %rcx\n"
> " popq %rdx\n"
> " popq %rsi\n"
> " popq %rdi\n"
> --
> 2.40.0.577.gac1e443424-goog
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-04-06 10:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 18:02 [PATCH v6 0/5] Add ftrace direct call for arm64 Florent Revest
2023-04-05 18:02 ` [PATCH v6 1/5] arm64: ftrace: Add direct call support Florent Revest
2023-04-05 18:02 ` [PATCH v6 2/5] arm64: ftrace: Simplify get_ftrace_plt Florent Revest
2023-04-05 18:02 ` [PATCH v6 3/5] samples: ftrace: Save required argument registers in sample trampolines Florent Revest
2023-04-05 20:40 ` Steven Rostedt
2023-04-06 10:22 ` Mark Rutland [this message]
2023-04-05 18:02 ` [PATCH v6 4/5] arm64: ftrace: Add direct call trampoline samples support Florent Revest
2023-04-06 10:50 ` Mark Rutland
2023-04-05 18:02 ` [PATCH v6 5/5] selftests/bpf: Update the tests deny list on aarch64 Florent Revest
2023-04-11 15:56 ` [PATCH v6 0/5] Add ftrace direct call for arm64 Mark Rutland
2023-04-11 16:47 ` Steven Rostedt
2023-04-11 17:08 ` Will Deacon
2023-04-11 17:44 ` Steven Rostedt
2023-04-11 17:54 ` Will Deacon
2023-04-12 9:50 ` Mark Rutland
2023-04-24 20:09 ` Steven Rostedt
2023-04-11 18:37 ` Will Deacon
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=ZC6dUacJjFVDyDGz@FVFF77S0Q05N \
--to=mark.rutland@arm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=lihuafei1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=revest@chromium.org \
--cc=rostedt@goodmis.org \
--cc=will@kernel.org \
--cc=xukuohai@huaweicloud.com \
/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