Linux Perf Users
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	James Clark <james.clark@linaro.org>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Clark Williams <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Aaron Tomlin <atomlin@atomlin.com>
Subject: Re: [PATCHES v3 0/2] perf tools: Add cached probe type detection for evsel
Date: Thu, 18 Jun 2026 10:32:55 -0300	[thread overview]
Message-ID: <ajPzhxj3KEF7jOTE@x1> (raw)
In-Reply-To: <ajMkLzJpXzyeqQh4@google.com>

On Wed, Jun 17, 2026 at 03:48:15PM -0700, Namhyung Kim wrote:
> On Tue, Jun 16, 2026 at 03:25:44PM -0300, Arnaldo Carvalho de Melo wrote:
> > 
> > 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. :)

Yeah, I noticed and fixed it up before pushing publicly:

acme@x1:~/git/perf-tools-next$ git log --oneline 27dc372c83d90ccbb19107a2acffe01d6a076a53^.. | tail -3
846f367ff02226e7 perf trace: Guard __probe_ip suppression with evsel__is_probe()
fbb5e6e3ca28a325 perf evsel: Add lazy-initialized probe type detection helpers
27dc372c83d90ccb perf evsel: Add no-libtraceevent stubs for evsel__field() and evsel__common_field()
acme@x1:~/git/perf-tools-next$

- Arnaldo

acme@x1:~/git/perf-tools-next$ git show 27dc372c83d90ccb
commit 27dc372c83d90ccbb19107a2acffe01d6a076a53
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Tue Jun 16 16:37:09 2026 -0300

    perf evsel: Add no-libtraceevent stubs for evsel__field() and evsel__common_field()

    When building without libtraceevent (NO_LIBTRACEEVENT=1), evsel__field()
    and evsel__common_field() are declared but never defined, causing link
    errors in any code path that references them.

    Add inline stubs that return NULL when HAVE_LIBTRACEEVENT is not defined,
    matching the pattern used by other evsel accessor functions.

    Cc: Aaron Tomlin <atomlin@atomlin.com>
    Assisted-by: Claude:claude-opus-4.6
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 8009be22cc3f1055..b959d4797b14035d 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -397,8 +397,22 @@ struct tep_format_field;

 u64 format_field__intval(struct tep_format_field *field, struct perf_sample *sample, bool needs_swap);

+#ifdef HAVE_LIBTRACEEVENT
 struct tep_format_field *evsel__field(struct evsel *evsel, const char *name);
 struct tep_format_field *evsel__common_field(struct evsel *evsel, const char *name);
+#else
+static inline struct tep_format_field *
+evsel__field(struct evsel *evsel __maybe_unused, const char *name __maybe_unused)
+{
+       return NULL;
+}
+
+static inline struct tep_format_field *
+evsel__common_field(struct evsel *evsel __maybe_unused, const char *name __maybe_unused)
+{
+       return NULL;
+}
+#endif

 bool __evsel__match(const struct evsel *evsel, u32 type, u64 config);

acme@x1:~/git/perf-tools-next$

acme@x1:~/git/perf-tools-next$ git show 846f367ff02226e7
commit 846f367ff02226e7089181d2adae45a6cca4a3e6 (number/perf/evsel-probe-type)
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Mon Jun 15 22:17:41 2026 -0300

    perf trace: Guard __probe_ip suppression with evsel__is_probe()

    trace__fprintf_tp_fields() compares every field name against
    "__probe_ip" for all tracepoint events, but this field is only
    implicitly added by the Ftrace subsystem to bare dynamic probes.

    Add an evsel__is_probe() check before the strcmp so the string
    comparison is skipped entirely for non-probe events.

    Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
    Assisted-by: Claude:claude-opus-4.6
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index a8492da23a9cc178..57f3f14c5d435805 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -3267,7 +3267,7 @@ static size_t trace__fprintf_tp_fields(struct trace *trace, struct perf_sample *
                 * If verbose mode is enabled, ensure it is formatted as a
                 * hexadecimal memory address rather than a signed integer.
                 */
-               if (!strcmp(field->name, "__probe_ip")) {
+               if (evsel__is_probe(evsel) && !strcmp(field->name, "__probe_ip")) {
                        if (!verbose)
                                continue;

acme@x1:~/git/perf-tools-next$

  parent reply	other threads:[~2026-06-18 13:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 18:25 [PATCHES v3 0/2] perf tools: Add cached probe type detection for evsel Arnaldo Carvalho de Melo
2026-06-16 18:25 ` [PATCH 1/2] perf evsel: Add lazy-initialized probe type detection helpers Arnaldo Carvalho de Melo
2026-06-16 18:40   ` sashiko-bot
2026-06-16 18:47     ` Arnaldo Carvalho de Melo
2026-06-16 18:25 ` [PATCH 2/2] perf trace: Guard __probe_ip suppression with evsel__is_probe() Arnaldo Carvalho de Melo
2026-06-17 22:48 ` [PATCHES v3 0/2] perf tools: Add cached probe type detection for evsel Namhyung Kim
2026-06-17 22:59   ` Arnaldo Melo
2026-06-18 13:32   ` Arnaldo Carvalho de Melo [this message]
2026-06-18 16:28     ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajPzhxj3KEF7jOTE@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=atomlin@atomlin.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox