Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1173682lql; Tue, 12 Mar 2024 09:12:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUcgk7/xSOlVpCAXgV4B3E+BaJ1Bg+q4QUONwGfIWMGBh35UgMiJvI2OqJOttrcqWvC7n5zZ8BxpL4IcGxfCWcZrX5SKBIHWMGzj+Ss+Q== X-Google-Smtp-Source: AGHT+IHR1mNLgnTpWZBDrfq3Wsvm4HBJHa1Bhe8oRMjLy/Xp89AIqFOdRHaeYduhd9pOgYGOZFbZ X-Received: by 2002:a05:622a:1aa1:b0:42e:cc99:2d10 with SMTP id s33-20020a05622a1aa100b0042ecc992d10mr818247qtc.27.1710259931124; Tue, 12 Mar 2024 09:12:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710259931; cv=pass; d=google.com; s=arc-20160816; b=O7zeOwoCwsFz70OB2jy4cZRyqNwqmhcPtQbEC6CbN23Itl3cz7Dfcdsgqq9WAxwOmW XCTFdnnH0tUiL9DX68DxkfARlFUQ7qHb/uieLJTh/h93wr2noJSnW+QSxwfzeFTZS/7S MpVphuxMiGwOUiPGViNzOMiWS4EJT2S89vEMH1t1ugHZh4BTgApu86GJiYQQSNAAvAAj pZIUS8G5MgBUKgGOAMyLGujjJ3SjTRCt/4BOYpBhB1ePAux2d5f6EgrXwhGufLyY+XNo 8jI1kcYDRYcSIONqb24P1lOL2+0KSlnFmn+d0dHSdK8OAu2zOKotBbdmFAIpu/3KTFun tm0w== 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=mlMGohocih4/vv8NN3ExYyD4aDTNUoH7ERTwZOWg+9o=; fh=9IZjr5VxO6qyCij6ywihg9MkOpWsq3F9ylCIJreO1cc=; b=DkWixSPyyaAP0J8C/l7dGRvhF/q3Q+KcThvJ1wJd/TNQ6PC6OVN6yh5cZxf09T0Epo U2huQfnG7R+fRUEnrbxgUu2AmuhQ0go6er71rgcgA2RFlDEnuUy+mTjL5xsB14SP51OR R9vdwA2E4FXEDHSC9BsTn9aVeSpGhIS3ncSsenuGHtA2ysscAWHVRZW3LiLO+v/jhyBr /8wfk0+FiXGPZfkwrpxZnjd1bNGOJfumhy5HYvQuMphAUVDwQABPML1ni/hjm5H+iKV4 +8xBYy0K9GVmCbc8yn0jx0L/YkX07POntfArcxXKDKxV8yOpeYRn8V10VWyzYGsugIRL 7+lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aQZF+FKV; 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-100497-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d7-20020a05622a100700b0042ee13a9e58si8028712qte.39.2024.03.12.09.12.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 09:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100497-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aQZF+FKV; 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-100497-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100497-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D675F1C2166F for ; Tue, 12 Mar 2024 16:12:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DC807E10A; Tue, 12 Mar 2024 16:11:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aQZF+FKV" Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 8AF637A733; Tue, 12 Mar 2024 16:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710259916; cv=none; b=eInpm4tDVgOHP66sP3aTVBJg6RwNiKwwiq73lRLThnUFKZuhw5tAkasGPcLpNYHzyu+8fteOI54uGvtfs7V3Fr6/L18bFXLCOeVqm5ujSdNNML6iqcDA2u/yYgNQwpxXFXhafwAoAlOE2kR0zfB+yFrZW675i9i6UjWwOWtzPNg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710259916; c=relaxed/simple; bh=pK5/KZXV6dGLZcSbEQLvyxdyemAdcpgwpgjSR+FzciQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=T9cJOC/ut3JGPGi0vjF6lJd2GPsmbv9vKQog2VFLsJJDxnjT7lrjkjyADjSGMIpXgwE4QkOecMYrT0h4YuA2YiuUupycb/RSoKvoth3H40wTECYEwxO9jPSPPZRKQ7KL/44EbrJN0JNweqWUnq43kJ3fd3Hyf2mgHw3VdLE3Y5U= 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=aQZF+FKV; arc=none smtp.client-ip=209.85.221.44 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-f44.google.com with SMTP id ffacd0b85a97d-33e99b639e0so1410165f8f.0; Tue, 12 Mar 2024 09:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710259913; x=1710864713; 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=mlMGohocih4/vv8NN3ExYyD4aDTNUoH7ERTwZOWg+9o=; b=aQZF+FKVulDD0cD6twny7vFQuct4bMGN7AEwkOwIR3HS+hs4inJmjoZg5bzKqLbGHp 0kuOsotVuQtutGuq4sR7//h5NP2HJw+Zam6DgZpluUiOH9d+KUgrQImpOMfo9TStuCF9 PFUP70DjifLJStO30F0BeNoJxjHfbd4/6Hq32nfz+8RRj5ix1+1zjuFrqio9hh11ApV+ tc2iHR2fiicsH8ls8POlBJb9PiVDPiF4lcVtqF/II6kFahdp3Qd8n7K36FZU38lU4LFY 4DxapN8kj9fn9Krh8JvFXoaHQak4wVIxd3hf+gaa6cc/zfzHSuXZoGx/EA/dltX0DpK2 mLfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710259913; x=1710864713; 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=mlMGohocih4/vv8NN3ExYyD4aDTNUoH7ERTwZOWg+9o=; b=EJnhgzG+e2kx5raLIy1y7mWK5x855plVwFeTwqE8q/Qj7ueLFHBk5XPQriZSiFbylA jX1sFx0ww94nWrVJj5VLyyWTjNt39sHTNnKRRQ1QYvzacOmAvLoOUniVEUe8U0iXXH38 Ol1tnt9XpJSAdeJpfcS3cR3+t163bwJHOV+yDLjcVFdlsxEJ4gw4hgeLYUke5PMEPPXO 1TcgZRf3e3tFx+YWodFJsW2oNOR3Ge3m+XzvNZMSgLk6dv7ONiSswWdXWYNS7YZXTPnq ncwW8h1Z+pIQFtouenLiqVh17DLlVnMMErk+QjKzPEQ7dK0nqP7r+ghLbtI+ky9Y+spE M86Q== X-Forwarded-Encrypted: i=1; AJvYcCUPKXvDBXb3yAv7Tj4DYSdnjYksswD+BXRS7tNZb198Ky5/cbuSaNSfrS+3BP+YHc8bHzHjQaMRMvKVxCpWYgFVLnUvTyQ9NQbhpvZJla/H1Qo0x0Jy/x8pa1C9izyiTGDJYvcW2FC40puqPPauHlRshTtQsYpqImrEJxXUeA2bgIpoOk1WmfwM501N+oJVReIEuxamNLGy2nrY5aJPKSGLMlu6RK8ziJcay5WX3M29F7spwRiGS4IS6UTr0yqs9qgL17uoOufB6HnZ1bXJf6j5jxWlkRCQKPsE3A== X-Gm-Message-State: AOJu0YwR0ICy4wGJrRYu9dNdob3cmLuuh+oIGyQm4I001mDVoINHS45Y 54cMSmOfG9eje96VI/1IVz66AmhkCKXOjRATUcXuFh+sxKTeaefaffAE4FvsAn2v7Mh4z+4dnQs 7BdIMpK19V4A9MCsYg+DBQ4CHmnM= X-Received: by 2002:adf:f60a:0:b0:33c:e396:b035 with SMTP id t10-20020adff60a000000b0033ce396b035mr458814wrp.69.1710259912730; Tue, 12 Mar 2024 09:11:52 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240311093526.1010158-1-dongmenglong.8@bytedance.com> <20240311093526.1010158-9-dongmenglong.8@bytedance.com> In-Reply-To: From: Alexei Starovoitov Date: Tue, 12 Mar 2024 09:11:41 -0700 Message-ID: Subject: Re: [External] Re: [PATCH bpf-next v2 8/9] libbpf: add support for the multi-link of tracing 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 , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "David S. Miller" , David Ahern , Dave Hansen , X86 ML , Steven Rostedt , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 11, 2024 at 7:44=E2=80=AFPM =E6=A2=A6=E9=BE=99=E8=91=A3 wrote: > > On Tue, Mar 12, 2024 at 9:56=E2=80=AFAM Alexei Starovoitov > wrote: > > > > On Mon, Mar 11, 2024 at 2:35=E2=80=AFAM Menglong Dong > > wrote: > > > > > > > > > - err =3D libbpf_find_attach_btf_id(prog, attach_name, = &btf_obj_fd, &btf_type_id); > > > + name_end =3D strchr(attach_name, ','); > > > + /* for multi-link tracing, use the first target symbo= l during > > > + * loading. > > > + */ > > > + if ((def & SEC_ATTACH_BTF_MULTI) && name_end) { > > > + int len =3D name_end - attach_name + 1; > > > + char *first_tgt; > > > + > > > + first_tgt =3D malloc(len); > > > + if (!first_tgt) > > > + return -ENOMEM; > > > + strncpy(first_tgt, attach_name, len); > > > + first_tgt[len - 1] =3D '\0'; > > > + err =3D libbpf_find_attach_btf_id(prog, first= _tgt, &btf_obj_fd, > > > + &btf_type_id)= ; > > > + free(first_tgt); > > > + } else { > > > + err =3D libbpf_find_attach_btf_id(prog, attac= h_name, &btf_obj_fd, > > > + &btf_type_id)= ; > > > + } > > > > Pls use glob_match the way [ku]probe multi are doing > > instead of exact match. > > Hello, > > I'm a little suspecting the effect of glob_match. I seldom found > the use case that the kernel functions which we want to trace > have the same naming pattern. And the exact match seems more > useful. > > Can we use both exact and glob match here? exact is a subset of glob_match. Pls follow the pattern that[ku]probe multi established in terms of user interface expectations.