[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250211112413.4c43a9ca@gandalf.local.home>
Date: Tue, 11 Feb 2025 11:24:13 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Menglong Dong <menglong8.dong@...il.com>
Cc: alexei.starovoitov@...il.com, x86@...nel.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com, hpa@...or.com,
mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
dongml2@...natelecom.cn, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [RFC PATCH] x86: add function metadata support
On Tue, 11 Feb 2025 20:03:38 +0800
Menglong Dong <menglong8.dong@...il.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
Powered by blists - more mailing lists