public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Jiri Olsa" <olsajiri@gmail.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	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>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Björn Töpel" <bjorn@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>
Subject: Re: [PATCHv2 bpf-next 2/2] bpf: Move bpf_dispatcher function out of ftrace locations
Date: Sat, 3 Sep 2022 15:11:02 +0200	[thread overview]
Message-ID: <YxNSZvmRCyYzfee7@krava> (raw)
In-Reply-To: <YxI7aC4L495CwZWE@hirez.programming.kicks-ass.net>

On Fri, Sep 02, 2022 at 07:20:40PM +0200, Peter Zijlstra wrote:
> On Fri, Sep 02, 2022 at 06:53:38PM +0200, Jiri Olsa wrote:
> > > Are you sure you want the notrace x86_64 only?
> > > 
> > > That is, perhaps something like this...
> > > 
> > > +#ifdef CONFIG_X86_64
> > > +#define BPF_DISPATCHER_ATTRIBUTES	   __attribute__((patchable_function_entry(5)))
> > > +#else
> > > +#define BPF_DISPATCHER_ATTRIBUTES
> > > +#endif
> > > +
> > >  #define DEFINE_BPF_DISPATCHER(name)					\
> > > +	notrace BPF_DISPATCHER_ATTRIBUTES				\
> > >  	noinline __nocfi unsigned int bpf_dispatcher_##name##_func(	\
> > > 
> > 
> > that's also an option.. but I don't this it's big deal that the function
> > is traceable on other arches, because the dispatcher image is generated
> > only on x86, so no other arch is touching that function entry, so it's
> > safe for ftrace to attach
> 
> It just seems like a pointless difference.

ok, I'll use notrace as default

> 
> From a code-gen POV you don't strictly need the notrace; without it
> it'll generate:
> 
> bpf_dispatcher_name_func:
> 	nop
> 	nop
> 	nop
> 	nop
> 	nop
> 	call __fentry__
> 	RET
> 
> It'll just function 'weird', but it'll 'work'.

I'll use notrace for all archs as you suggests, so there's less
surprise in future if some other arch implements dispatcher image

thanks,
jirka

      reply	other threads:[~2022-09-03 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 13:41 [PATCHv2 bpf-next 0/2] bpf,ftrace: bpf dispatcher function fix Jiri Olsa
2022-09-01 13:41 ` [PATCHv2 bpf-next 1/2] ftrace: Add HAVE_DYNAMIC_FTRACE_NO_PATCHABLE Jiri Olsa
2022-09-01 13:41 ` [PATCHv2 bpf-next 2/2] bpf: Move bpf_dispatcher function out of ftrace locations Jiri Olsa
2022-09-02 11:14   ` Peter Zijlstra
2022-09-02 16:53     ` Jiri Olsa
2022-09-02 17:20       ` Peter Zijlstra
2022-09-03 13:11         ` Jiri Olsa [this message]

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=YxNSZvmRCyYzfee7@krava \
    --to=olsajiri@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=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.com \
    --cc=tglx@linutronix.de \
    --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