]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf check: Allow showing a tip for opt-in features not built into perf
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 8 Apr 2025 13:56:30 +0000 (10:56 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 10 Apr 2025 13:44:42 +0000 (10:44 -0300)
Ingo reported that it was difficult to understand why libunwind support
didn't link even when he had the usual libunwind-dev files installed in
his machine.

This is because libunwind became opt-in, the user has to use
LIBUNWIND=1, as it was deemed stalled in its development/unsuitable for
use with perf, IIRC, and so we better use the elfutils equivalent
routine that we also supported for ages.

But the build message still printed:

  Auto-detecting system features:
  ...                                   libdw: [ on  ]
  ...                                   glibc: [ on  ]
  <SNIP>
  ...                               libcrypto: [ on  ]
  ...                               libunwind: [ OFF ]
  <SNIP>

Which is confusing, so allow for having a tip when 'perf version
--build-options' is used, and variants with 'perf check feature':

  $ perf version --build-options | grep libunwind
             libunwind: [ OFF ]  # HAVE_LIBUNWIND_SUPPORT ( tip: Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build with it )
  $
  $ perf check feature libunwind
             libunwind: [ OFF ]  # HAVE_LIBUNWIND_SUPPORT ( tip: Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build with it )
  $

The next patches will remove the opt-in libunwind FEATURES_DISPLAY.

Reported-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/Z--pWmTHGb62_83e@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-check.c
tools/perf/builtin.h

index a451fa25f50d6ef82bc268f69af439b8c578e604..a5b76ff5988c4d1fe1982a75354015bcedfd0917 100644 (file)
@@ -27,6 +27,12 @@ static const char *check_feature_usage[] = {
        .macro = #macro_,                  \
        .is_builtin = IS_BUILTIN(macro_) }
 
+#define FEATURE_STATUS_TIP(name_, macro_, tip_) { \
+       .name = name_,                            \
+       .macro = #macro_,                         \
+       .tip = tip_,                              \
+       .is_builtin = IS_BUILTIN(macro_) }
+
 struct feature_status supported_features[] = {
        FEATURE_STATUS("aio", HAVE_AIO_SUPPORT),
        FEATURE_STATUS("bpf", HAVE_LIBBPF_SUPPORT),
@@ -48,7 +54,7 @@ struct feature_status supported_features[] = {
        FEATURE_STATUS("libpython", HAVE_LIBPYTHON_SUPPORT),
        FEATURE_STATUS("libslang", HAVE_SLANG_SUPPORT),
        FEATURE_STATUS("libtraceevent", HAVE_LIBTRACEEVENT),
-       FEATURE_STATUS("libunwind", HAVE_LIBUNWIND_SUPPORT),
+       FEATURE_STATUS_TIP("libunwind", HAVE_LIBUNWIND_SUPPORT, "Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build with it"),
        FEATURE_STATUS("lzma", HAVE_LZMA_SUPPORT),
        FEATURE_STATUS("numa_num_possible_cpus", HAVE_LIBNUMA_SUPPORT),
        FEATURE_STATUS("zlib", HAVE_ZLIB_SUPPORT),
@@ -78,7 +84,12 @@ void feature_status__printf(const struct feature_status *feature)
 
        printf("%22s: ", name);
        on_off_print(status);
-       printf("  # %s\n", macro);
+       printf("  # %s", macro);
+
+       if (!feature->is_builtin && feature->tip)
+               printf(" ( tip: %s )", feature->tip);
+
+       putchar('\n');
 }
 
 /**
index 7db7bc054f6e3f559ff7bf3d6e7ec49e0e1a8898..40c4078c295fe7a19d2bdb63335462613efab92f 100644 (file)
@@ -5,6 +5,7 @@
 struct feature_status {
        const char *name;
        const char *macro;
+       const char *tip;
        int is_builtin;
 };