Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2125508rdb; Tue, 20 Feb 2024 19:18:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW7KKyI8PPKL9VlwF+RAOxFn0YP0HXYD7MHheWCPei4pSzpghMOuwVNJs0TZcvQ64K2xXtVfcFsR6Kwjq/q3Yx5RjM+O/ExldVfI+cx6g== X-Google-Smtp-Source: AGHT+IFqe2b9+Iy5LKM6+17RAstY7ZAcJZHpB70FS5ModG1y/KWwYA/T0DqImeSfZuPtwVlmfHGL X-Received: by 2002:a17:906:694b:b0:a3d:590:195e with SMTP id c11-20020a170906694b00b00a3d0590195emr15241274ejs.4.1708485530827; Tue, 20 Feb 2024 19:18:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708485530; cv=pass; d=google.com; s=arc-20160816; b=KuLsSabF0ntgM128nrnvbE6zR4xKlap1e0MrJwWjAATIxa+PfH3PYNi3m5WkJAoQ6m pP0WpgXoOdiBQUtB3ZWMK0EDFQ5+ewIXJWuEsg5VGk1iat4Xfku8U1IKDr5DlMb/7Ber rjXLJeKe7HIbN3H2h7/oOqbJ21E9VEbXk2NWbcOQdOhjJl5/pmTIcMoH7V/dWlsz/7Cy nOWgp5vVmk2iVg0pbop1aKvUU/3WX4gUnbuZd96VOKPptD8WNC6RcOmn+LN/jr3AjyKa 4rtTYO1DThVJc+u/YBG2pzSJ48ux779gbzY9Pzemuk4vOlblMcLfu5WM3nxCiI2ZYgFT QhVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=YjOY1NT3Toze+hbapT33EQhrctZc4RHHjTOynWFnvX8=; fh=z9zRPBH73VkRMUIxVm1e0aqz5pm6NdqxDxx/nqD2/Dw=; b=SKd+zFizwr8S9HW1gllqH0h4E8+SUrpZSPlXJrvWi7sLE5a2+u7vQ/hPMA3YFQmg0A CjNCZ28361b6fpe3lAbCD5Fi4ieePuzL1KWnwhwRf5/tecSIY6mNza7hZySBoTUCIyny 8ttVlhWpwwroNlxsRfowaZRf7IcUs465EXCSQ7LECz3itzZcuPXHMKcJccFF0nJV+RaX cQVwpnmdLKQtQc2eMMrTEE9IcdWZt8g5xsYsM7DU4DqCUJxoNvjfH0uux7HVXAntTaI8 obcZ94fDDXDEHdaEdfZYDCU5G/8yNKauEy07qweBpuLSmC3ux6ABZGZmiAB5hgLb8kHK jEWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RonO6iCw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-73995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bw11-20020a170906c1cb00b00a3d4771f11asi4050612ejb.200.2024.02.20.19.18.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 19:18:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RonO6iCw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-73995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6D4381F24EEF for ; Wed, 21 Feb 2024 03:18:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19CE038DDB; Wed, 21 Feb 2024 03:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RonO6iCw" Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90C362556F; Wed, 21 Feb 2024 03:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708485520; cv=none; b=XKhOvF/pOfknIwqJL6AjimBHQbo0GnBujpHQYNK/Xusu2a4iqznFG8W1amzGYDNMM9R7O9y4yKRFRqKy4HFMkH8iLv3HrBw++hlYAzPnDTrrg79T6Uwnbxy02qGIbzVsMjkZOfj5uixW79AnTdtritJsRz+7er4nFWzOnQV3aRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708485520; c=relaxed/simple; bh=YjOY1NT3Toze+hbapT33EQhrctZc4RHHjTOynWFnvX8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=eZUAl8Su2j1GV79M7VfeRNBJRds2JxhePWIJgyONGIj+z4g5PUS6MDBeLB5FKadqNClH/HL5FoAEepaIwqIJ7J8Fpvx5pa0A5EPlnrPBi8wkug4IPIJVHU/K60ptwvM+tnsyt34e5zvlgSB1JXJHVezjNwkn9BAckvk8OSoDGas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RonO6iCw; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-33d4c11bd34so2191202f8f.3; Tue, 20 Feb 2024 19:18:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708485517; x=1709090317; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YjOY1NT3Toze+hbapT33EQhrctZc4RHHjTOynWFnvX8=; b=RonO6iCwyWr4qhYuT/UYGpWIxWWhHqTJeUFHHjR+5SKYm36PWZJ8upbRiAlr1LqYua v1ZDZFCL9ZozXjOwz+fKTVF3xtzRRj6Sj60dbYHzcXprJYZ3GseqABf70yqnLHftJk55 4/08FFTf/Szn/17n3sUfdzM7dOJdHMHCvJfvtJbdBeAeAOO9cZjM93qsmqRSMcK4nwdG UztAzJEtSSzY2cFhSaqN72VldZBNQQKx+Dg5sHF7dp+Jo657qAAOWXpq+oFZvYCKH8Uj he+q62hXo1mWeUUKjgdL++2L++yZAhp3/xv7MXGNcDxWilwE0Phfw6ilqasZhTVwlbVk 8fcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708485517; x=1709090317; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YjOY1NT3Toze+hbapT33EQhrctZc4RHHjTOynWFnvX8=; b=hjLazfnuInYfprWhCMRJffjRtm80pCJs4DcCKHUs7jWYW1a2CVPlOOziLjCrddKuNv G0a2ui7OJ9XfvwgJ6vD+2kEg3i60cGlNm5lVsTLhwYX+wBKhMEspONpaVYYBcRylzO6Q C3MFRK+9aCHzOp0T4icBqLuh5KlA6fUkqgHVzpE5kVkBffYKxv6wMWpJ13tN3GI1DVZf djvhGOj0dzrG/tu8qgqCN/m3xVIdrLEJC03cMsUZTpijLOqvUx4ElvQxmb68cl5pM9H8 TDgDoVN9qQAjuLcpedByREEijsx4t0amVVDCaVUdP4wuEvm+D3k0fsaPUL2qBY/xdjhr zzWQ== X-Forwarded-Encrypted: i=1; AJvYcCWAsDh/WBhbFEiAh4PEav9P789FBsJNj9uhGyYXfm9UIOGyYPhbCrnWogjFiKMftZkptNUuvZg5MEaLQCOJyekjkG+BIZlpvTa7naf+fmM6ayqV/5Z+0R7Wm3d6Xi794BFBgMj/sPOvuLjQi3bTrjFL4wDyj+b5Gr5PvCZbbUWpsET7 X-Gm-Message-State: AOJu0YzwG7IjFyQemXJQ4K1FE4IGa12Vio664zQg/v5JF2Rg15exiZWr xLK8qC+NQt6AK18Q51nYV168UqwmIJQV9r5cxvtkDz7ekczz8yjYM5E0TMW+TvB31PZYMBceZW8 t9FjxdShNJFl7AnJGMAiM7Tn5vTM= X-Received: by 2002:a5d:660e:0:b0:33c:f9d6:fb20 with SMTP id n14-20020a5d660e000000b0033cf9d6fb20mr13184216wru.45.1708485516775; Tue, 20 Feb 2024 19:18:36 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240220035105.34626-1-dongmenglong.8@bytedance.com> In-Reply-To: From: Alexei Starovoitov Date: Tue, 20 Feb 2024 19:18:25 -0800 Message-ID: Subject: Re: [External] Re: [PATCH bpf-next 0/5] bpf: make tracing program support multi-attach To: =?UTF-8?B?5qKm6b6Z6JGj?= Cc: Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Eddy Z , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, Kui-Feng Lee , Feng Zhou , Dave Marchevsky , Daniel Xu , LKML , bpf , "open list:KERNEL SELFTEST FRAMEWORK" , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 20, 2024 at 7:06=E2=80=AFPM =E6=A2=A6=E9=BE=99=E8=91=A3 wrote: > > On Wed, Feb 21, 2024 at 11:02=E2=80=AFAM Alexei Starovoitov > wrote: > > > > On Tue, Feb 20, 2024 at 6:45=E2=80=AFPM =E6=A2=A6=E9=BE=99=E8=91=A3 wrote: > > > > > > On Wed, Feb 21, 2024 at 10:35=E2=80=AFAM =E6=A2=A6=E9=BE=99=E8=91=A3 = wrote: > > > > > > > > Hello, > > > > > > > > On Wed, Feb 21, 2024 at 9:24=E2=80=AFAM Alexei Starovoitov > > > > wrote: > > > > > > > > > > On Mon, Feb 19, 2024 at 7:51=E2=80=AFPM Menglong Dong > > > > > wrote: > > > > > > > > > > > > For now, the BPF program of type BPF_PROG_TYPE_TRACING is not a= llowed to > > > > > > be attached to multiple hooks, and we have to create a BPF prog= ram for > > > > > > each kernel function, for which we want to trace, even through = all the > > > > > > program have the same (or similar) logic. This can consume extr= a memory, > > > > > > and make the program loading slow if we have plenty of kernel f= unction to > > > > > > trace. > > > > > > > > > > Should this be combined with multi link ? > > > > > (As was recently done for kprobe_multi and uprobe_multi). > > > > > Loading fentry prog once and attaching it through many bpf_links > > > > > to multiple places is a nice addition, > > > > > but we should probably add a multi link right away too. > > > > > > > > I was planning to implement the multi link for tracing after this > > > > series in another series. I can do it together with this series > > > > if you prefer. > > > > > > > > > > Should I introduce the multi link for tracing first, then this series= ? > > > (Furthermore, this series seems not necessary.) > > > > What do you mean "not necessary" ? > > Don't you want to still check that bpf prog access only N args > > and BTF for these args matches across all attach points ? > > No, I means that if we should keep the > > "Loading fentry prog once and attaching it through many bpf_links to > multiple places" > > and only keep the multi link. I suspect supporting multi link only is better, since the amount of kernel code to maintain will be less.