Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp803184lql; Mon, 11 Mar 2024 19:44:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnUGz1iv6UTFyjoaAlywA05TpqiSU8ZKBoJTox52tyWfiD+TRg7sGLsoA0VAFD0oFYAiIVhhLlIIHn9xt5YgFLFTYw24LwS33LxIihpQ== X-Google-Smtp-Source: AGHT+IH6WFHsY3XRHFB9btXXz2uEFrdWUqKpd+8tHJVFrEGJr9nT9iiELQjg0nY0ATumlfE8eYuh X-Received: by 2002:a05:6358:63a7:b0:17e:8a04:3fb3 with SMTP id k39-20020a05635863a700b0017e8a043fb3mr574978rwh.12.1710211480221; Mon, 11 Mar 2024 19:44:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710211480; cv=pass; d=google.com; s=arc-20160816; b=m76FdfIjOjk/zXS521x2lsALJbe2NTZZl74X0ySb+W2TmMB5dmCRFQmu6nmXRJsE7J IrSISqshSdV7W8Nj2kdJRMAxfq5TlM8izPjGDumQb56K6cYCBDsftcxltL377D1LCf9O BhJwaX8d95V0N0mQ4WnuZrPS1Ln/HUekiWEm+n3XyFQVAxc4SvG9zuaR6IPgmX5ParLw b/m+wvEU9WAeCcfwMeNW2awbBNFwoWKpphbj2/nohWPaD4tKgL1ytopqxCdd9g0amZge vV31G8v7B0fG1cW82lofcTu2eWtKWhg0Id1gsBtX78yHIkVwXO+82BlCa3K78BFf2Bn3 E0+w== 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=n2/zqf8TfkF7fmO3ryrALVmJ2Vqgii1SZQQKBoGp30M=; fh=SKdPKz/QCBzY0l4J420iobebVP1IZPXTnIRa6rwUa4Y=; b=jwCyYgrbWbRf9Y3Elr8BCLiVfcoR8H8fLfItk1YGCB4wDHaesWN+AeT1MNdAlaQARB zQd4s969UzvBHr6qT5t2ZkETdkDpTfi4PV7muZjyLehO6sNNZ3oJqNIoqdkNW88ony9P uvVd5oscFbL5TQbNYUNrqxV9TqpFALZcQAhV0tCXXM9a5aM2tiDO5elE1dIXsjJRd8mI szRonaRva0ooGcUvefVDzWkAfR7uau1myrsuai4aUZv0MdTCREgs+N903SSFrrgzs7nD JsQ2nv+ObL2WxfyZ9oOYaMvcTVSrt2wfPCZda0AhsFJzbOyHZ6KFE1CzgN4Upulo4GSE A+zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=RWHroVnU; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-99775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id r12-20020a65508c000000b005cd8123afb5si6094071pgp.547.2024.03.11.19.44.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 19:44:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=RWHroVnU; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-99775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D0C54B215FD for ; Tue, 12 Mar 2024 02:44:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FD5B8F5D; Tue, 12 Mar 2024 02:44:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="RWHroVnU" Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 66F2C79C0 for ; Tue, 12 Mar 2024 02:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710211459; cv=none; b=EtrexBsKU33LRi5mVAFEJPD/5l3+Jlfwyy3FLMyD3cSrqJSUvUQzBciOxePcjS6kf9qIrzpR11QGSVzPkltZXi8wYO/iP/5l75J7tCErQNwTD4DXC3gKH9zo5Vz9atN/9UzmmqsifMiMtzt4Zol2mpUmydy1P2Vp/QgsjZ3Za3c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710211459; c=relaxed/simple; bh=w1TsuMUWzBMAa4sluemyX5myNv66iSIjpefpYiqw6No=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=YR6qC07dhv49we0crGzckYyrJW2wwM6UoCBhy3SeyuMs9q8DilnmI6VTPkIc/NmbjFfa2iRJzoGxuGCYgwDwOz0nDB/zbDDRPPwaPpvy/cLA9dxXzQ0f3LaxOhdi2FzOHTgv7PuMMKASAhpiSAAlO9Wzcpl9UiYBIHBz0pt5N1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=RWHroVnU; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5d8b276979aso3558527a12.2 for ; Mon, 11 Mar 2024 19:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1710211458; x=1710816258; 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=n2/zqf8TfkF7fmO3ryrALVmJ2Vqgii1SZQQKBoGp30M=; b=RWHroVnUxNq25PSZi9Z1RDXpYssydo+icth3tlZHvUmzLWeeWJzk9/8oklJblkLmuB aLY8n3upiIeHo772B6JWHGk6j1AmhgZUYqqRtK11vAn0dqqCgS+i0Xea1aRj2XObWMlV GGtH4hmTLW6qB5m5X6qmZH7Qd+C309mkMQJtASCj6R/C9LRKIzLYTNVjir7O6A3j1AOx SEMM40o3rSP+SU/BynrAGdj417Vo85UMZpPC9h+l2bhxh8D1IGJ1PIo+Ia7c+AFSdRgB 9pUnQCB+PgaiQQ9ymeXfsCRNGTtrtMfB06l2yZzNAqVhsGP0NU2vsHVz4r1qqxpYWi/4 cWqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710211458; x=1710816258; 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=n2/zqf8TfkF7fmO3ryrALVmJ2Vqgii1SZQQKBoGp30M=; b=YYWD11h55U3owBUhvEN60lJoDqvNskbBi+1cB8FGwrZ2u84mSldE1daNcUnNU+UHse WwOFIa/tCEHAVelASECBjxEXA0MHibHOPnL4ndIicgz6GInC7JfoZj75DhlzvW3kCPW1 aAS1CpTUTD4M4GXKtSVs/pjiq9XRFEvlF4/oUSM2mgSF4rTS3De+CC0LuN4T19Vdt+XD /upsrSbaJ329NKOtSzx7mzcn4BDdtGSbvUps0J7FfOO7qAYKRlGu5idpsL/wX/50ci+Q sHYx/GPYuEQ6URgts53U7rjC6ATUbVFKSfqRkXGAmsXMlLIkPVahjw9SkbIID1W4J6Zp +m0A== X-Forwarded-Encrypted: i=1; AJvYcCW6zsxcp+9EY1uSLS7Ghg66Q9/hBFJEYqAMnwDBT3ta+NBXl6yu3uFmP7T02JP0YR4Zc/Yj+/67fU/7+mW32Borpci1k3a1iId2Si7A X-Gm-Message-State: AOJu0Ywwj3DdeBQ/Gjg5EqlekWQ5b9CMAff2F+JpYQvcMOFe9n3qBNTY As0P4UVoToIFYH9v7VvpYNTwJV6Dl6Si4A02vyBS1gMfjzOOtXmuYZX6eVTMerwbHpmvv8c/qqw 4XRe52DtEIdEPvsnxvUQEou/2cqZCNfruQRLxeQ== X-Received: by 2002:a17:90b:3ec9:b0:29c:4082:2d0b with SMTP id rm9-20020a17090b3ec900b0029c40822d0bmr49744pjb.28.1710211457742; Mon, 11 Mar 2024 19:44:17 -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: =?UTF-8?B?5qKm6b6Z6JGj?= Date: Tue, 12 Mar 2024 10:44:06 +0800 Message-ID: Subject: Re: [External] Re: [PATCH bpf-next v2 8/9] libbpf: add support for the multi-link of tracing To: Alexei Starovoitov 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 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, &b= tf_obj_fd, &btf_type_id); > > + name_end =3D strchr(attach_name, ','); > > + /* for multi-link tracing, use the first target symbol = 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_t= gt, &btf_obj_fd, > > + &btf_type_id); > > + free(first_tgt); > > + } else { > > + err =3D libbpf_find_attach_btf_id(prog, attach_= 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? Thanks! Menglong Dong