From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f177.google.com (mail-dy1-f177.google.com [74.125.82.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 5D04E2DAFBB for ; Wed, 17 Jun 2026 22:59:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781737195; cv=none; b=D7ykJXc60NAMrL+ybQSg76Ge15Y+o0oTSGBgRD9B/64JXbz70/G9rVa89bJxWW4oeQ88XPD6gZTWN0fLxBkJohm6yrPmBMNZPBckGcbmUy8nKrjqb9dlwQL6Fd4BKPbhiEFDzN0fWfIBOiE8A8b4fJJLu8Qm8/bj/7slITXOyFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781737195; c=relaxed/simple; bh=7j1+9fHqVc3E3CdfBPKfK6sDQjl7/oECFRzMdgaI8jU=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=DQ6m0vPkqWRZWhJrpGK+HFEB0oPYzmkRZ8LsjXsLdgf36F8Ow2Z5i0av3dDGrBInTEW3fGIJkNYDuX/V9oFsdrjvUSwoDEkuu6anhfV2Px6d6Z5XGqtUROUUxM/WJ/GPViQ7KAapZPC/bqjsKcD0Kz/B1MSfZPzAmv9NDTvbqVI= 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=g751uldq; arc=none smtp.client-ip=74.125.82.177 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g751uldq" Received: by mail-dy1-f177.google.com with SMTP id 5a478bee46e88-30bdb3eb5f0so551494eec.0 for ; Wed, 17 Jun 2026 15:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781737193; x=1782341993; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=LTr+KvtLym1+4doSm6c0+5zv9b7Oyha7VC84op+BDLA=; b=g751uldq88gCT/K9ED6YZStfC0UDq7XljEUvSCfPA0lcmDpVnGnAFvfe+W22LyC7/E nlw+yqVZ+CsqDqyyscxsdNGwMmM9+nkSIJFj4FsmPHDAGTJf1fnTX03gG5JkQY+91BpG WxEWgT/b5MuhSatf285njaNOOtjA892cWSwuR5ZMwK4CuhNzOG58Vk29Jj5R9F1NKena 6RY+B6VYsFTVcyMoKpB9i1T5aJhkZD7HzNeNnjo9iKJf7cBFeTicZKOl5lr19wjAJj0F 9QgNANxIogd0a9wpv8Sar2bNtHCPbvZzu/ajt1r7SeQXadPvm8Tu4EwwNXFgwVrx6kE/ SD+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781737193; x=1782341993; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LTr+KvtLym1+4doSm6c0+5zv9b7Oyha7VC84op+BDLA=; b=GnhiX7gFbv/8wjhKd1jOrYOSoIDUVtgEyv8ys756+pr4cg/yajuDKnh93h0BhG6Gs1 zZ6QlzLsu/ODWpSUAadZcokIxgBlexLupv8kvG0XYM1OvG8npYDf13QPwv+1Fbym/Pzk WYToAVpAYHgbhA/xXaiA6t5I2k/gSOiSzGoRzTLcvaut2eLmodBYRWhs26UqTrzH8XUG w71Fu5o752n82B1lstG23tTSp5RqE0w9lJ8fgVzHgyRZnShbyDB0T8cYyDqCSATT8NeX 5jGHKwiBw73ydJCM7iS/1ueC3kW71sTx4jHPaFnxf9O4UWhzE1bJ7A6U5FXIhCUIDpeP 1p4Q== X-Forwarded-Encrypted: i=1; AFNElJ+6nBzXlD3gClnAho0C7pfIPKJiE0m+jbm3GPz44muiF/ftaU80vAGUQPKSokqyzjODYlXCag5UG5dq/CM=@vger.kernel.org X-Gm-Message-State: AOJu0YwaFZsc94mnNZ5pYXvQd09YylbwD6oamhSPUjLc+K8Uov0uDJ+p FJEyWZZ4pCE7Rb+yrB+rv6TLvOEKRsynxdLYI+HUNOA+p4L3KILnC8L8 X-Gm-Gg: AfdE7cnFGfzF+Mioq1o21FG19fSt3xCQzjgirdteINwdKOdPEADQmH9ZRV80tB1dJyk n594KxGjHXBXkcLIDKoxiIr3GMA3cTWw1qXPaTFhi8AEly0MTfgNZT8ZNrQ8CrTBZX/zyU1JYN+ aSfxYF4D5Kd27sOGPnb9UKnW+eaTdtzEr90E3mCyN439csUKCOgxdBioEPnU+Jsq3gcBkfno21Y 7r+BECV3C45m1G4XuAGCmLKbCAlunkg1DtK9NAawo9cXTrZ1ds+2FoDODgcDkEC1i4DXrjDBfLU /sJJehTh5tkh4/cH8b9uKC/65o/Hn46BvFqC8yzcbjX4iTQ8/p2FNhQd73MBeDMXichqjFyKoWr QHfis18RI/rQf9Otgq+b98sw+FYF3NILFgmltfcFr+0SegW7jZR2t27ceB3hZJuWXjtB39lQhnA NRs/HNccdWdlodSyaAJC6GELaV/irrxtK0y0aeS/9D X-Received: by 2002:a05:7300:e52f:b0:30b:b4b5:4979 with SMTP id 5a478bee46e88-30beddd707amr571598eec.12.1781737193439; Wed, 17 Jun 2026 15:59:53 -0700 (PDT) Received: from ehlo.thunderbird.net ([2804:2bf0:60e7:ae00:d4f2:c34b:edd1:35b6]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3081e5d0357sm22460208eec.11.2026.06.17.15.59.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Jun 2026 15:59:52 -0700 (PDT) Date: Wed, 17 Jun 2026 19:59:49 -0300 From: Arnaldo Melo To: Namhyung Kim , Arnaldo Carvalho de Melo CC: Ingo Molnar , Thomas Gleixner , James Clark , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Aaron Tomlin Subject: =?US-ASCII?Q?Re=3A_=5BPATCHES_v3_0/2=5D_perf_tools=3A_Add_?= =?US-ASCII?Q?cached_probe_type_detection_for_evsel?= User-Agent: Thunderbird for Android In-Reply-To: References: <20260616182546.8892-1-acme@kernel.org> Message-ID: 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 June 17, 2026 7:48:15 PM GMT-03:00, Namhyung Kim wrote: >On Tue, Jun 16, 2026 at 03:25:44PM -0300, Arnaldo Carvalho de Melo wrote: >> Hi, >>=20 >> Checking whether an evsel is a kprobe or uprobe currently requires >> walking the PMU list via evsel__find_pmu() on every call=2E This is >> wasteful when the same evsel is checked repeatedly in hot paths like >> trace__fprintf_tp_fields()=2E >>=20 >> Patch 1 adds evsel__is_kprobe(), evsel__is_uprobe(), and >> evsel__is_probe() helpers that resolve the probe type on first call >> and cache the result in a 3-bit field that fits in existing struct >> padding=2E >>=20 >> Detection covers both PMU-based probes (kprobe/uprobe PMU, detected >> by PMU name) and ftrace-based dynamic probes (kprobes/uprobes/fprobes >> created via tracefs, which report as PMU "tracepoint")=2E Ftrace probe= s >> are detected by the __probe_ip field that the kernel adds to all >> dynamic probe formats =E2=80=94 this is authoritative regardless of the >> group/system name the user chose=2E >>=20 >> Patch 2 is the first user: it guards the __probe_ip field name >> comparison in perf trace with evsel__is_probe(), so the strcmp is >> skipped entirely for the common case of non-probe tracepoint events=2E >>=20 >> Patch 3 adds inline stubs for evsel__field() and evsel__common_field() >> when libtraceevent is absent=2E These were previously declared >> unconditionally but defined only inside #ifdef HAVE_LIBTRACEEVENT, >> which was harmless until patch 1 added a call from always-compiled >> code in evsel=2Ec=2E >>=20 >> Build-tested with gcc and clang=2E >>=20 >> Changes in v3: >> - Add patch 3: no-libtraceevent stubs for evsel__field() and >> evsel__common_field()=2E Without this, NO_LIBTRACEEVENT=3D1 builds >> fail to link because evsel__resolve_probe_type() calls >> evsel__field() unconditionally (sashiko-bot)=2E >>=20 >> Changes in v2 (patch 1 only): >> - Detect ftrace-based dynamic probes (kprobes/uprobes/fprobes created >> via tracefs) that report PMU "tracepoint" instead of "kprobe"/ >> "uprobe"=2E Check for the __probe_ip field presence in the tracepo= int >> format=2E Without this, evsel__is_probe() returned false for ftrac= e >> probes, breaking __probe_ip suppression in perf trace for probes >> created via 'perf probe' (sashiko-bot)=2E >> - Widen probe_type bitfield from 2 to 3 bits for PROBE__FTRACE=2E >>=20 >> Arnaldo Carvalho de Melo (3): >> perf evsel: Add lazy-initialized probe type detection helpers >> perf trace: Guard __probe_ip suppression with evsel__is_probe() >> perf evsel: Add no-libtraceevent stubs for evsel__field() and evsel__= common_field() > >It seems you squashed patch 3 into 1=2E :) I noticed it but accepted it at the end, I guess part of the process of us= ing AI to speed up the process :-/ - Arnaldo > >Thanks, >Namhyung > >>=20 >> tools/perf/builtin-trace=2Ec | 2 +- >> tools/perf/util/evsel=2Ec | 53 ++++++++++++++++++++++++++++++++++++= ++++++++++ >> tools/perf/util/evsel=2Eh | 19 +++++++++++++++++ >> 3 files changed, 73 insertions(+), 1 deletion(-) >>=20 >> Cc: Aaron Tomlin >> Cc: Ian Rogers >> Cc: Namhyung Kim >>=20 >> Developed with AI assistance (Claude/sashiko), tagged in commits=2E - Arnaldo