From: Jiri Olsa <olsajiri@gmail.com>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Peter Zijlstra <peterz@infradead.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>
Subject: Re: [RFC] ftrace: Add support to keep some functions out of ftrace
Date: Fri, 19 Aug 2022 13:45:34 +0200 [thread overview]
Message-ID: <Yv933mq/DTIz5g7q@krava> (raw)
In-Reply-To: <Yv6wB4El4iueJtwX@krava>
On Thu, Aug 18, 2022 at 11:32:55PM +0200, Jiri Olsa wrote:
> On Thu, Aug 18, 2022 at 02:00:21PM -0700, Alexei Starovoitov wrote:
> > On Thu, Aug 18, 2022 at 1:50 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > On Thu, 18 Aug 2022 22:27:07 +0200
> > > Jiri Olsa <olsajiri@gmail.com> wrote:
> > >
> > > > ok, so the problem with __attribute__((patchable_function_entry(5))) is that
> > > > it puts function address into __patchable_function_entries section, which is
> > > > one of ftrace locations source:
> > > >
> > > > #define MCOUNT_REC() . = ALIGN(8); \
> > > > __start_mcount_loc = .; \
> > > > KEEP(*(__mcount_loc)) \
> > > > KEEP(*(__patchable_function_entries)) \
> > > > __stop_mcount_loc = .; \
> > > > ...
> > > >
> > > >
> > > > it looks like __patchable_function_entries is used for other than x86 archs,
> > > > so we perhaps we could have x86 specific MCOUNT_REC macro just with
> > > > __mcount_loc section?
> > >
> > > So something like this:
> > >
> > > #ifdef CONFIG_X86
> > > # define NON_MCOUNT_PATCHABLE KEEP(*(__patchable_function_entries))
> > > # define MCOUNT_PATCHABLE
> > > #else
> > > # define NON_MCOUNT_PATCHABLE
> > > # define MCOUNT_PATCHABLE KEEP(*(__patchable_function_entries))
> > > #endif
> > >
> > > #define MCOUNT_REC() . = ALIGN(8); \
> > > __start_mcount_loc = .; \
> > > KEEP(*(__mcount_loc)) \
> > > MCOUNT_PATCHABLE \
> > > __stop_mcount_loc = .; \
> > > NON_MCOUNT_PATCHABLE \
> > > ...
> > >
> > > ??
> >
> > That's what more or less Peter's patch is doing:
> > Here it is again for reference:
> > https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=8d075bdf11193f1d276bf19fa56b4b8dfe24df9e
>
> ah nice, and discards the __patchable_function_entries section, great
>
tested change below with Peter's change above and it seems to work,
once it get merged I'll send full patch
thanks,
jirka
---
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 39bd36359c1e..39b6807058e9 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -924,6 +924,8 @@ int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs);
}
#define DEFINE_BPF_DISPATCHER(name) \
+ __attribute__((__no_instrument_function__)) \
+ __attribute__((patchable_function_entry(5))) \
noinline __nocfi unsigned int bpf_dispatcher_##name##_func( \
const void *ctx, \
const struct bpf_insn *insnsi, \
next prev parent reply other threads:[~2022-08-19 11:45 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 11:08 [RFC] ftrace: Add support to keep some functions out of ftrace Jiri Olsa
2022-07-22 11:26 ` Steven Rostedt
2022-07-22 16:04 ` Alexei Starovoitov
2022-07-22 16:08 ` Steven Rostedt
2022-07-22 16:25 ` Steven Rostedt
2022-07-22 16:53 ` Alexei Starovoitov
2022-07-22 17:14 ` Steven Rostedt
2022-07-22 21:05 ` Jiri Olsa
2022-07-22 21:41 ` Steven Rostedt
2022-07-23 3:53 ` Steven Rostedt
2022-07-23 3:56 ` Steven Rostedt
2022-07-25 7:00 ` Jiri Olsa
2022-07-23 21:39 ` Jiri Olsa
2022-08-12 21:18 ` Jiri Olsa
2022-08-12 21:50 ` Steven Rostedt
2022-08-13 19:02 ` 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
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 [this message]
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
2022-07-22 16:26 ` Jiri Olsa
2022-07-22 16:37 ` Steven Rostedt
2022-07-22 16:54 ` Alexei Starovoitov
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=Yv933mq/DTIz5g7q@krava \
--to=olsajiri@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@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