Re: Another bug: Re: [PATCH 0/3] perf report: Add support to print a textual representation of IBS raw sample data

From: Arnaldo Carvalho de Melo
Date: Fri Sep 10 2021 - 17:40:24 EST


Em Fri, Sep 10, 2021 at 05:58:14PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Sep 10, 2021 at 04:48:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> >
> > All the cross builds are failing:
> >
> > 28 9.20 debian:experimental-x-arm64 : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
> > util/amd-sample-raw.c:12:10: fatal error: asm/amd-ibs.h: No such file or directory
> > 12 | #include <asm/amd-ibs.h>
> > | ^~~~~~~~~~~~~~~
> > compilation terminated.
>
> Trying with the same trick used by intel-pt to build on all arches:
>
> diff --git a/tools/perf/util/amd-sample-raw.c b/tools/perf/util/amd-sample-raw.c
> index fbb7d61c50489374..d19d765195c54b79 100644
> --- a/tools/perf/util/amd-sample-raw.c
> +++ b/tools/perf/util/amd-sample-raw.c
> @@ -9,7 +9,7 @@
> #include <inttypes.h>
>
> #include <linux/string.h>
> -#include <asm/amd-ibs.h>
> +#include "../../arch/x86/include/asm/amd-ibs.h"
>
> #include "debug.h"
> #include "session.h"

Not enough, this one is needed for msr-index.h, same reason, a bit more
involved, but check-patch.h has a few entries like that, see below.

Now it seems to be ok:

# export BUILD_TARBALL=http://192.168.100.2/perf/perf-5.14.0.tar.xz
# dm android-ndk:r12b-arm android-ndk:r15c-arm debian:experimental-x-arm64 debian:experimental-x-mips debian:experimental-x-mips64 debian:experimental-x-mipsel fedora:24-x-ARC-uClibc fedora:34-x-ARC-glibc fedora:34-x-ARC-uClibc mageia:7 openmandriva:cooker ubuntu:16.04-x-arm ubuntu:16.04-x-arm64 ubuntu:16.04-x-powerpc ubuntu:16.04-x-powerpc64 ubuntu:16.04-x-powerpc64el ubuntu:16.04-x-s390 ubuntu:18.04-x-arm ubuntu:18.04-x-arm64 ubuntu:18.04-x-m68k ubuntu:18.04-x-powerpc ubuntu:18.04-x-powerpc64 ubuntu:18.04-x-powerpc64el ubuntu:18.04-x-riscv64 ubuntu:18.04-x-s390 ubuntu:18.04-x-sh4 ubuntu:18.04-x-sparc64 ubuntu:20.04-x-powerpc64el ubuntu:20.04-x-s390 ubuntu:21.04-x-mips ubuntu:21.04-x-mips64
1 29.83 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
2 40.15 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
3 49.76 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
4 38.37 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
5 45.28 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 10.2.1-6) 10.2.1 20210110
6 45.15 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110
7: fedora:24-x-ARC-uClibc

Some more to go, but should be ok by now.

- Arnaldo

diff --git a/tools/arch/x86/include/asm/amd-ibs.h b/tools/arch/x86/include/asm/amd-ibs.h
index 46e1df45efc04627..174e7d83fcbdb22f 100644
--- a/tools/arch/x86/include/asm/amd-ibs.h
+++ b/tools/arch/x86/include/asm/amd-ibs.h
@@ -4,7 +4,7 @@
* 55898 Rev 0.35 - Feb 5, 2021
*/

-#include <asm/msr-index.h>
+#include "msr-index.h"

/*
* IBS Hardware MSRs
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 4a6b2b4ec5074a49..f1e46277e8226b5a 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -34,7 +34,6 @@ arch/x86/include/asm/inat_types.h
arch/x86/include/asm/emulate_prefix.h
arch/x86/include/asm/irq_vectors.h
arch/x86/include/asm/msr-index.h
-arch/x86/include/asm/amd-ibs.h
arch/x86/include/uapi/asm/prctl.h
arch/x86/lib/x86-opcode-map.txt
arch/x86/tools/gen-insn-attr-x86.awk
@@ -145,6 +144,7 @@ done
# diff with extra ignore lines
check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memcpy_\(erms\|orig\))"'
check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"'
+check arch/x86/include/asm/amd-ibs.h '-I "^#include [<\"]\(asm/\)*msr-index.h"'
check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'