From: Jiri Olsa <olsajiri@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "Jiri Olsa" <olsajiri@gmail.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>, bpf <bpf@vger.kernel.org>,
"Martin KaFai Lau" <kafai@fb.com>,
"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
"John Fastabend" <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@chromium.org>,
"Stanislav Fomichev" <sdf@google.com>,
"Hao Luo" <haoluo@google.com>,
LKML <linux-kernel@vger.kernel.org>,
"Josh Poimboeuf" <jpoimboe@redhat.com>,
"Björn Töpel" <bjorn@kernel.org>
Subject: Re: [RFC] ftrace: Add support to keep some functions out of ftrace
Date: Wed, 17 Aug 2022 21:39:36 +0200 [thread overview]
Message-ID: <Yv1D+D2mJtPR236L@krava> (raw)
In-Reply-To: <CAADnVQ+SJ7VjeXgz-wcN9OGPpfTaJVKhoyKDm895Q60C8T4-QA@mail.gmail.com>
On Wed, Aug 17, 2022 at 09:57:45AM -0700, Alexei Starovoitov wrote:
> On Wed, Aug 17, 2022 at 2:29 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> >
> > On Tue, Aug 16, 2022 at 08:56:33AM +0200, Jiri Olsa wrote:
> > > On Mon, Aug 15, 2022 at 05:48:44PM +0200, Peter Zijlstra wrote:
> > > > On Mon, Aug 15, 2022 at 08:35:53AM -0700, Alexei Starovoitov wrote:
> > > > > On Mon, Aug 15, 2022 at 8:28 AM Peter Zijlstra <peterz@infradead.org> wrote:
> > > > > >
> > > > > > On Mon, Aug 15, 2022 at 08:17:42AM -0700, Alexei Starovoitov wrote:
> > > > > > > It's hiding a fake function from ftrace, since it's not a function
> > > > > > > and ftrace infra shouldn't show it tracing logs.
> > > > > > > In other words it's a _notrace_ function with nop5.
> > > > > >
> > > > > > Then make it a notrace function with a nop5 in it. That isn't hard.
> > > > >
> > > > > That's exactly what we're trying to do.
> > > >
> > > > All the while claiming ftrace is broken while it is not.
> > > >
> > > > > Jiri's patch is one way to achieve that.
> > > >
> > > > Fairly horrible way.
> > > >
> > > > > What is your suggestion?
> > > >
> > > > Mailed it already.
> > > >
> > > > > Move it from C to asm ?
> > > >
> > > > Would be much better than proposed IMO.
> > >
> > > nice, that would be independent of the compiler atributes
> > > and config checking.. will check on this one ;-)
> >
> > how about something like below?
> >
> > dispatcher code is generated only for x86_64, so that will be covered
> > by the assembly version (free of ftrace table) other archs stay same
> >
> > jirka
> >
> >
> > ----
> > diff --git a/arch/x86/net/Makefile b/arch/x86/net/Makefile
> > index 383c87300b0d..94964002eaae 100644
> > --- a/arch/x86/net/Makefile
> > +++ b/arch/x86/net/Makefile
> > @@ -7,4 +7,5 @@ ifeq ($(CONFIG_X86_32),y)
> > obj-$(CONFIG_BPF_JIT) += bpf_jit_comp32.o
> > else
> > obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o
> > + obj-$(CONFIG_BPF_JIT) += bpf_dispatcher.o
> > endif
> > diff --git a/arch/x86/net/bpf_dispatcher.S b/arch/x86/net/bpf_dispatcher.S
> > new file mode 100644
> > index 000000000000..65790a1286e8
> > --- /dev/null
> > +++ b/arch/x86/net/bpf_dispatcher.S
> > @@ -0,0 +1,10 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#include <linux/linkage.h>
> > +#include <asm/nops.h>
> > +#include <asm/nospec-branch.h>
> > +
> > + .text
> > +SYM_FUNC_START(bpf_dispatcher_xdp_func)
> > + ASM_NOP5
> > + JMP_NOSPEC rdx
> > +SYM_FUNC_END(bpf_dispatcher_xdp_func)
>
> Wait. Why asm ? Did you try Peter's suggestion:
> __attribute__((__no_instrument_function__))
> __attribute__((patchable_function_entry(5)))
ah so this suggestion came in the other thread after the asm one.. ok, will check
jirka
next prev parent reply other threads:[~2022-08-17 19:39 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220722110811.124515-1-jolsa@kernel.org>
[not found] ` <20220722072608.17ef543f@rorschach.local.home>
[not found] ` <CAADnVQ+hLnyztCi9aqpptjQk-P+ByAkyj2pjbdD45dsXwpZ0bw@mail.gmail.com>
[not found] ` <20220722120854.3cc6ec4b@gandalf.local.home>
[not found] ` <20220722122548.2db543ca@gandalf.local.home>
[not found] ` <YtsRD1Po3qJy3w3t@krava>
[not found] ` <20220722174120.688768a3@gandalf.local.home>
[not found] ` <YtxqjxJVbw3RD4jt@krava>
[not found] ` <YvbDlwJCTDWQ9uJj@krava>
2022-08-13 19:02 ` [RFC] ftrace: Add support to keep some functions out of ftrace Steven Rostedt
2022-08-14 11:32 ` Steven Rostedt
2022-08-14 15:22 ` Jiri Olsa
2022-08-15 2:07 ` Chen Zhongjin
2022-08-15 8:04 ` Jiri Olsa
2022-08-15 11:01 ` Björn Töpel
2022-08-15 11:29 ` Jiri Olsa
2022-08-15 12:19 ` Björn Töpel
2022-08-15 12:30 ` Björn Töpel
2022-08-15 8:03 ` Peter Zijlstra
2022-08-15 9:44 ` Jiri Olsa
2022-08-15 12:37 ` Peter Zijlstra
2022-08-15 14:25 ` Alexei Starovoitov
2022-08-15 14:33 ` Peter Zijlstra
2022-08-15 14:45 ` Alexei Starovoitov
2022-08-15 15:02 ` Peter Zijlstra
2022-08-15 15:17 ` Alexei Starovoitov
2022-08-15 15:28 ` Peter Zijlstra
2022-08-15 15:35 ` Alexei Starovoitov
2022-08-15 15:44 ` Steven Rostedt
2022-08-15 15:53 ` Alexei Starovoitov
2022-08-15 16:13 ` Steven Rostedt
2022-08-15 15:48 ` Peter Zijlstra
2022-08-16 6:56 ` Jiri Olsa
2022-08-17 9:29 ` Jiri Olsa
2022-08-17 16:57 ` Alexei Starovoitov
2022-08-17 19:39 ` Jiri Olsa [this message]
2022-08-15 15:41 ` Peter Zijlstra
2022-08-15 15:49 ` Alexei Starovoitov
2022-08-15 16:08 ` Steven Rostedt
2022-08-18 20:27 ` Jiri Olsa
2022-08-18 20:50 ` Steven Rostedt
2022-08-18 21:00 ` Alexei Starovoitov
2022-08-18 21:05 ` Steven Rostedt
2022-08-18 21:32 ` Jiri Olsa
2022-08-19 11:45 ` Jiri Olsa
2022-08-23 17:23 ` Alexei Starovoitov
2022-08-26 8:00 ` Jiri Olsa
2022-08-18 21:14 ` Jiri Olsa
2022-08-15 15:32 ` Steven Rostedt
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=Yv1D+D2mJtPR236L@krava \
--to=olsajiri@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jpoimboe@redhat.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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