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

perf beauty mmap_flags: Check if the arch has a mmap.h file

If not, then just use what is in asm-generic. This fixes the build for
my sh4, m68k and riscv64 perf test build containers that were failing
due to 80ee5668b8a7 ("perf beauty: Add a generator for MAP_ mmap's flag
constants"), that were not covered in the cset introducing those
tools/arch/*/include/uapi/asm/mman.h files.

f3539c12d819 ("tools include: Add uapi mman.h for each architecture")

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 80ee5668b8a7 ("perf beauty: Add a generator for MAP_ mmap's flag constants")
Link: https://lkml.kernel.org/n/tip-rpy9t2e0wxpnum1yvxhreafe@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+3 -3
+1 -1
tools/perf/Makefile.perf
··· 474 474 mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c 475 475 mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh 476 476 477 - $(mmap_flags_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(arch_asm_uapi_dir)/mman.h $(mmap_flags_tbl) 477 + $(mmap_flags_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl) 478 478 $(Q)$(SHELL) '$(mmap_flags_tbl)' $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@ 479 479 480 480 mount_flags_array := $(beauty_outdir)/mount_flags_array.c
+2 -2
tools/perf/trace/beauty/mmap_flags.sh
··· 20 20 (egrep $regex ${arch_mman} | \ 21 21 sed -r "s/$regex/\2 \1/g" | \ 22 22 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n") 23 - egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman} && 23 + [ ! -f ${arch_mman} || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman} ] && 24 24 (egrep $regex ${header_dir}/mman-common.h | \ 25 25 egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \ 26 26 sed -r "s/$regex/\2 \1/g" | \ 27 27 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n") 28 - egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.h>.*' ${arch_mman} && 28 + [ ! -f ${arch_mman} || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.h>.*' ${arch_mman} ] && 29 29 (egrep $regex ${header_dir}/mman.h | \ 30 30 sed -r "s/$regex/\2 \1/g" | \ 31 31 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")