lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADxym3a2QcujvvmVgWv9OvJXn=SGVeFN2zSPEQAmFkk2SH2iNA@mail.gmail.com>
Date: Wed, 12 Feb 2025 14:49:33 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
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 Wed, Feb 12, 2025 at 12:24 AM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> 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.

Sorry that the log didn't describe it accurately, the multi callback
case is just what I meant. I'm not sure if it is suitable for such a
case, so let me just remove this part from the commit log, and
let's see it later :/

>
> > > 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.

Thank you for your explanation. It seems that it is quite
simple to implement the function meta data in arm64. Let
me dig it deeper on arm64, and I'll implement it together
with x86 in the next version if it is possible.

Thanks!
Menglong Dong

>
> -- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ