1
0
Fork 0

perf build: Remove libaudit from the default feature checks

Ingo reported that the libaudit was always appearing as OFF:

  Auto-detecting system features:
  ...                         dwarf: [ on  ]
  ...            dwarf_getlocations: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ OFF ]

And everything seemed to work, i.e. we were checking for a feature that
we don't use, causing confusion for people building perf, so work to
remove that nuisance while making sure that it works when an arch
doesn't provide the alternative method to generate the syscall id/name
conversion tables.

Longer explanation of the new modus operandi:

  $ make -C tools/perf O=/tmp/build/perf NO_SYSCALL_TABLE=1
  <SNIP>
  Auto-detecting system features:
  ...                         dwarf: [ on  ]
  ...            dwarf_getlocations: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libcap: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...        numa_num_possible_cpus: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                     libcrypto: [ on  ]
  ...                     libunwind: [ on  ]
  ...            libdw-dwarf-unwind: [ on  ]
  ...                          zlib: [ on  ]
  ...                          lzma: [ on  ]
  ...                     get_cpuid: [ on  ]
  ...                           bpf: [ on  ]
  ...                        libaio: [ on  ]
  ...                       libzstd: [ on  ]
  ...        disassembler-four-args: [ on  ]

  Makefile.config:665: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
    GEN      /tmp/build/perf/common-cmds.h
    MKDIR    /tmp/build/perf/fd/
    MKDIR    /tmp/build/perf/fs/
  <SNIP>
  $

The libaudit test is forced and it fails when audit-libs-devel isn't available:

  $ cat /tmp/build/perf/feature/test-libaudit.make.output
  test-libaudit.c:2:10: fatal error: libaudit.h: No such file or directory
      2 | #include <libaudit.h>
        |          ^~~~~~~~~~~~
  compilation terminated.
  $

If we install audit-libs-devel and rebuild it continues not to be shown as OFF
in the main auto-detection summary, but again gets tested and this time:

  $ rpm -q audit-libs-devel
  audit-libs-devel-3.0-0.15.20191104git1c2f876.fc31.x86_64
  $

The make output for the feature detection comes clean:

  $ cat /tmp/build/perf/feature/test-libaudit.make.output

And the feature detection binary is successfully built and is dynamicly linked
with libaudit:

  $ ldd /tmp/build/perf/feature/test-libaudit.bin | grep audit
  	libaudit.so.1 => /lib64/libaudit.so.1 (0x00007f5bf5177000)
  $

As well as the resulting perf binary:

  $ ldd /tmp/build/perf/perf | grep audit
  	libaudit.so.1 => /lib64/libaudit.so.1 (0x00007fad511c7000)
  $

And 'perf trace' works using the libaudit method:

  $ sudo /tmp/build/perf/perf trace -e nanosleep sleep 1
       0.000 (1000.067 ms): sleep/281872 nanosleep(rqtp: 0x7ffedbbe69d0) = 0
  $

If we leave audit-libs-devel installed but don't disable the use of the best
method, the one using SYSCALL_TABLE, the default for architectures that provide
the script to build the syscall id/name mapping using the .tbl files copied
from the kernel sources, we get:

  $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
  $ make -C tools/perf O=/tmp/build/perf
  Auto-detecting system features:
  ...                         dwarf: [ on  ]
  ...            dwarf_getlocations: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libcap: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...        numa_num_possible_cpus: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                     libcrypto: [ on  ]
  ...                     libunwind: [ on  ]
  ...            libdw-dwarf-unwind: [ on  ]
  ...                          zlib: [ on  ]
  ...                          lzma: [ on  ]
  ...                     get_cpuid: [ on  ]
  ...                           bpf: [ on  ]
  ...                        libaio: [ on  ]
  ...                       libzstd: [ on  ]
  ...        disassembler-four-args: [ on  ]

    GEN      /tmp/build/perf/common-cmds.h
  <SNIP>
  $

Again, no mention of libaudit being on or OFF and:

  $ cat /tmp/build/perf/feature/test-libaudit.make.output
  cat: /tmp/build/perf/feature/test-libaudit.make.output: No such file or directory
  $

We didn't even bother checking for its availability, slightly speeding up the
build process and:

  $ ldd /tmp/build/perf/perf | grep libaudit
  $

We don't link with it, also:

  $ sudo /tmp/build/perf/perf trace -e nanosleep sleep 1
       0.000 (1000.053 ms): sleep/299125 nanosleep(rqtp: 0x7ffc24611b50) = 0
  $

And globs become available:

  $ sudo /tmp/build/perf/perf trace -e *sleep sleep 1
       0.000 (1000.072 ms): sleep/299136 nanosleep(rqtp: 0x7ffe7a3c4ff0) = 0
  $

Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
alistair/sunxi64-5.8
Arnaldo Carvalho de Melo 2020-05-29 11:11:59 -03:00
parent d21cb73a90
commit a88f70de1b
4 changed files with 2 additions and 8 deletions

View File

@ -40,7 +40,6 @@ FEATURE_TESTS_BASIC := \
glibc \
gtk2 \
gtk2-infobar \
libaudit \
libbfd \
libcap \
libelf \
@ -112,7 +111,6 @@ FEATURE_DISPLAY ?= \
dwarf_getlocations \
glibc \
gtk2 \
libaudit \
libbfd \
libcap \
libelf \

View File

@ -91,7 +91,7 @@ __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(
###############################
$(OUTPUT)test-all.bin:
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma
$(OUTPUT)test-hello.bin:
$(BUILD)

View File

@ -74,10 +74,6 @@
# include "test-libunwind.c"
#undef main
#define main main_test_libaudit
# include "test-libaudit.c"
#undef main
#define main main_test_libslang
# include "test-libslang.c"
#undef main
@ -208,7 +204,6 @@ int main(int argc, char *argv[])
main_test_libelf_gelf_getnote();
main_test_libelf_getshdrstrndx();
main_test_libunwind();
main_test_libaudit();
main_test_libslang();
main_test_gtk2(argc, argv);
main_test_gtk2_infobar(argc, argv);

View File

@ -660,6 +660,7 @@ ifeq ($(NO_SYSCALL_TABLE),0)
$(call detected,CONFIG_TRACE)
else
ifndef NO_LIBAUDIT
$(call feature_check,libaudit)
ifneq ($(feature-libaudit), 1)
msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
NO_LIBAUDIT := 1