From: Steven Rostedt <rostedt@goodmis.org>
To: Menglong Dong <menglong8.dong@gmail.com>
Cc: alexei.starovoitov@gmail.com, x86@kernel.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
hpa@zytor.com, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, dongml2@chinatelecom.cn,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
bpf@vger.kernel.org
Subject: Re: [RFC PATCH] x86: add function metadata support
Date: Tue, 11 Feb 2025 11:24:13 -0500 [thread overview]
Message-ID: <20250211112413.4c43a9ca@gandalf.local.home> (raw)
In-Reply-To: <CADxym3YzTc8wyAndNP4OpK8JSLWkpCAMgJox49ioUBXrov1h=w@mail.gmail.com>
On Tue, 11 Feb 2025 20:03:38 +0800
Menglong Dong <menglong8.dong@gmail.com> wrote:
>
> Another beneficiary can be ftrace. For now, all the kernel functions that
> are enabled by dynamic ftrace will be added to a filter hash. And hash
> lookup will happen when then traced functions are called, which has an
> impact on the performance, see
> __ftrace_ops_list_func() -> ftrace_ops_test(). With the per-function metadata
> support, we can store the information that if the ftrace ops is enabled on the
> kernel function to the metadata.
Note, ftrace only uses ftrace_ops_list if there's more than one callback
attached to the same function. Otherwise it calls directly to a single
trampoline, and is rather efficient. No meta data needed.
> > Arm64 and other archs add meta data before the functions too. Can we have
> > an effort to perhaps share these methods?
>
> I have not done research on arm64 yet. AFAIK, arm64 insn is 16-bytes aligned,
> so the way we process can be a little different here, as making kernel function
> non 16-bytes aligned can have a huge influence.
Arm64 already uses the meta data before every function. That's where it
stores a pointer to the ftrace_ops. So in ftrace, when there's a single
callback attached to a function in arm64, it jumps to a ftrace trampoline,
that will reference the function's meta data to find the ftrace_ops to use
for that callback.
If more than one callback is attached to the same function, then it acts
just like x86 and does the loop.
-- Steve
next prev parent reply other threads:[~2025-02-11 16:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 10:40 [RFC PATCH] x86: add function metadata support Menglong Dong
2025-02-10 23:05 ` Steven Rostedt
2025-02-11 12:03 ` Menglong Dong
2025-02-11 16:24 ` Steven Rostedt [this message]
2025-02-12 6:49 ` Menglong Dong
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=20250211112413.4c43a9ca@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=alexei.starovoitov@gmail.com \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=dongml2@chinatelecom.cn \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=menglong8.dong@gmail.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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