From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A1871990C7 for ; Thu, 28 Aug 2025 01:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756343013; cv=none; b=KI5gNVU8ZVic73KAQAfTk8HCsqP2MS1ZfSXCa0Lb2K4MfPAsIpUJAHd24aAJzBvOc/MO69AkYIlNW7IImGyhjoTzALpXZmLUwHxdbj1eEnHGmlvealM8mplQI7ebAXvIxspA65S4ld+Zp1xBtkcYeggD77sfM888V8nyAVg5AGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756343013; c=relaxed/simple; bh=b24uQsPaOHO5WcHk9xhEmDzHjmw2HswBoihdspk5wcU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Vr+pqpBoR3WUaQ75lVgqmt5hyRxkMS/q6XVhAe4iupEu7Fi5pfMrkiComuGi07G8EPSmHm64p5RASl+2Qg43aHalKdq4wJ1qQMio0lpGzoQB9vTTWPnJOnuML1Epcr4xo0dslm4atuuLhYacbPZPp1Id7fLCP2IW7wsqduCgiKg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=n9O8rFBf; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="n9O8rFBf" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1756343009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r4mNXbiX+NSPwA7+Q8DrgehkukiMG4HUmSlD8ae2wX4=; b=n9O8rFBfQ4lehqgRI0HW6JdV/AJdESHwtw1qkjaS6k31nWWYJ7AhCPk311eatnGIxsCzYL 7Ta21nr2/EjGIOHth5kftSSA8nzm963DKTWZ4fWXkkpY5o/ErQ5GhzlPGDw3Y/Yv5g/GMA T592kIKywmxMHtM+v9gUF0WmAd+ougw= From: Menglong Dong To: Menglong Dong , Alexei Starovoitov Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Matt Bobrowski , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , bpf , LKML , linux-trace-kernel Subject: Re: [PATCH bpf-next] bpf: remove unnecessary rcu_read_lock in kprobe_multi_link_prog_run Date: Thu, 28 Aug 2025 09:03:07 +0800 Message-ID: <2797045.mvXUDI8C0e@7940hx> In-Reply-To: References: <20250827123814.60217-1-dongml2@chinatelecom.cn> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Migadu-Flow: FLOW_OUT On 2025/8/28 00:21 Alexei Starovoitov write: > On Wed, Aug 27, 2025 at 5:38=E2=80=AFAM Menglong Dong 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. >=20 > 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. Ok, I see. Thanks~ >=20 > pw-bot: cr >=20 > > Signed-off-by: Menglong Dong > > --- > > 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_mu= lti_link *link, > > goto out; > > } > > > > - rcu_read_lock(); > > regs =3D ftrace_partial_regs(fregs, bpf_kprobe_multi_pt_regs_pt= r()); > > old_run_ctx =3D bpf_set_run_ctx(&run_ctx.session_ctx.run_ctx); > > err =3D 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 > > >=20 >=20