Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1529906lqz; Mon, 1 Apr 2024 08:57:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU33H9PdWKg9d8GAtIWzweIDD66NlykNwKG1hS++KDT4iteqr/6sK6vi5TMHUNaC0OUiOEb1RB9tgSmvQINi0j8PtpbWOnhWyMoGKoy9Q== X-Google-Smtp-Source: AGHT+IEddBm/OD2PxKHmNUFcZ5hmnAukxOVm8k9UmLncJsQtDuqcidMKL2WwJ0k0LmubWLdy70Nv X-Received: by 2002:ac8:7d86:0:b0:430:d1c6:8cd with SMTP id c6-20020ac87d86000000b00430d1c608cdmr11486948qtd.24.1711987053144; Mon, 01 Apr 2024 08:57:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711987053; cv=pass; d=google.com; s=arc-20160816; b=e7nzo8xM1bb3INDLv29lcjrTxEuCB4KHmzRYMsyd2rfeRDWy/xco7XzDFs4dHHYY9v 1Cs8XheCCn2ZBJsg7hjs8texW7lmEIXn39ux+iPkSI3SGd3ooQl9Kv/daz8uJIm9CYeW 2UduKFuQpsnr0+TKN+0I9Q0E8MNxXFW+EYu+MS8VRJAUcAeeX4WrdERWGVmJQXzp2SoW reSwM9cLGYup81gdgDCVlSZY9yjY3eFodYOHNykDMosiWIh+bsEyy8HyUE5Ien+YJZVC x1gd2wRL4Acbx8w6MXFCceHLAGxSZJyLJ6kvJtlx+SXF8dn+nqOKLNNsq6CWl2wjaRB/ 5IaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=lyy71IKuRSl+FC6Fv0loqmHu+UZxeEmMNymJ9LQeELM=; fh=vud8XuGoTzKZUbXmvvIOnRH0inmpUotHSHOikfyCb88=; b=F8zdtXxiG+4Vq5r+4nQm7Hy1p+7iTP/Idvwep5zPgvjnmaus65EN8VLVpImTO8DYpF M1JTO+mW5XV6VqHArxKqi0nmQLYtj+uU98IDftK8PaKQveXe+klNKnEvVqC52lQ8t+bP AhBPNwH/Hx8dCie4uf5pWJrTSVVys2SSi/t0gLoa+n8YCrEjOlq/eBCiCvTpGVolJ1yk z9BqxQw0mzru5BU12DoeXSO1StL9y0OEW+BFNrnsHmLRa11AS+6Wv/G4+z9O1FXxUZn8 JS2R0QaiY/dnZNDc6mhBTKyDO1r0SBMhPuKCN1rPyKxBNtLzVqDlQ3s1GQiflGELVZQ6 e2lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-126838-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126838-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a10-20020a05622a064a00b0043155865ad8si10005306qtb.804.2024.04.01.08.57.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 08:57:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126838-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-126838-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126838-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3389C1C208ED for ; Mon, 1 Apr 2024 15:57:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3A4F47A7C; Mon, 1 Apr 2024 15:57:17 +0000 (UTC) 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: linux-kernel@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