Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf check: Allow showing a tip for opt-in features not built into perf

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>

+14 -2
+13 -2
tools/perf/builtin-check.c
··· 27 27 .macro = #macro_, \ 28 28 .is_builtin = IS_BUILTIN(macro_) } 29 29 30 + #define FEATURE_STATUS_TIP(name_, macro_, tip_) { \ 31 + .name = name_, \ 32 + .macro = #macro_, \ 33 + .tip = tip_, \ 34 + .is_builtin = IS_BUILTIN(macro_) } 35 + 30 36 struct feature_status supported_features[] = { 31 37 FEATURE_STATUS("aio", HAVE_AIO_SUPPORT), 32 38 FEATURE_STATUS("bpf", HAVE_LIBBPF_SUPPORT), ··· 54 48 FEATURE_STATUS("libpython", HAVE_LIBPYTHON_SUPPORT), 55 49 FEATURE_STATUS("libslang", HAVE_SLANG_SUPPORT), 56 50 FEATURE_STATUS("libtraceevent", HAVE_LIBTRACEEVENT), 57 - FEATURE_STATUS("libunwind", HAVE_LIBUNWIND_SUPPORT), 51 + FEATURE_STATUS_TIP("libunwind", HAVE_LIBUNWIND_SUPPORT, "Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build with it"), 58 52 FEATURE_STATUS("lzma", HAVE_LZMA_SUPPORT), 59 53 FEATURE_STATUS("numa_num_possible_cpus", HAVE_LIBNUMA_SUPPORT), 60 54 FEATURE_STATUS("zlib", HAVE_ZLIB_SUPPORT), ··· 84 78 85 79 printf("%22s: ", name); 86 80 on_off_print(status); 87 - printf(" # %s\n", macro); 81 + printf(" # %s", macro); 82 + 83 + if (!feature->is_builtin && feature->tip) 84 + printf(" ( tip: %s )", feature->tip); 85 + 86 + putchar('\n'); 88 87 } 89 88 90 89 /**
+1
tools/perf/builtin.h
··· 5 5 struct feature_status { 6 6 const char *name; 7 7 const char *macro; 8 + const char *tip; 8 9 int is_builtin; 9 10 }; 10 11