Thread (3 messages) 3 messages, 3 authors, 2025-08-28

Re: [PATCH bpf-next] bpf: remove unnecessary rcu_read_lock in kprobe_multi_link_prog_run

From: Alexei Starovoitov <hidden>
Date: 2025-08-27 16:22:03
Also in: bpf, lkml

On Wed, Aug 27, 2025 at 5:38 AM Menglong Dong [off-list ref] wrote:
Preemption is disabled in ftrace graph, which indicate rcu_read_lock. So
the rcu_read_lock is not needed in fprobe_entry(), and it is not needed
in kprobe_multi_link_prog_run() neither.
kprobe_busy_begin() doing preempt_disable() is an implementation
detail that might change.
Having explicit rcu_read_lock() doesn't hurt.
It's a nop anyway in PREEMPT_NONE.

pw-bot: cr
quoted hunk ↗ jump to hunk
Signed-off-by: Menglong Dong <redacted>
---
 kernel/trace/bpf_trace.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 606007c387c5..0e79fa84a634 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -2741,12 +2741,10 @@ kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link,
                goto out;
        }

-       rcu_read_lock();
        regs = ftrace_partial_regs(fregs, bpf_kprobe_multi_pt_regs_ptr());
        old_run_ctx = bpf_set_run_ctx(&run_ctx.session_ctx.run_ctx);
        err = bpf_prog_run(link->link.prog, regs);
        bpf_reset_run_ctx(old_run_ctx);
-       rcu_read_unlock();

  out:
        __this_cpu_dec(bpf_prog_active);
--
2.51.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help