linux-stable/tools
Leo Yan 71f7f897c3 perf build: Report failure for testing feature libopencsd
When build perf tool with passing option 'CORESIGHT=1' explicitly, if
the feature test fails for library libopencsd, the build doesn't
complain the feature failure and continue to build the tool with
disabling the CoreSight feature insteadly.

This patch changes the building behaviour, when build perf tool with the
option 'CORESIGHT=1' and detect the failure for testing feature
libopencsd, the build process will be aborted and it shows the complaint
info.

Committer testing:

First make sure there is no opencsd library installed:

  $ rpm -qa | grep -i csd
  $ sudo rm -rf `find /usr/local -name "*csd*"`
  $ find /usr/local -name "*csd*"
  $

Then cleanup the perf build output directory:

  $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
  $

And try to build explicitely asking for coresight:

  $ make O=/tmp/build/perf CORESIGHT=1 O=/tmp/build/perf -C tools/perf install-bin
  make: Entering directory '/var/home/acme/git/perf/tools/perf'
    BUILD:   Doing 'make -j24' parallel build
    HOSTCC  /tmp/build/perf/fixdep.o
    HOSTLD  /tmp/build/perf/fixdep-in.o
    LINK    /tmp/build/perf/fixdep
  Makefile.config:493: *** Error: No libopencsd library found or the version is not up-to-date. Please install recent libopencsd to build with CORESIGHT=1.  Stop.
  make[1]: *** [Makefile.perf:238: sub-make] Error 2
  make: *** [Makefile:113: install-bin] Error 2
  make: Leaving directory '/var/home/acme/git/perf/tools/perf'
  $

Now install the opencsd library present in Fedora 34:

  $ sudo dnf install opencsd-devel
  <SNIP>
  Installed:
    opencsd-1.0.0-1.fc34.x86_64 opencsd-devel-1.0.0-1.fc34.x86_64
  Complete!
  $

Try again building with coresight:

  $ make O=/tmp/build/perf CORESIGHT=1 O=/tmp/build/perf -C tools/perf install-bin
  make: Entering directory '/var/home/acme/git/perf/tools/perf'
    BUILD:   Doing 'make -j24' parallel build
  Makefile.config:493: *** Error: No libopencsd library found or the version is not up-to-date. Please install recent libopencsd to build with CORESIGHT=1.  Stop.
  make[1]: *** [Makefile.perf:238: sub-make] Error 2
  make: *** [Makefile:113: install-bin] Error 2
  make: Leaving directory '/var/home/acme/git/perf/tools/perf'
  $

Since Fedora 34 is pretty recent, one assumes we need to get it from its
upstream git repository, use rpm to find where that is:

  $ rpm -q --qf "%{URL}\n" opencsd
  https://github.com/Linaro/OpenCSD
  $

Go there, clone the repo, build it and install into /usr/local, then try
again:

  $ cd ~acme/git/perf
  $ make O=/tmp/build/perf VF=1 CORESIGHT=1 O=/tmp/build/perf -C tools/perf install-bin | grep -i opencsd
  ...                    libopencsd: [ on  ]
    PERF_VERSION = 5.14.g454719f67a3d
  $ export LD_LIBRARY_PATH=/usr/local/lib
  $ ldd ~/bin/perf | grep opencsd
  	libopencsd_c_api.so.1 => /usr/local/lib/libopencsd_c_api.so.1 (0x00007f28f78a4000)
  	libopencsd.so.1 => /usr/local/lib/libopencsd.so.1 (0x00007f28f6a2e000)
  $

Now it works.

Requested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: coresight@lists.linaro.org
Link: http://lore.kernel.org/lkml/20210902081800.550016-1-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-09-03 08:18:24 -03:00
..
accounting
arch tools headers UAPI: Sync files changed by the memfd_secret new syscall 2021-07-14 10:05:35 -03:00
bootconfig bootconfig: Share the checksum function with tools 2021-06-10 13:41:26 -04:00
bpf bpftool: Check malloc return value in mount_bpffs_for_pin 2021-07-15 20:01:36 +02:00
build perf cs-etm: Update OpenCSD decoder for ETE 2021-09-03 08:16:00 -03:00
cgroup
debugging tools: Fix "the the" in a message in kernel-chktaint 2021-06-13 17:01:17 -06:00
edid
firewire
firmware
gpio
hv
iio
include tools: Add sparse context/locking annotations in compiler-types.h 2021-08-19 15:39:22 -03:00
io_uring tools/io_uring/io_uring-cp: sync with liburing example 2021-08-13 08:58:11 -06:00
kvm/kvm_stat
laptop
leds
lib libperf cpumap: Take into advantage it is sorted to optimize perf_cpu_map__max() 2021-08-31 16:17:02 -03:00
memory-model
objtool A single ELF format fix for a section flags mismatch bug that breaks 2021-06-28 11:35:55 -07:00
pci
pcmcia
perf perf build: Report failure for testing feature libopencsd 2021-09-03 08:18:24 -03:00
power tools/power/x86/intel-speed-select: v1.10 release 2021-06-18 15:29:32 +02:00
rcu
scripts
spi
testing Networking fixes for 5.14-rc7, including fixes from bpf, wireless and 2021-08-19 12:33:43 -07:00
thermal/tmon
time
tracing
usb
virtio tools/virtio: fix build 2021-08-11 06:44:24 -04:00
vm tools/vm/page_owner_sort.c: check malloc() return 2021-06-29 10:53:47 -07:00
wmi
Makefile