From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 5/6] perf tool: Add fallback stubs for missing dependencies
Date: Wed, 02 Sep 2026 15:58:55 +0000 [thread overview]
Message-ID: <20260902155855.85D701F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260902154858.2078885-6-irogers@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Feature fallback stubs are generated in the C source file instead of providing dummy inline stubs in the header file.
--
commit f19b5b661c978968c83e8af505c2279ba5f83167
Author: Ian Rogers <irogers@google.com>
perf tool: Add fallback stubs for missing dependencies
This commit adds fallback stubs directly in perf.c for commands that have
optional library dependencies, such as libtraceevent and libelf. This ensures
a unified warning is shown when users try to run these commands, rather than
silently omitting them from the commands array.
> diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> index 65bdfd71f6262..6c5baa285b13f 100644
> --- a/tools/perf/perf.c
> +++ b/tools/perf/perf.c
[ ... ]
> @@ -53,6 +54,38 @@ static void __noreturn usage(const char *err)
> static int use_pager = -1;
> static FILE *debug_fp = NULL;
>
> +
> +#ifndef HAVE_LIBTRACEEVENT
> +#define DECLARE_LIBTRACEEVENT_STUB(_cmd) \
> + int cmd_##_cmd(int argc __always_unused, const char **argv __always_unused) \
> + { \
> + fprintf(stderr, \
> + "'" #_cmd "' command not available: missing libtraceevent " \
> + "devel package at build time.\n"); \
> + return -1; \
> + }
[Severity: Medium]
Does defining these fallback stubs directly in the C source file violate the
subsystem guidelines for optional features?
The perf subsystem guide expects that header files provide compatible dummy
inline stubs when a feature define is absent, rather than generating them via
macros directly in the C source file.
> +
> +DECLARE_LIBTRACEEVENT_STUB(timechart)
> +DECLARE_LIBTRACEEVENT_STUB(sched)
> +DECLARE_LIBTRACEEVENT_STUB(kmem)
> +DECLARE_LIBTRACEEVENT_STUB(lock)
> +DECLARE_LIBTRACEEVENT_STUB(trace)
> +DECLARE_LIBTRACEEVENT_STUB(kwork)
> +#endif
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902154858.2078885-1-irogers@google.com?part=5
next prev parent reply other threads:[~2026-09-02 15:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 15:48 [PATCH v3 0/6] perf tool: Build dependency tidy up Ian Rogers
2026-09-02 15:48 ` [PATCH v3 1/6] perf tool: Remove util/cache.h Ian Rogers
2026-09-02 15:57 ` sashiko-bot
2026-09-02 15:48 ` [PATCH v3 2/6] perf tool: Tidy up util/cache.h header file users Ian Rogers
2026-09-02 16:01 ` sashiko-bot
2026-09-02 15:48 ` [PATCH v3 3/6] perf tool: Remove unused includes in perf.c Ian Rogers
2026-09-02 15:57 ` sashiko-bot
2026-09-02 15:48 ` [PATCH v3 4/6] perf tool: Move usage strings and functions to perf.c Ian Rogers
2026-09-02 15:56 ` sashiko-bot
2026-09-02 15:48 ` [PATCH v3 5/6] perf tool: Add fallback stubs for missing dependencies Ian Rogers
2026-09-02 15:58 ` sashiko-bot [this message]
2026-09-02 16:03 ` Ian Rogers
2026-09-02 15:48 ` [PATCH v3 6/6] perf hist: Remove keysym.h include from hist.h Ian Rogers
2026-09-02 16:07 ` sashiko-bot
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=20260902155855.85D701F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=irogers@google.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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