BPF List
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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>
Subject: Re: [PATCH bpf] bpf: Make session kfuncs global
Date: Fri, 31 May 2024 13:25:14 +0200	[thread overview]
Message-ID: <ZlmzmstEQSMp-6_i@krava> (raw)
In-Reply-To: <20240531104922.ZgOadg-G@linutronix.de>

On Fri, May 31, 2024 at 12:49:22PM +0200, Sebastian Andrzej Siewior wrote:
> On 2024-05-31 12:42:41 [+0200], Jiri Olsa wrote:
> > On Fri, May 31, 2024 at 12:39:31PM +0200, Sebastian Andrzej Siewior wrote:
> > > On 2024-05-31 12:15:50 [+0200], Jiri Olsa wrote:
> > > > The bpf_session_cookie is unavailable for !CONFIG_FPROBE as reported
> > > > by Sebastian [1].
> > > > 
> > > > Instead of adding more ifdefs, making the session kfuncs globally
> > > > available as suggested by Alexei. It's still allowed only for
> > > > session programs, but it won't fail the build.
> > > 
> > > but this relies on CONFIG_UPROBE_EVENTS=y
> > > What about CONFIG_UPROBE_EVENTS=n?
> > 
> > hum, I can't see that.. also I tested it with CONFIG_UPROBE_EVENTS=n,
> > the CONFIG_UPROBES ifdef is ended right above this code..
> 
> Your patch + v6.10-rc1 + https://breakpoint.cc/config-2024-03-31.xz

ah there's also CONFIG_KPROBE=n

kernel/trace/bpf_trace.c is enabled with CONFIG_BPF_EVENTS,
which has:

        depends on BPF_SYSCALL
        depends on (KPROBE_EVENTS || UPROBE_EVENTS) && PERF_EVENTS

so I think we chould combine both like below

jirka


---
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 77da1f438bec..cb202a289cf6 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -11124,7 +11124,11 @@ BTF_ID(func, bpf_iter_css_task_new)
 #else
 BTF_ID_UNUSED
 #endif
+#ifdef CONFIG_BPF_EVENTS
 BTF_ID(func, bpf_session_cookie)
+#else
+BTF_ID_UNUSED
+#endif
 
 static bool is_kfunc_ret_null(struct bpf_kfunc_call_arg_meta *meta)
 {
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index f5154c051d2c..cc90d56732eb 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -3519,7 +3519,6 @@ static u64 bpf_uprobe_multi_entry_ip(struct bpf_run_ctx *ctx)
 }
 #endif /* CONFIG_UPROBES */
 
-#ifdef CONFIG_FPROBE
 __bpf_kfunc_start_defs();
 
 __bpf_kfunc bool bpf_session_is_return(void)
@@ -3568,4 +3567,3 @@ static int __init bpf_kprobe_multi_kfuncs_init(void)
 }
 
 late_initcall(bpf_kprobe_multi_kfuncs_init);
-#endif

  reply	other threads:[~2024-05-31 11:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 10:15 [PATCH bpf] bpf: Make session kfuncs global Jiri Olsa
2024-05-31 10:39 ` Sebastian Andrzej Siewior
2024-05-31 10:42   ` Jiri Olsa
2024-05-31 10:49     ` Sebastian Andrzej Siewior
2024-05-31 11:25       ` Jiri Olsa [this message]
2024-05-31 14:04         ` Sebastian Andrzej Siewior
2024-05-31 16:55           ` 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=ZlmzmstEQSMp-6_i@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bigeasy@linutronix.de \
    --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=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