From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1E0E817552; Mon, 1 Apr 2024 15:57:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711987037; cv=none; b=nRUEnkdV9nTDCXyaNss9r0zxsjhqs2+unLdT0Ntd+fqnMT1aGdEEu0Tb8Q1yo5bk6Goe+GaGR+KKdRUj8Fr+k9MLBaMBF+LVLEC/HdL1gssBamsIWtLYoU36RafdBVBaXMDXEn3eZzNDljcTiXy3zPz48/4CpEQlgoPE5Njg3lU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711987037; c=relaxed/simple; bh=hWWP4R/JFRFxsD5wn5WwHEfJM77NgnC9mgolOKg4FdM=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kc4KM8If9MVLcx2Pt5XaiXk/SbmBLTBjJ+liGWJD4J3Q85j84V+1xIooH1i6mkZ9KzAmsxmPDcrzwAblhiYUm+OdlN4fu0QjT4bz8/FWVyg9OXBWfGthhCjHOpND+tw+QpZS3e6QYFm8xbDzVjzRDJWvW8wVRFAQK0GsUQMF/tM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77C86C433F1; Mon, 1 Apr 2024 15:57:13 +0000 (UTC) Date: Mon, 1 Apr 2024 11:59:28 -0400 From: Steven Rostedt To: =?UTF-8?B?5qKm6b6Z6JGj?= Cc: Alexei Starovoitov , Jiri Olsa , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Eddy Z , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "David S. Miller" , David Ahern , Dave Hansen , X86 ML , Mathieu Desnoyers , Quentin Monnet , bpf , linux-arm-kernel , LKML , linux-riscv , linux-s390 , Network Development , linux-trace-kernel@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , linux-stm32@st-md-mailman.stormreply.com Subject: Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args Message-ID: <20240401115928.3d012be2@gandalf.local.home> In-Reply-To: References: <20240311093526.1010158-1-dongmenglong.8@bytedance.com> <20240311093526.1010158-2-dongmenglong.8@bytedance.com> <20240328111330.194dcbe5@gandalf.local.home> <20240330153722.65104301@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 1 Apr 2024 10:28:17 +0800 =E6=A2=A6=E9=BE=99=E8=91=A3 wrote: > On Sun, Mar 31, 2024 at 3:34=E2=80=AFAM Steven Rostedt wrote: > > > > On Sat, 30 Mar 2024 11:18:29 +0800 > > =E6=A2=A6=E9=BE=99=E8=91=A3 wrote: > > =20 > > > > If you really want to have thousands of functions, why not just reg= ister it > > > > with ftrace itself. It will give you the arguments via the ftrace_r= egs > > > > structure. Can't you just register a program as the callback? > > > > =20 > > > > > > Ennn...I don't understand. The main purpose for > > > me to use TRACING is: > > > > > > 1. we can directly access the memory, which is more > > > efficient. =20 > > > > I'm not sure what you mean by the above. Access what memory? > > =20 >=20 > We need to use the helper of bpf_probe_read_kernel > when we read "skb->sk" in kprobe, and the "skb" is the > 1st arg in ip_rcv(). And we can directly read "skb->sk" > in tracing, which is more efficient. Isn't it? If you add a ftrace_ops function handler that calls a BPF program, I don't see why you can't just give it the parameters it needs instead of using bpf helpers. It's no different than using a trampoline to do the same thing. -- Steve