summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-03-25 13:06:07 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-03-28 13:31:56 -0400
commitbe709d48329a500621d2a05835283150ae137b45 (patch)
tree169e4d1fc069a67686e3f1a5ee2c3015f371c22f /tools
parent4e8a5c1551370ebc0fbdb8f5c33dad13e45bdc99 (diff)
tools headers uapi: Sync asm-generic/mman-common.h and linux/mman.h
To deal with the move of some defines from asm-generic/mmap-common.h to linux/mman.h done in: 746c9398f5ac ("arch: move common mmap flags to linux/mman.h") The generated mmap_flags array stays the same: $ tools/perf/trace/beauty/mmap_flags.sh static const char *mmap_flags[] = { [ilog2(0x40) + 1] = "32BIT", [ilog2(0x01) + 1] = "SHARED", [ilog2(0x02) + 1] = "PRIVATE", [ilog2(0x10) + 1] = "FIXED", [ilog2(0x20) + 1] = "ANONYMOUS", [ilog2(0x100000) + 1] = "FIXED_NOREPLACE", [ilog2(0x0100) + 1] = "GROWSDOWN", [ilog2(0x0800) + 1] = "DENYWRITE", [ilog2(0x1000) + 1] = "EXECUTABLE", [ilog2(0x2000) + 1] = "LOCKED", [ilog2(0x4000) + 1] = "NORESERVE", [ilog2(0x8000) + 1] = "POPULATE", [ilog2(0x10000) + 1] = "NONBLOCK", [ilog2(0x20000) + 1] = "STACK", [ilog2(0x40000) + 1] = "HUGETLB", [ilog2(0x80000) + 1] = "SYNC", }; $ And to have the system's sys/mman.h find the definition of MAP_SHARED and MAP_PRIVATE, make sure they are defined in the tools/ mman-common.h in a way that keeps it the same as the kernel's, need for keeping the Android's NDK cross build working. This silences these perf build warnings: Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/mman-common.h' differs from latest version at 'include/uapi/asm-generic/mman-common.h' diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h Warning: Kernel ABI header at 'tools/include/uapi/linux/mman.h' differs from latest version at 'include/uapi/linux/mman.h' diff -u tools/include/uapi/linux/mman.h include/uapi/linux/mman.h Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-h80ycpc6pedg9s5z2rwpy6ws@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/arch/alpha/include/uapi/asm/mman.h2
-rw-r--r--tools/arch/mips/include/uapi/asm/mman.h2
-rw-r--r--tools/arch/parisc/include/uapi/asm/mman.h2
-rw-r--r--tools/arch/xtensa/include/uapi/asm/mman.h2
-rw-r--r--tools/include/uapi/asm-generic/mman-common-tools.h23
-rw-r--r--tools/include/uapi/asm-generic/mman-common.h4
-rw-r--r--tools/include/uapi/asm-generic/mman.h2
-rw-r--r--tools/include/uapi/linux/mman.h4
-rw-r--r--tools/perf/Makefile.perf4
-rwxr-xr-xtools/perf/check-headers.sh2
-rwxr-xr-xtools/perf/trace/beauty/mmap_flags.sh14
11 files changed, 43 insertions, 18 deletions
diff --git a/tools/arch/alpha/include/uapi/asm/mman.h b/tools/arch/alpha/include/uapi/asm/mman.h
index c317d3e6867a..ea6a255ae61f 100644
--- a/tools/arch/alpha/include/uapi/asm/mman.h
+++ b/tools/arch/alpha/include/uapi/asm/mman.h
@@ -27,8 +27,6 @@
27#define MAP_NONBLOCK 0x40000 27#define MAP_NONBLOCK 0x40000
28#define MAP_NORESERVE 0x10000 28#define MAP_NORESERVE 0x10000
29#define MAP_POPULATE 0x20000 29#define MAP_POPULATE 0x20000
30#define MAP_PRIVATE 0x02
31#define MAP_SHARED 0x01
32#define MAP_STACK 0x80000 30#define MAP_STACK 0x80000
33#define PROT_EXEC 0x4 31#define PROT_EXEC 0x4
34#define PROT_GROWSDOWN 0x01000000 32#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/arch/mips/include/uapi/asm/mman.h b/tools/arch/mips/include/uapi/asm/mman.h
index de2206883abc..c8acaa138d46 100644
--- a/tools/arch/mips/include/uapi/asm/mman.h
+++ b/tools/arch/mips/include/uapi/asm/mman.h
@@ -28,8 +28,6 @@
28#define MAP_NONBLOCK 0x20000 28#define MAP_NONBLOCK 0x20000
29#define MAP_NORESERVE 0x0400 29#define MAP_NORESERVE 0x0400
30#define MAP_POPULATE 0x10000 30#define MAP_POPULATE 0x10000
31#define MAP_PRIVATE 0x002
32#define MAP_SHARED 0x001
33#define MAP_STACK 0x40000 31#define MAP_STACK 0x40000
34#define PROT_EXEC 0x04 32#define PROT_EXEC 0x04
35#define PROT_GROWSDOWN 0x01000000 33#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
index 1bd78758bde9..f9fd1325f5bd 100644
--- a/tools/arch/parisc/include/uapi/asm/mman.h
+++ b/tools/arch/parisc/include/uapi/asm/mman.h
@@ -27,8 +27,6 @@
27#define MAP_NONBLOCK 0x20000 27#define MAP_NONBLOCK 0x20000
28#define MAP_NORESERVE 0x4000 28#define MAP_NORESERVE 0x4000
29#define MAP_POPULATE 0x10000 29#define MAP_POPULATE 0x10000
30#define MAP_PRIVATE 0x02
31#define MAP_SHARED 0x01
32#define MAP_STACK 0x40000 30#define MAP_STACK 0x40000
33#define PROT_EXEC 0x4 31#define PROT_EXEC 0x4
34#define PROT_GROWSDOWN 0x01000000 32#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/arch/xtensa/include/uapi/asm/mman.h b/tools/arch/xtensa/include/uapi/asm/mman.h
index 34dde6f44dae..f2b08c990afc 100644
--- a/tools/arch/xtensa/include/uapi/asm/mman.h
+++ b/tools/arch/xtensa/include/uapi/asm/mman.h
@@ -27,8 +27,6 @@
27#define MAP_NONBLOCK 0x20000 27#define MAP_NONBLOCK 0x20000
28#define MAP_NORESERVE 0x0400 28#define MAP_NORESERVE 0x0400
29#define MAP_POPULATE 0x10000 29#define MAP_POPULATE 0x10000
30#define MAP_PRIVATE 0x002
31#define MAP_SHARED 0x001
32#define MAP_STACK 0x40000 30#define MAP_STACK 0x40000
33#define PROT_EXEC 0x4 31#define PROT_EXEC 0x4
34#define PROT_GROWSDOWN 0x01000000 32#define PROT_GROWSDOWN 0x01000000
diff --git a/tools/include/uapi/asm-generic/mman-common-tools.h b/tools/include/uapi/asm-generic/mman-common-tools.h
new file mode 100644
index 000000000000..af7d0d3a3182
--- /dev/null
+++ b/tools/include/uapi/asm-generic/mman-common-tools.h
@@ -0,0 +1,23 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
3#define __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
4
5#include <asm-generic/mman-common.h>
6
7/* We need this because we need to have tools/include/uapi/ included in the tools
8 * header search path to get access to stuff that is not yet in the system's
9 * copy of the files in that directory, but since this cset:
10 *
11 * 746c9398f5ac ("arch: move common mmap flags to linux/mman.h")
12 *
13 * We end up making sys/mman.h, that is in the system headers, to not find the
14 * MAP_SHARED and MAP_PRIVATE defines because they are not anymore in our copy
15 * of asm-generic/mman-common.h. So we define them here and include this header
16 * from each of the per arch mman.h headers.
17 */
18#ifndef MAP_SHARED
19#define MAP_SHARED 0x01 /* Share changes */
20#define MAP_PRIVATE 0x02 /* Changes are private */
21#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
22#endif
23#endif // __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
index e7ee32861d51..abd238d0f7a4 100644
--- a/tools/include/uapi/asm-generic/mman-common.h
+++ b/tools/include/uapi/asm-generic/mman-common.h
@@ -15,9 +15,7 @@
15#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 15#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
16#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 16#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
17 17
18#define MAP_SHARED 0x01 /* Share changes */ 18/* 0x01 - 0x03 are defined in linux/mman.h */
19#define MAP_PRIVATE 0x02 /* Changes are private */
20#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
21#define MAP_TYPE 0x0f /* Mask for type of mapping */ 19#define MAP_TYPE 0x0f /* Mask for type of mapping */
22#define MAP_FIXED 0x10 /* Interpret addr exactly */ 20#define MAP_FIXED 0x10 /* Interpret addr exactly */
23#define MAP_ANONYMOUS 0x20 /* don't use a file */ 21#define MAP_ANONYMOUS 0x20 /* don't use a file */
diff --git a/tools/include/uapi/asm-generic/mman.h b/tools/include/uapi/asm-generic/mman.h
index 653687d9771b..36c197fc44a0 100644
--- a/tools/include/uapi/asm-generic/mman.h
+++ b/tools/include/uapi/asm-generic/mman.h
@@ -2,7 +2,7 @@
2#ifndef __ASM_GENERIC_MMAN_H 2#ifndef __ASM_GENERIC_MMAN_H
3#define __ASM_GENERIC_MMAN_H 3#define __ASM_GENERIC_MMAN_H
4 4
5#include <asm-generic/mman-common.h> 5#include <asm-generic/mman-common-tools.h>
6 6
7#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 7#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
8#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 8#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
index d0f515d53299..fc1a64c3447b 100644
--- a/tools/include/uapi/linux/mman.h
+++ b/tools/include/uapi/linux/mman.h
@@ -12,6 +12,10 @@
12#define OVERCOMMIT_ALWAYS 1 12#define OVERCOMMIT_ALWAYS 1
13#define OVERCOMMIT_NEVER 2 13#define OVERCOMMIT_NEVER 2
14 14
15#define MAP_SHARED 0x01 /* Share changes */
16#define MAP_PRIVATE 0x02 /* Changes are private */
17#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
18
15/* 19/*
16 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page 20 * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
17 * size other than the default is desired. See hugetlb_encode.h. 21 * size other than the default is desired. See hugetlb_encode.h.
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 01f7555fd933..e8c9f77e9010 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -481,8 +481,8 @@ $(madvise_behavior_array): $(madvise_hdr_dir)/mman-common.h $(madvise_behavior_t
481mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c 481mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c
482mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh 482mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh
483 483
484$(mmap_flags_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl) 484$(mmap_flags_array): $(linux_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl)
485 $(Q)$(SHELL) '$(mmap_flags_tbl)' $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@ 485 $(Q)$(SHELL) '$(mmap_flags_tbl)' $(linux_uapi_dir) $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@
486 486
487mount_flags_array := $(beauty_outdir)/mount_flags_array.c 487mount_flags_array := $(beauty_outdir)/mount_flags_array.c
488mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh 488mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 7b55613924de..c68ee06cae63 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -103,7 +103,7 @@ done
103# diff with extra ignore lines 103# diff with extra ignore lines
104check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' 104check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
105check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' 105check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
106check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"' 106check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
107check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' 107check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
108 108
109# diff non-symmetric files 109# diff non-symmetric files
diff --git a/tools/perf/trace/beauty/mmap_flags.sh b/tools/perf/trace/beauty/mmap_flags.sh
index 32bac9c0d694..5f5eefcb3c74 100755
--- a/tools/perf/trace/beauty/mmap_flags.sh
+++ b/tools/perf/trace/beauty/mmap_flags.sh
@@ -1,15 +1,18 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: LGPL-2.1 2# SPDX-License-Identifier: LGPL-2.1
3 3
4if [ $# -ne 2 ] ; then 4if [ $# -ne 3 ] ; then
5 [ $# -eq 1 ] && hostarch=$1 || hostarch=`uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/` 5 [ $# -eq 1 ] && hostarch=$1 || hostarch=`uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/`
6 linux_header_dir=tools/include/uapi/linux
6 header_dir=tools/include/uapi/asm-generic 7 header_dir=tools/include/uapi/asm-generic
7 arch_header_dir=tools/arch/${hostarch}/include/uapi/asm 8 arch_header_dir=tools/arch/${hostarch}/include/uapi/asm
8else 9else
9 header_dir=$1 10 linux_header_dir=$1
10 arch_header_dir=$2 11 header_dir=$2
12 arch_header_dir=$3
11fi 13fi
12 14
15linux_mman=${linux_header_dir}/mman.h
13arch_mman=${arch_header_dir}/mman.h 16arch_mman=${arch_header_dir}/mman.h
14 17
15# those in egrep -vw are flags, we want just the bits 18# those in egrep -vw are flags, we want just the bits
@@ -20,6 +23,11 @@ egrep -q $regex ${arch_mman} && \
20(egrep $regex ${arch_mman} | \ 23(egrep $regex ${arch_mman} | \
21 sed -r "s/$regex/\2 \1/g" | \ 24 sed -r "s/$regex/\2 \1/g" | \
22 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n") 25 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
26egrep -q $regex ${linux_mman} && \
27(egrep $regex ${linux_mman} | \
28 egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
29 sed -r "s/$regex/\2 \1/g" | \
30 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
23([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman}) && 31([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman}) &&
24(egrep $regex ${header_dir}/mman-common.h | \ 32(egrep $regex ${header_dir}/mman-common.h | \
25 egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \ 33 egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \