From: "Paul E. McKenney" <paulmck@kernel.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: davem@davemloft.net, daniel@iogearbox.net, josef@toxicpanda.com,
netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH bpf-next] bpf: Fix build without BPF_SYSCALL, but with BPF_JIT.
Date: Sun, 30 Aug 2020 15:03:13 -0700 [thread overview]
Message-ID: <20200830220313.GV2855@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <20200830204328.50419-1-alexei.starovoitov@gmail.com>
On Sun, Aug 30, 2020 at 01:43:28PM -0700, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> When CONFIG_BPF_SYSCALL is not set, but CONFIG_BPF_JIT=y
> the kernel build fails:
> In file included from ../kernel/bpf/trampoline.c:11:
> ../kernel/bpf/trampoline.c: In function ‘bpf_trampoline_update’:
> ../kernel/bpf/trampoline.c:220:39: error: ‘call_rcu_tasks_trace’ undeclared
> ../kernel/bpf/trampoline.c: In function ‘__bpf_prog_enter_sleepable’:
> ../kernel/bpf/trampoline.c:411:2: error: implicit declaration of function ‘rcu_read_lock_trace’
> ../kernel/bpf/trampoline.c: In function ‘__bpf_prog_exit_sleepable’:
> ../kernel/bpf/trampoline.c:416:2: error: implicit declaration of function ‘rcu_read_unlock_trace’
>
> Add these functions to rcupdate_trace.h.
> The JIT won't call them and BPF trampoline logic won't be used without BPF_SYSCALL.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: 1e6c62a88215 ("bpf: Introduce sleepable BPF programs")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
A couple of nits below, but overall:
Acked-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> include/linux/rcupdate_trace.h | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/rcupdate_trace.h b/include/linux/rcupdate_trace.h
> index d9015aac78c6..334840f4f245 100644
> --- a/include/linux/rcupdate_trace.h
> +++ b/include/linux/rcupdate_trace.h
> @@ -82,7 +82,19 @@ static inline void rcu_read_unlock_trace(void)
> void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func);
> void synchronize_rcu_tasks_trace(void);
> void rcu_barrier_tasks_trace(void);
> -
> +#else
This formulation is a bit novel for RCU. Could we therefore please add
a comment something like this?
// The BPF JIT forms these addresses even when it doesn't call these
// functions, so provide definitions that result in runtime errors.
> +static inline void call_rcu_tasks_trace(struct rcu_head *rhp, rcu_callback_t func)
> +{
> + BUG();
> +}
> +static inline void rcu_read_lock_trace(void)
> +{
> + BUG();
> +}
> +static inline void rcu_read_unlock_trace(void)
> +{
> + BUG();
> +}
People have been moving towards one-liner for things like these last two:
static inline void rcu_read_lock_trace(void) { BUG(); }
static inline void rcu_read_unlock_trace(void) { BUG(); }
> #endif /* #ifdef CONFIG_TASKS_TRACE_RCU */
>
> #endif /* __LINUX_RCUPDATE_TRACE_H */
> --
> 2.23.0
>
next prev parent reply other threads:[~2020-08-30 22:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-30 20:43 [PATCH bpf-next] bpf: Fix build without BPF_SYSCALL, but with BPF_JIT Alexei Starovoitov
2020-08-30 22:03 ` Paul E. McKenney [this message]
2020-08-31 0:53 ` Alexei Starovoitov
2020-08-31 4:46 ` Paul E. McKenney
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=20200830220313.GV2855@paulmck-ThinkPad-P72 \
--to=paulmck@kernel.org \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/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