* [PATCH 0/3] perf: Fix mmap related macros
@ 2016-09-12 12:54 Wang Nan
2016-09-12 12:54 ` [PATCH 1/3] tools include: Add uapi mman.h for each architecture Wang Nan
` (2 more replies)
0 siblings, 3 replies; 19+ messages in thread
From: Wang Nan @ 2016-09-12 12:54 UTC (permalink / raw)
To: acme; +Cc: linux-kernel, lizefan, pi3orama, Wang Nan
Some macros have different value for different archs. For example:
$ grep '#define MAP_HUGETLB' ./arch/*/include/ ./include/ -r
./arch/alpha/include/uapi/asm/mman.h:#define MAP_HUGETLB 0x100000
./arch/mips/include/uapi/asm/mman.h:#define MAP_HUGETLB 0x80000
./arch/parisc/include/uapi/asm/mman.h:#define MAP_HUGETLB 0x80000
./arch/powerpc/include/uapi/asm/mman.h:#define MAP_HUGETLB 0x40000
./arch/sparc/include/uapi/asm/mman.h:#define MAP_HUGETLB 0x40000
./arch/tile/include/uapi/asm/mman.h:#define MAP_HUGETLB 0x4000
./arch/xtensa/include/uapi/asm/mman.h:#define MAP_HUGETLB 0x80000
./include/uapi/asm-generic/mman.h:#define MAP_HUGETLB 0x40000
Current tools/perf/trace/beauty/mmap.c works for x86 only.
This patchset clone required macros from kernel source tree to tools/.
By replacing bits/mman.h, #include <sys/mman.h> automatically use
correct macros.
Wang Nan (3):
tools include: Add uapi mman.h for each architecture
tools include: Introduce bits/mman.h
perf build: Compare mman.h related headers againest kernel
tools/arch/alpha/include/uapi/asm/mman.h | 38 ++++++++++++++
tools/arch/arm/include/uapi/asm/mman.h | 4 ++
tools/arch/arm64/include/uapi/asm/mman.h | 4 ++
tools/arch/frv/include/uapi/asm/mman.h | 4 ++
tools/arch/h8300/include/uapi/asm/mman.h | 4 ++
tools/arch/hexagon/include/uapi/asm/mman.h | 4 ++
tools/arch/ia64/include/uapi/asm/mman.h | 4 ++
tools/arch/m32r/include/uapi/asm/mman.h | 4 ++
tools/arch/microblaze/include/uapi/asm/mman.h | 4 ++
tools/arch/mips/include/uapi/asm/mman.h | 39 ++++++++++++++
tools/arch/mn10300/include/uapi/asm/mman.h | 4 ++
tools/arch/parisc/include/uapi/asm/mman.h | 38 ++++++++++++++
tools/arch/powerpc/include/uapi/asm/mman.h | 13 +++++
tools/arch/s390/include/uapi/asm/mman.h | 4 ++
tools/arch/score/include/uapi/asm/mman.h | 4 ++
tools/arch/sh/include/uapi/asm/mman.h | 4 ++
tools/arch/sparc/include/uapi/asm/mman.h | 13 +++++
tools/arch/tile/include/uapi/asm/mman.h | 13 +++++
tools/arch/x86/include/uapi/asm/mman.h | 5 ++
tools/arch/xtensa/include/uapi/asm/mman.h | 38 ++++++++++++++
tools/include/bits/mman.h | 6 +++
tools/include/uapi/asm-generic/mman-common.h | 75 +++++++++++++++++++++++++++
tools/include/uapi/asm-generic/mman.h | 22 ++++++++
tools/include/uapi/linux/mman.h | 13 +++++
tools/perf/Makefile.perf | 9 ++++
25 files changed, 370 insertions(+)
create mode 100644 tools/arch/alpha/include/uapi/asm/mman.h
create mode 100644 tools/arch/arm/include/uapi/asm/mman.h
create mode 100644 tools/arch/arm64/include/uapi/asm/mman.h
create mode 100644 tools/arch/frv/include/uapi/asm/mman.h
create mode 100644 tools/arch/h8300/include/uapi/asm/mman.h
create mode 100644 tools/arch/hexagon/include/uapi/asm/mman.h
create mode 100644 tools/arch/ia64/include/uapi/asm/mman.h
create mode 100644 tools/arch/m32r/include/uapi/asm/mman.h
create mode 100644 tools/arch/microblaze/include/uapi/asm/mman.h
create mode 100644 tools/arch/mips/include/uapi/asm/mman.h
create mode 100644 tools/arch/mn10300/include/uapi/asm/mman.h
create mode 100644 tools/arch/parisc/include/uapi/asm/mman.h
create mode 100644 tools/arch/powerpc/include/uapi/asm/mman.h
create mode 100644 tools/arch/s390/include/uapi/asm/mman.h
create mode 100644 tools/arch/score/include/uapi/asm/mman.h
create mode 100644 tools/arch/sh/include/uapi/asm/mman.h
create mode 100644 tools/arch/sparc/include/uapi/asm/mman.h
create mode 100644 tools/arch/tile/include/uapi/asm/mman.h
create mode 100644 tools/arch/x86/include/uapi/asm/mman.h
create mode 100644 tools/arch/xtensa/include/uapi/asm/mman.h
create mode 100644 tools/include/bits/mman.h
create mode 100644 tools/include/uapi/asm-generic/mman-common.h
create mode 100644 tools/include/uapi/asm-generic/mman.h
create mode 100644 tools/include/uapi/linux/mman.h
--
1.8.3.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-12 12:54 [PATCH 0/3] perf: Fix mmap related macros Wang Nan
@ 2016-09-12 12:54 ` Wang Nan
2016-09-12 19:07 ` Arnaldo Carvalho de Melo
2016-09-20 21:37 ` [tip:perf/core] " tip-bot for Wang Nan
2016-09-12 12:54 ` [PATCH 2/3] tools include: Introduce bits/mman.h Wang Nan
2016-09-12 12:54 ` [PATCH 3/3] perf build: Compare mman.h related headers againest kernel Wang Nan
2 siblings, 2 replies; 19+ messages in thread
From: Wang Nan @ 2016-09-12 12:54 UTC (permalink / raw)
To: acme; +Cc: linux-kernel, lizefan, pi3orama, Wang Nan
Some mmap related macros have different values for different
architectures. This patch introduces uapi mman.h for each
architectures.
Three headers are cloned from kernel include to tools/include:
tools/include/uapi/asm-generic/mman-common.h
tools/include/uapi/asm-generic/mman.h
tools/include/uapi/linux/mman.h
The main part of this patch is generated by following script:
macros=`cat $0 | awk 'V==1 {print}; /^# start macro list/ {V=1}'`
for arch in `ls tools/arch`
do
[ -d tools/arch/$arch/include/uapi/asm ] || mkdir -p tools/arch/$arch/include/uapi/asm
src=arch/$arch/include/uapi/asm/mman.h
target=tools/arch/$arch/include/uapi/asm/mman.h
guard="TOOLS_ARCH_"`echo $arch | awk '{print toupper($0)}'`_UAPI_ASM_MMAN_FIX_H
echo '#ifndef '$guard > $target
echo '#define '$guard >> $target
[ -f $src ] &&
for m in $macros
do
if grep '#define[ \t]*'$m $src > /dev/null 2>&1
then
grep -h '#define[ \t]*'$m $src | sed 's/[ \t]*\/\*.*$//g' >> $target
fi
done
if [ -f $src ]
then
grep '#include <asm-generic' $src >> $target
else
echo "#include <asm-generic/mman.h>" >> $target
fi
echo '#endif' >> $target
echo "$target"
done
exit 0
# Following macros are extracted from:
# tools/perf/trace/beauty/mmap.c
#
# start macro list
MADV_DODUMP
MADV_DOFORK
MADV_DONTDUMP
MADV_DONTFORK
MADV_DONTNEED
MADV_HUGEPAGE
MADV_HWPOISON
MADV_MERGEABLE
MADV_NOHUGEPAGE
MADV_NORMAL
MADV_RANDOM
MADV_REMOVE
MADV_SEQUENTIAL
MADV_SOFT_OFFLINE
MADV_UNMERGEABLE
MADV_WILLNEED
MAP_32BIT
MAP_ANONYMOUS
MAP_DENYWRITE
MAP_EXECUTABLE
MAP_FILE
MAP_FIXED
MAP_GROWSDOWN
MAP_HUGETLB
MAP_LOCKED
MAP_NONBLOCK
MAP_NORESERVE
MAP_POPULATE
MAP_PRIVATE
MAP_SHARED
MAP_STACK
MAP_UNINITIALIZED
MREMAP_FIXED
MREMAP_MAYMOVE
PROT_EXEC
PROT_GROWSDOWN
PROT_GROWSUP
PROT_NONE
PROT_READ
PROT_SEM
PROT_WRITE
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
---
tools/arch/alpha/include/uapi/asm/mman.h | 38 ++++++++++++++
tools/arch/arm/include/uapi/asm/mman.h | 4 ++
tools/arch/arm64/include/uapi/asm/mman.h | 4 ++
tools/arch/frv/include/uapi/asm/mman.h | 4 ++
tools/arch/h8300/include/uapi/asm/mman.h | 4 ++
tools/arch/hexagon/include/uapi/asm/mman.h | 4 ++
tools/arch/ia64/include/uapi/asm/mman.h | 4 ++
tools/arch/m32r/include/uapi/asm/mman.h | 4 ++
tools/arch/microblaze/include/uapi/asm/mman.h | 4 ++
tools/arch/mips/include/uapi/asm/mman.h | 39 ++++++++++++++
tools/arch/mn10300/include/uapi/asm/mman.h | 4 ++
tools/arch/parisc/include/uapi/asm/mman.h | 38 ++++++++++++++
tools/arch/powerpc/include/uapi/asm/mman.h | 13 +++++
tools/arch/s390/include/uapi/asm/mman.h | 4 ++
tools/arch/score/include/uapi/asm/mman.h | 4 ++
tools/arch/sh/include/uapi/asm/mman.h | 4 ++
tools/arch/sparc/include/uapi/asm/mman.h | 13 +++++
tools/arch/tile/include/uapi/asm/mman.h | 13 +++++
tools/arch/x86/include/uapi/asm/mman.h | 5 ++
tools/arch/xtensa/include/uapi/asm/mman.h | 38 ++++++++++++++
tools/include/uapi/asm-generic/mman-common.h | 75 +++++++++++++++++++++++++++
tools/include/uapi/asm-generic/mman.h | 22 ++++++++
tools/include/uapi/linux/mman.h | 13 +++++
23 files changed, 355 insertions(+)
create mode 100644 tools/arch/alpha/include/uapi/asm/mman.h
create mode 100644 tools/arch/arm/include/uapi/asm/mman.h
create mode 100644 tools/arch/arm64/include/uapi/asm/mman.h
create mode 100644 tools/arch/frv/include/uapi/asm/mman.h
create mode 100644 tools/arch/h8300/include/uapi/asm/mman.h
create mode 100644 tools/arch/hexagon/include/uapi/asm/mman.h
create mode 100644 tools/arch/ia64/include/uapi/asm/mman.h
create mode 100644 tools/arch/m32r/include/uapi/asm/mman.h
create mode 100644 tools/arch/microblaze/include/uapi/asm/mman.h
create mode 100644 tools/arch/mips/include/uapi/asm/mman.h
create mode 100644 tools/arch/mn10300/include/uapi/asm/mman.h
create mode 100644 tools/arch/parisc/include/uapi/asm/mman.h
create mode 100644 tools/arch/powerpc/include/uapi/asm/mman.h
create mode 100644 tools/arch/s390/include/uapi/asm/mman.h
create mode 100644 tools/arch/score/include/uapi/asm/mman.h
create mode 100644 tools/arch/sh/include/uapi/asm/mman.h
create mode 100644 tools/arch/sparc/include/uapi/asm/mman.h
create mode 100644 tools/arch/tile/include/uapi/asm/mman.h
create mode 100644 tools/arch/x86/include/uapi/asm/mman.h
create mode 100644 tools/arch/xtensa/include/uapi/asm/mman.h
create mode 100644 tools/include/uapi/asm-generic/mman-common.h
create mode 100644 tools/include/uapi/asm-generic/mman.h
create mode 100644 tools/include/uapi/linux/mman.h
diff --git a/tools/arch/alpha/include/uapi/asm/mman.h b/tools/arch/alpha/include/uapi/asm/mman.h
new file mode 100644
index 0000000..6ed4ad4
--- /dev/null
+++ b/tools/arch/alpha/include/uapi/asm/mman.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 17
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 16
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 6
+#define MADV_HUGEPAGE 14
+#define MADV_MERGEABLE 12
+#define MADV_NOHUGEPAGE 15
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 13
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x10
+#define MAP_DENYWRITE 0x02000
+#define MAP_EXECUTABLE 0x04000
+#define MAP_FILE 0
+#define MAP_FIXED 0x100
+#define MAP_GROWSDOWN 0x01000
+#define MAP_HUGETLB 0x100000
+#define MAP_LOCKED 0x08000
+#define MAP_NONBLOCK 0x40000
+#define MAP_NORESERVE 0x10000
+#define MAP_POPULATE 0x20000
+#define MAP_PRIVATE 0x02
+#define MAP_SHARED 0x01
+#define MAP_STACK 0x80000
+#define PROT_EXEC 0x4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x0
+#define PROT_READ 0x1
+#define PROT_SEM 0x8
+#define PROT_WRITE 0x2
+#endif
diff --git a/tools/arch/arm/include/uapi/asm/mman.h b/tools/arch/arm/include/uapi/asm/mman.h
new file mode 100644
index 0000000..0e2562b
--- /dev/null
+++ b/tools/arch/arm/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/arm64/include/uapi/asm/mman.h b/tools/arch/arm64/include/uapi/asm/mman.h
new file mode 100644
index 0000000..be5d271
--- /dev/null
+++ b/tools/arch/arm64/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/frv/include/uapi/asm/mman.h b/tools/arch/frv/include/uapi/asm/mman.h
new file mode 100644
index 0000000..d25ec8c
--- /dev/null
+++ b/tools/arch/frv/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/h8300/include/uapi/asm/mman.h b/tools/arch/h8300/include/uapi/asm/mman.h
new file mode 100644
index 0000000..fc7bbad
--- /dev/null
+++ b/tools/arch/h8300/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/hexagon/include/uapi/asm/mman.h b/tools/arch/hexagon/include/uapi/asm/mman.h
new file mode 100644
index 0000000..2b29088
--- /dev/null
+++ b/tools/arch/hexagon/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/ia64/include/uapi/asm/mman.h b/tools/arch/ia64/include/uapi/asm/mman.h
new file mode 100644
index 0000000..0353e96
--- /dev/null
+++ b/tools/arch/ia64/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/m32r/include/uapi/asm/mman.h b/tools/arch/m32r/include/uapi/asm/mman.h
new file mode 100644
index 0000000..fc39337
--- /dev/null
+++ b/tools/arch/m32r/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/microblaze/include/uapi/asm/mman.h b/tools/arch/microblaze/include/uapi/asm/mman.h
new file mode 100644
index 0000000..0a0267d
--- /dev/null
+++ b/tools/arch/microblaze/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/mips/include/uapi/asm/mman.h b/tools/arch/mips/include/uapi/asm/mman.h
new file mode 100644
index 0000000..db88fa4
--- /dev/null
+++ b/tools/arch/mips/include/uapi/asm/mman.h
@@ -0,0 +1,39 @@
+#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 17
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 16
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 4
+#define MADV_HUGEPAGE 14
+#define MADV_HWPOISON 100
+#define MADV_MERGEABLE 12
+#define MADV_NOHUGEPAGE 15
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 13
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x0800
+#define MAP_DENYWRITE 0x2000
+#define MAP_EXECUTABLE 0x4000
+#define MAP_FILE 0
+#define MAP_FIXED 0x010
+#define MAP_GROWSDOWN 0x1000
+#define MAP_HUGETLB 0x80000
+#define MAP_LOCKED 0x8000
+#define MAP_NONBLOCK 0x20000
+#define MAP_NORESERVE 0x0400
+#define MAP_POPULATE 0x10000
+#define MAP_PRIVATE 0x002
+#define MAP_SHARED 0x001
+#define MAP_STACK 0x40000
+#define PROT_EXEC 0x04
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x00
+#define PROT_READ 0x01
+#define PROT_SEM 0x10
+#define PROT_WRITE 0x02
+#endif
diff --git a/tools/arch/mn10300/include/uapi/asm/mman.h b/tools/arch/mn10300/include/uapi/asm/mman.h
new file mode 100644
index 0000000..dfa95a0
--- /dev/null
+++ b/tools/arch/mn10300/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
new file mode 100644
index 0000000..c4a9d9f
--- /dev/null
+++ b/tools/arch/parisc/include/uapi/asm/mman.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 70
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 69
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 4
+#define MADV_HUGEPAGE 67
+#define MADV_MERGEABLE 65
+#define MADV_NOHUGEPAGE 68
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 66
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x10
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_FILE 0
+#define MAP_FIXED 0x04
+#define MAP_GROWSDOWN 0x8000
+#define MAP_HUGETLB 0x80000
+#define MAP_LOCKED 0x2000
+#define MAP_NONBLOCK 0x20000
+#define MAP_NORESERVE 0x4000
+#define MAP_POPULATE 0x10000
+#define MAP_PRIVATE 0x02
+#define MAP_SHARED 0x01
+#define MAP_STACK 0x40000
+#define PROT_EXEC 0x4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x0
+#define PROT_READ 0x1
+#define PROT_SEM 0x8
+#define PROT_WRITE 0x2
+#endif
diff --git a/tools/arch/powerpc/include/uapi/asm/mman.h b/tools/arch/powerpc/include/uapi/asm/mman.h
new file mode 100644
index 0000000..5afb126
--- /dev/null
+++ b/tools/arch/powerpc/include/uapi/asm/mman.h
@@ -0,0 +1,13 @@
+#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_GROWSDOWN 0x0100
+#define MAP_HUGETLB 0x40000
+#define MAP_LOCKED 0x80
+#define MAP_NONBLOCK 0x10000
+#define MAP_NORESERVE 0x40
+#define MAP_POPULATE 0x8000
+#define MAP_STACK 0x20000
+#include <asm-generic/mman-common.h>
+#endif
diff --git a/tools/arch/s390/include/uapi/asm/mman.h b/tools/arch/s390/include/uapi/asm/mman.h
new file mode 100644
index 0000000..d4dc8a6
--- /dev/null
+++ b/tools/arch/s390/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/score/include/uapi/asm/mman.h b/tools/arch/score/include/uapi/asm/mman.h
new file mode 100644
index 0000000..f9b63b8
--- /dev/null
+++ b/tools/arch/score/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/sh/include/uapi/asm/mman.h b/tools/arch/sh/include/uapi/asm/mman.h
new file mode 100644
index 0000000..ea46f1b
--- /dev/null
+++ b/tools/arch/sh/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/sparc/include/uapi/asm/mman.h b/tools/arch/sparc/include/uapi/asm/mman.h
new file mode 100644
index 0000000..2374ec9
--- /dev/null
+++ b/tools/arch/sparc/include/uapi/asm/mman.h
@@ -0,0 +1,13 @@
+#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_GROWSDOWN 0x0200
+#define MAP_HUGETLB 0x40000
+#define MAP_LOCKED 0x100
+#define MAP_NONBLOCK 0x10000
+#define MAP_NORESERVE 0x40
+#define MAP_POPULATE 0x8000
+#define MAP_STACK 0x20000
+#include <asm-generic/mman-common.h>
+#endif
diff --git a/tools/arch/tile/include/uapi/asm/mman.h b/tools/arch/tile/include/uapi/asm/mman.h
new file mode 100644
index 0000000..6e64564
--- /dev/null
+++ b/tools/arch/tile/include/uapi/asm/mman.h
@@ -0,0 +1,13 @@
+#ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_GROWSDOWN 0x0100
+#define MAP_HUGETLB 0x4000
+#define MAP_LOCKED 0x0200
+#define MAP_NONBLOCK 0x0080
+#define MAP_NORESERVE 0x0400
+#define MAP_POPULATE 0x0040
+#define MAP_STACK MAP_GROWSDOWN
+#include <asm-generic/mman-common.h>
+#endif
diff --git a/tools/arch/x86/include/uapi/asm/mman.h b/tools/arch/x86/include/uapi/asm/mman.h
new file mode 100644
index 0000000..62176803
--- /dev/null
+++ b/tools/arch/x86/include/uapi/asm/mman.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
+#define MAP_32BIT 0x40
+#include <asm-generic/mman.h>
+#endif
diff --git a/tools/arch/xtensa/include/uapi/asm/mman.h b/tools/arch/xtensa/include/uapi/asm/mman.h
new file mode 100644
index 0000000..1c89538
--- /dev/null
+++ b/tools/arch/xtensa/include/uapi/asm/mman.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 17
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 16
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 4
+#define MADV_HUGEPAGE 14
+#define MADV_MERGEABLE 12
+#define MADV_NOHUGEPAGE 15
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 13
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x0800
+#define MAP_DENYWRITE 0x2000
+#define MAP_EXECUTABLE 0x4000
+#define MAP_FILE 0
+#define MAP_FIXED 0x010
+#define MAP_GROWSDOWN 0x1000
+#define MAP_HUGETLB 0x80000
+#define MAP_LOCKED 0x8000
+#define MAP_NONBLOCK 0x20000
+#define MAP_NORESERVE 0x0400
+#define MAP_POPULATE 0x10000
+#define MAP_PRIVATE 0x002
+#define MAP_SHARED 0x001
+#define MAP_STACK 0x40000
+#define PROT_EXEC 0x4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x0
+#define PROT_READ 0x1
+#define PROT_SEM 0x10
+#define PROT_WRITE 0x2
+#endif
diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
new file mode 100644
index 0000000..5827438
--- /dev/null
+++ b/tools/include/uapi/asm-generic/mman-common.h
@@ -0,0 +1,75 @@
+#ifndef __ASM_GENERIC_MMAN_COMMON_H
+#define __ASM_GENERIC_MMAN_COMMON_H
+
+/*
+ Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
+ Based on: asm-xxx/mman.h
+*/
+
+#define PROT_READ 0x1 /* page can be read */
+#define PROT_WRITE 0x2 /* page can be written */
+#define PROT_EXEC 0x4 /* page can be executed */
+#define PROT_SEM 0x8 /* page may be used for atomic ops */
+#define PROT_NONE 0x0 /* page can not be accessed */
+#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
+#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
+
+#define MAP_SHARED 0x01 /* Share changes */
+#define MAP_PRIVATE 0x02 /* Changes are private */
+#define MAP_TYPE 0x0f /* Mask for type of mapping */
+#define MAP_FIXED 0x10 /* Interpret addr exactly */
+#define MAP_ANONYMOUS 0x20 /* don't use a file */
+#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
+# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */
+#else
+# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
+#endif
+
+/*
+ * Flags for mlock
+ */
+#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
+
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+
+#define MADV_NORMAL 0 /* no further special treatment */
+#define MADV_RANDOM 1 /* expect random page references */
+#define MADV_SEQUENTIAL 2 /* expect sequential page references */
+#define MADV_WILLNEED 3 /* will need these pages */
+#define MADV_DONTNEED 4 /* don't need these pages */
+
+/* common parameters: try to keep these consistent across architectures */
+#define MADV_FREE 8 /* free pages only if memory pressure */
+#define MADV_REMOVE 9 /* remove these pages & resources */
+#define MADV_DONTFORK 10 /* don't inherit across fork */
+#define MADV_DOFORK 11 /* do inherit across fork */
+#define MADV_HWPOISON 100 /* poison a page for testing */
+#define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */
+
+#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
+#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
+
+#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
+#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
+
+#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
+ overrides the coredump filter bits */
+#define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */
+
+/* compatibility flags */
+#define MAP_FILE 0
+
+/*
+ * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
+ * This gives us 6 bits, which is enough until someone invents 128 bit address
+ * spaces.
+ *
+ * Assume these are all power of twos.
+ * When 0 use the default page size.
+ */
+#define MAP_HUGE_SHIFT 26
+#define MAP_HUGE_MASK 0x3f
+
+#endif /* __ASM_GENERIC_MMAN_COMMON_H */
diff --git a/tools/include/uapi/asm-generic/mman.h b/tools/include/uapi/asm-generic/mman.h
new file mode 100644
index 0000000..7162cd4
--- /dev/null
+++ b/tools/include/uapi/asm-generic/mman.h
@@ -0,0 +1,22 @@
+#ifndef __ASM_GENERIC_MMAN_H
+#define __ASM_GENERIC_MMAN_H
+
+#include <asm-generic/mman-common.h>
+
+#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MAP_LOCKED 0x2000 /* pages are locked */
+#define MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
+#define MAP_NONBLOCK 0x10000 /* do not block on IO */
+#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
+
+/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
+
+#define MCL_CURRENT 1 /* lock all current mappings */
+#define MCL_FUTURE 2 /* lock all future mappings */
+#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
+
+#endif /* __ASM_GENERIC_MMAN_H */
diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
new file mode 100644
index 0000000..ade4acd
--- /dev/null
+++ b/tools/include/uapi/linux/mman.h
@@ -0,0 +1,13 @@
+#ifndef _UAPI_LINUX_MMAN_H
+#define _UAPI_LINUX_MMAN_H
+
+#include <asm/mman.h>
+
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+
+#define OVERCOMMIT_GUESS 0
+#define OVERCOMMIT_ALWAYS 1
+#define OVERCOMMIT_NEVER 2
+
+#endif /* _UAPI_LINUX_MMAN_H */
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/3] tools include: Introduce bits/mman.h
2016-09-12 12:54 [PATCH 0/3] perf: Fix mmap related macros Wang Nan
2016-09-12 12:54 ` [PATCH 1/3] tools include: Add uapi mman.h for each architecture Wang Nan
@ 2016-09-12 12:54 ` Wang Nan
2016-09-12 12:54 ` [PATCH 3/3] perf build: Compare mman.h related headers againest kernel Wang Nan
2 siblings, 0 replies; 19+ messages in thread
From: Wang Nan @ 2016-09-12 12:54 UTC (permalink / raw)
To: acme; +Cc: linux-kernel, lizefan, pi3orama, Wang Nan
Makes '#include <sys/mman.h>' automatically uses macros defined in
uapi/asm for each architecture. At least for glibc, <sys/mman.h>
includes <bits/mman.h> for mmap macros. This patch replaces
bits/mman.h, makes it use headers in uapi.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
---
tools/include/bits/mman.h | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 tools/include/bits/mman.h
diff --git a/tools/include/bits/mman.h b/tools/include/bits/mman.h
new file mode 100644
index 0000000..9be2717
--- /dev/null
+++ b/tools/include/bits/mman.h
@@ -0,0 +1,6 @@
+#ifndef TOOLS_INCLUDE_BITS_MMAN_H
+#define TOOLS_INCLUDE_BITS_MMAN_H
+
+#include <linux/mman.h>
+
+#endif
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/3] perf build: Compare mman.h related headers againest kernel
2016-09-12 12:54 [PATCH 0/3] perf: Fix mmap related macros Wang Nan
2016-09-12 12:54 ` [PATCH 1/3] tools include: Add uapi mman.h for each architecture Wang Nan
2016-09-12 12:54 ` [PATCH 2/3] tools include: Introduce bits/mman.h Wang Nan
@ 2016-09-12 12:54 ` Wang Nan
2016-09-20 21:39 ` [tip:perf/core] perf build: Compare mman.h related headers against kernel originals tip-bot for Wang Nan
2 siblings, 1 reply; 19+ messages in thread
From: Wang Nan @ 2016-09-12 12:54 UTC (permalink / raw)
To: acme; +Cc: linux-kernel, lizefan, pi3orama, Wang Nan
As other clone headers, compare newly introduced mman related headers
againest their source copy in kernel tree.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
---
tools/perf/Makefile.perf | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 828cfd7..3686f1d 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -432,6 +432,15 @@ $(PERF_IN): prepare FORCE
@(test -f ../../include/linux/coresight-pmu.h && ( \
(diff -B ../include/linux/coresight-pmu.h ../../include/linux/coresight-pmu.h >/dev/null) \
|| echo "Warning: tools/include/linux/coresight-pmu.h differs from kernel" >&2 )) || true
+ @(test -f ../../include/uapi/asm-generic/mman-common.h && ( \
+ (diff -B ../include/uapi/asm-generic/mman-common.h ../../include/uapi/asm-generic/mman-common.h >/dev/null) \
+ || echo "Warning: tools/include/uapi/asm-generic/mman-common.h differs from kernel" >&2 )) || true
+ @(test -f ../../include/uapi/asm-generic/mman.h && ( \
+ (diff -B ../include/uapi/asm-generic/mman.h ../../include/uapi/asm-generic/mman.h >/dev/null) \
+ || echo "Warning: tools/include/uapi/asm-generic/mman.h differs from kernel" >&2 )) || true
+ @(test -f ../../include/uapi/linux/mman.h && ( \
+ (diff -B ../include/uapi/linux/mman.h ../../include/uapi/linux/mman.h >/dev/null) \
+ || echo "Warning: tools/include/uapi/linux/mman.h differs from kernel" >&2 )) || true
$(Q)$(MAKE) $(build)=perf
$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
--
1.8.3.4
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-12 12:54 ` [PATCH 1/3] tools include: Add uapi mman.h for each architecture Wang Nan
@ 2016-09-12 19:07 ` Arnaldo Carvalho de Melo
2016-09-12 21:15 ` Arnaldo Carvalho de Melo
2016-09-20 21:37 ` [tip:perf/core] " tip-bot for Wang Nan
1 sibling, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-12 19:07 UTC (permalink / raw)
To: Wang Nan; +Cc: linux-kernel, lizefan, pi3orama
Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
> Some mmap related macros have different values for different
> architectures. This patch introduces uapi mman.h for each
> architectures.
>
> Three headers are cloned from kernel include to tools/include:
>
> tools/include/uapi/asm-generic/mman-common.h
> tools/include/uapi/asm-generic/mman.h
> tools/include/uapi/linux/mman.h
Cool, the above was done as copies, why not the rest? IIRC you mentioned
some reasoning behind that decision, but we need it spelled out here.
For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
and couldn't find why we shouldn't copy it just like the three files
above.
I'm looking now at why the build breaks in so many systems, first hunch
is that bits/ part (the ones without the failure details probably have
the same errors), alpine uses musl libc, but some that broke are glibc
based.
[root@jouet ~]# time dm
1 17.973758230 alpine:3.4: FAIL
CC /tmp/build/perf/ui/gtk/helpline.o
util/evlist.c: In function 'perf_mmap__mmap':
util/evlist.c:1010:19: error: 'MAP_FAILED' undeclared (first use in this function)
if (map->base == MAP_FAILED) {
^
CC /tmp/build/perf/tests/mmap-thread-lookup.o
tests/mmap-thread-lookup.c: In function 'thread_init':
tests/mmap-thread-lookup.c:36:13: error: 'MAP_FAILED' undeclared (first use in this function)
if (map == MAP_FAILED) {
^
2 23.829330164 android-ndk:r12b-arm: Ok
3 35.751916863 archlinux:latest: FAIL
CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function 'alloc_data':
bench/numa.c:337:53: error: 'MAP_ANON' undeclared (first use in this function)
buf = (void *)mmap(0, bytes, PROT_READ|PROT_WRITE, MAP_ANON|map_flags, -1, 0);
^~~~~~~~
4 38.572208679 centos:5: Ok
5 26.714708734 centos:6: FAIL
CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function 'alloc_data':
bench/numa.c:337: error: 'MAP_ANON' undeclared (first use in this function)
6 32.837248143 centos:7: FAIL
bench/numa.c:337:53: error: 'MAP_ANON' undeclared (first use in this function)
buf = (void *)mmap(0, bytes, PROT_READ|PROT_WRITE, MAP_ANON|map_flags, -1, 0);
^
7 63.308075869 debian:7: Ok
8 33.929417619 debian:8: FAIL
CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function 'alloc_data':
bench/numa.c:337:53: error: 'MAP_ANON' undeclared (first use in this function)
buf = (void *)mmap(0, bytes, PROT_READ|PROT_WRITE, MAP_ANON|map_flags, -1, 0);
^
9 32.952231740 debian:experimental: FAIL
10 31.829857966 fedora:20: FAIL
CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function 'alloc_data':
bench/numa.c:337:53: error: 'MAP_ANON' undeclared (first use in this function)
buf = (void *)mmap(0, bytes, PROT_READ|PROT_WRITE, MAP_ANON|map_flags, -1, 0);
^
11 34.036926800 fedora:21: FAIL
12 36.631930655 fedora:22: FAIL
13 36.143394407 fedora:23: FAIL
14 38.141220936 fedora:24: FAIL
15 29.933559651 fedora:24-x-ARC-uClibc: Ok
16 35.423161135 fedora:rawhide: FAIL
CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function 'alloc_data':
bench/numa.c:337:53: error: 'MAP_ANON' undeclared (first use in this function)
buf = (void *)mmap(0, bytes, PROT_READ|PROT_WRITE, MAP_ANON|map_flags, -1, 0);
^~~~~~~~
17 39.673341183 mageia:5: FAIL
18 35.997827388 opensuse:13.2: FAIL
19 36.782868824 opensuse:42.1: FAIL
20 35.862577706 opensuse:tumbleweed: FAIL
21 56.936622721 ubuntu:12.04.5: Ok
22 32.634934252 ubuntu:14.04: FAIL
23 32.591958645 ubuntu:14.04.4: FAIL
24 33.994194481 ubuntu:15.10: FAIL
25 32.225119114 ubuntu:16.04: FAIL
26 52.260138011 ubuntu:16.04-x-arm: Ok
27 51.721441301 ubuntu:16.04-x-arm64: Ok
28 52.471039288 ubuntu:16.04-x-powerpc64: Ok
29 53.852692344 ubuntu:16.04-x-powerpc64el: Ok
30 40.392441174 ubuntu:16.10: FAIL
31 61.863598268 ubuntu:16.10-x-s390: Ok
> The main part of this patch is generated by following script:
>
> macros=`cat $0 | awk 'V==1 {print}; /^# start macro list/ {V=1}'`
> for arch in `ls tools/arch`
> do
> [ -d tools/arch/$arch/include/uapi/asm ] || mkdir -p tools/arch/$arch/include/uapi/asm
> src=arch/$arch/include/uapi/asm/mman.h
> target=tools/arch/$arch/include/uapi/asm/mman.h
> guard="TOOLS_ARCH_"`echo $arch | awk '{print toupper($0)}'`_UAPI_ASM_MMAN_FIX_H
> echo '#ifndef '$guard > $target
> echo '#define '$guard >> $target
>
> [ -f $src ] &&
> for m in $macros
> do
> if grep '#define[ \t]*'$m $src > /dev/null 2>&1
> then
> grep -h '#define[ \t]*'$m $src | sed 's/[ \t]*\/\*.*$//g' >> $target
> fi
> done
>
> if [ -f $src ]
> then
> grep '#include <asm-generic' $src >> $target
> else
> echo "#include <asm-generic/mman.h>" >> $target
> fi
> echo '#endif' >> $target
> echo "$target"
> done
>
> exit 0
> # Following macros are extracted from:
> # tools/perf/trace/beauty/mmap.c
> #
> # start macro list
> MADV_DODUMP
> MADV_DOFORK
> MADV_DONTDUMP
> MADV_DONTFORK
> MADV_DONTNEED
> MADV_HUGEPAGE
> MADV_HWPOISON
> MADV_MERGEABLE
> MADV_NOHUGEPAGE
> MADV_NORMAL
> MADV_RANDOM
> MADV_REMOVE
> MADV_SEQUENTIAL
> MADV_SOFT_OFFLINE
> MADV_UNMERGEABLE
> MADV_WILLNEED
> MAP_32BIT
> MAP_ANONYMOUS
> MAP_DENYWRITE
> MAP_EXECUTABLE
> MAP_FILE
> MAP_FIXED
> MAP_GROWSDOWN
> MAP_HUGETLB
> MAP_LOCKED
> MAP_NONBLOCK
> MAP_NORESERVE
> MAP_POPULATE
> MAP_PRIVATE
> MAP_SHARED
> MAP_STACK
> MAP_UNINITIALIZED
> MREMAP_FIXED
> MREMAP_MAYMOVE
> PROT_EXEC
> PROT_GROWSDOWN
> PROT_GROWSUP
> PROT_NONE
> PROT_READ
> PROT_SEM
> PROT_WRITE
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> ---
> tools/arch/alpha/include/uapi/asm/mman.h | 38 ++++++++++++++
> tools/arch/arm/include/uapi/asm/mman.h | 4 ++
> tools/arch/arm64/include/uapi/asm/mman.h | 4 ++
> tools/arch/frv/include/uapi/asm/mman.h | 4 ++
> tools/arch/h8300/include/uapi/asm/mman.h | 4 ++
> tools/arch/hexagon/include/uapi/asm/mman.h | 4 ++
> tools/arch/ia64/include/uapi/asm/mman.h | 4 ++
> tools/arch/m32r/include/uapi/asm/mman.h | 4 ++
> tools/arch/microblaze/include/uapi/asm/mman.h | 4 ++
> tools/arch/mips/include/uapi/asm/mman.h | 39 ++++++++++++++
> tools/arch/mn10300/include/uapi/asm/mman.h | 4 ++
> tools/arch/parisc/include/uapi/asm/mman.h | 38 ++++++++++++++
> tools/arch/powerpc/include/uapi/asm/mman.h | 13 +++++
> tools/arch/s390/include/uapi/asm/mman.h | 4 ++
> tools/arch/score/include/uapi/asm/mman.h | 4 ++
> tools/arch/sh/include/uapi/asm/mman.h | 4 ++
> tools/arch/sparc/include/uapi/asm/mman.h | 13 +++++
> tools/arch/tile/include/uapi/asm/mman.h | 13 +++++
> tools/arch/x86/include/uapi/asm/mman.h | 5 ++
> tools/arch/xtensa/include/uapi/asm/mman.h | 38 ++++++++++++++
> tools/include/uapi/asm-generic/mman-common.h | 75 +++++++++++++++++++++++++++
> tools/include/uapi/asm-generic/mman.h | 22 ++++++++
> tools/include/uapi/linux/mman.h | 13 +++++
> 23 files changed, 355 insertions(+)
> create mode 100644 tools/arch/alpha/include/uapi/asm/mman.h
> create mode 100644 tools/arch/arm/include/uapi/asm/mman.h
> create mode 100644 tools/arch/arm64/include/uapi/asm/mman.h
> create mode 100644 tools/arch/frv/include/uapi/asm/mman.h
> create mode 100644 tools/arch/h8300/include/uapi/asm/mman.h
> create mode 100644 tools/arch/hexagon/include/uapi/asm/mman.h
> create mode 100644 tools/arch/ia64/include/uapi/asm/mman.h
> create mode 100644 tools/arch/m32r/include/uapi/asm/mman.h
> create mode 100644 tools/arch/microblaze/include/uapi/asm/mman.h
> create mode 100644 tools/arch/mips/include/uapi/asm/mman.h
> create mode 100644 tools/arch/mn10300/include/uapi/asm/mman.h
> create mode 100644 tools/arch/parisc/include/uapi/asm/mman.h
> create mode 100644 tools/arch/powerpc/include/uapi/asm/mman.h
> create mode 100644 tools/arch/s390/include/uapi/asm/mman.h
> create mode 100644 tools/arch/score/include/uapi/asm/mman.h
> create mode 100644 tools/arch/sh/include/uapi/asm/mman.h
> create mode 100644 tools/arch/sparc/include/uapi/asm/mman.h
> create mode 100644 tools/arch/tile/include/uapi/asm/mman.h
> create mode 100644 tools/arch/x86/include/uapi/asm/mman.h
> create mode 100644 tools/arch/xtensa/include/uapi/asm/mman.h
> create mode 100644 tools/include/uapi/asm-generic/mman-common.h
> create mode 100644 tools/include/uapi/asm-generic/mman.h
> create mode 100644 tools/include/uapi/linux/mman.h
>
> diff --git a/tools/arch/alpha/include/uapi/asm/mman.h b/tools/arch/alpha/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..6ed4ad4
> --- /dev/null
> +++ b/tools/arch/alpha/include/uapi/asm/mman.h
> @@ -0,0 +1,38 @@
> +#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> +#define MADV_DODUMP 17
> +#define MADV_DOFORK 11
> +#define MADV_DONTDUMP 16
> +#define MADV_DONTFORK 10
> +#define MADV_DONTNEED 6
> +#define MADV_HUGEPAGE 14
> +#define MADV_MERGEABLE 12
> +#define MADV_NOHUGEPAGE 15
> +#define MADV_NORMAL 0
> +#define MADV_RANDOM 1
> +#define MADV_REMOVE 9
> +#define MADV_SEQUENTIAL 2
> +#define MADV_UNMERGEABLE 13
> +#define MADV_WILLNEED 3
> +#define MAP_ANONYMOUS 0x10
> +#define MAP_DENYWRITE 0x02000
> +#define MAP_EXECUTABLE 0x04000
> +#define MAP_FILE 0
> +#define MAP_FIXED 0x100
> +#define MAP_GROWSDOWN 0x01000
> +#define MAP_HUGETLB 0x100000
> +#define MAP_LOCKED 0x08000
> +#define MAP_NONBLOCK 0x40000
> +#define MAP_NORESERVE 0x10000
> +#define MAP_POPULATE 0x20000
> +#define MAP_PRIVATE 0x02
> +#define MAP_SHARED 0x01
> +#define MAP_STACK 0x80000
> +#define PROT_EXEC 0x4
> +#define PROT_GROWSDOWN 0x01000000
> +#define PROT_GROWSUP 0x02000000
> +#define PROT_NONE 0x0
> +#define PROT_READ 0x1
> +#define PROT_SEM 0x8
> +#define PROT_WRITE 0x2
> +#endif
> diff --git a/tools/arch/arm/include/uapi/asm/mman.h b/tools/arch/arm/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..0e2562b
> --- /dev/null
> +++ b/tools/arch/arm/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/arm64/include/uapi/asm/mman.h b/tools/arch/arm64/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..be5d271
> --- /dev/null
> +++ b/tools/arch/arm64/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/frv/include/uapi/asm/mman.h b/tools/arch/frv/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..d25ec8c
> --- /dev/null
> +++ b/tools/arch/frv/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/h8300/include/uapi/asm/mman.h b/tools/arch/h8300/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..fc7bbad
> --- /dev/null
> +++ b/tools/arch/h8300/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/hexagon/include/uapi/asm/mman.h b/tools/arch/hexagon/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..2b29088
> --- /dev/null
> +++ b/tools/arch/hexagon/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/ia64/include/uapi/asm/mman.h b/tools/arch/ia64/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..0353e96
> --- /dev/null
> +++ b/tools/arch/ia64/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/m32r/include/uapi/asm/mman.h b/tools/arch/m32r/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..fc39337
> --- /dev/null
> +++ b/tools/arch/m32r/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/microblaze/include/uapi/asm/mman.h b/tools/arch/microblaze/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..0a0267d
> --- /dev/null
> +++ b/tools/arch/microblaze/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/mips/include/uapi/asm/mman.h b/tools/arch/mips/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..db88fa4
> --- /dev/null
> +++ b/tools/arch/mips/include/uapi/asm/mman.h
> @@ -0,0 +1,39 @@
> +#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> +#define MADV_DODUMP 17
> +#define MADV_DOFORK 11
> +#define MADV_DONTDUMP 16
> +#define MADV_DONTFORK 10
> +#define MADV_DONTNEED 4
> +#define MADV_HUGEPAGE 14
> +#define MADV_HWPOISON 100
> +#define MADV_MERGEABLE 12
> +#define MADV_NOHUGEPAGE 15
> +#define MADV_NORMAL 0
> +#define MADV_RANDOM 1
> +#define MADV_REMOVE 9
> +#define MADV_SEQUENTIAL 2
> +#define MADV_UNMERGEABLE 13
> +#define MADV_WILLNEED 3
> +#define MAP_ANONYMOUS 0x0800
> +#define MAP_DENYWRITE 0x2000
> +#define MAP_EXECUTABLE 0x4000
> +#define MAP_FILE 0
> +#define MAP_FIXED 0x010
> +#define MAP_GROWSDOWN 0x1000
> +#define MAP_HUGETLB 0x80000
> +#define MAP_LOCKED 0x8000
> +#define MAP_NONBLOCK 0x20000
> +#define MAP_NORESERVE 0x0400
> +#define MAP_POPULATE 0x10000
> +#define MAP_PRIVATE 0x002
> +#define MAP_SHARED 0x001
> +#define MAP_STACK 0x40000
> +#define PROT_EXEC 0x04
> +#define PROT_GROWSDOWN 0x01000000
> +#define PROT_GROWSUP 0x02000000
> +#define PROT_NONE 0x00
> +#define PROT_READ 0x01
> +#define PROT_SEM 0x10
> +#define PROT_WRITE 0x02
> +#endif
> diff --git a/tools/arch/mn10300/include/uapi/asm/mman.h b/tools/arch/mn10300/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..dfa95a0
> --- /dev/null
> +++ b/tools/arch/mn10300/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..c4a9d9f
> --- /dev/null
> +++ b/tools/arch/parisc/include/uapi/asm/mman.h
> @@ -0,0 +1,38 @@
> +#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> +#define MADV_DODUMP 70
> +#define MADV_DOFORK 11
> +#define MADV_DONTDUMP 69
> +#define MADV_DONTFORK 10
> +#define MADV_DONTNEED 4
> +#define MADV_HUGEPAGE 67
> +#define MADV_MERGEABLE 65
> +#define MADV_NOHUGEPAGE 68
> +#define MADV_NORMAL 0
> +#define MADV_RANDOM 1
> +#define MADV_REMOVE 9
> +#define MADV_SEQUENTIAL 2
> +#define MADV_UNMERGEABLE 66
> +#define MADV_WILLNEED 3
> +#define MAP_ANONYMOUS 0x10
> +#define MAP_DENYWRITE 0x0800
> +#define MAP_EXECUTABLE 0x1000
> +#define MAP_FILE 0
> +#define MAP_FIXED 0x04
> +#define MAP_GROWSDOWN 0x8000
> +#define MAP_HUGETLB 0x80000
> +#define MAP_LOCKED 0x2000
> +#define MAP_NONBLOCK 0x20000
> +#define MAP_NORESERVE 0x4000
> +#define MAP_POPULATE 0x10000
> +#define MAP_PRIVATE 0x02
> +#define MAP_SHARED 0x01
> +#define MAP_STACK 0x40000
> +#define PROT_EXEC 0x4
> +#define PROT_GROWSDOWN 0x01000000
> +#define PROT_GROWSUP 0x02000000
> +#define PROT_NONE 0x0
> +#define PROT_READ 0x1
> +#define PROT_SEM 0x8
> +#define PROT_WRITE 0x2
> +#endif
> diff --git a/tools/arch/powerpc/include/uapi/asm/mman.h b/tools/arch/powerpc/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..5afb126
> --- /dev/null
> +++ b/tools/arch/powerpc/include/uapi/asm/mman.h
> @@ -0,0 +1,13 @@
> +#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> +#define MAP_DENYWRITE 0x0800
> +#define MAP_EXECUTABLE 0x1000
> +#define MAP_GROWSDOWN 0x0100
> +#define MAP_HUGETLB 0x40000
> +#define MAP_LOCKED 0x80
> +#define MAP_NONBLOCK 0x10000
> +#define MAP_NORESERVE 0x40
> +#define MAP_POPULATE 0x8000
> +#define MAP_STACK 0x20000
> +#include <asm-generic/mman-common.h>
> +#endif
> diff --git a/tools/arch/s390/include/uapi/asm/mman.h b/tools/arch/s390/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..d4dc8a6
> --- /dev/null
> +++ b/tools/arch/s390/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/score/include/uapi/asm/mman.h b/tools/arch/score/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..f9b63b8
> --- /dev/null
> +++ b/tools/arch/score/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/sh/include/uapi/asm/mman.h b/tools/arch/sh/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..ea46f1b
> --- /dev/null
> +++ b/tools/arch/sh/include/uapi/asm/mman.h
> @@ -0,0 +1,4 @@
> +#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/sparc/include/uapi/asm/mman.h b/tools/arch/sparc/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..2374ec9
> --- /dev/null
> +++ b/tools/arch/sparc/include/uapi/asm/mman.h
> @@ -0,0 +1,13 @@
> +#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> +#define MAP_DENYWRITE 0x0800
> +#define MAP_EXECUTABLE 0x1000
> +#define MAP_GROWSDOWN 0x0200
> +#define MAP_HUGETLB 0x40000
> +#define MAP_LOCKED 0x100
> +#define MAP_NONBLOCK 0x10000
> +#define MAP_NORESERVE 0x40
> +#define MAP_POPULATE 0x8000
> +#define MAP_STACK 0x20000
> +#include <asm-generic/mman-common.h>
> +#endif
> diff --git a/tools/arch/tile/include/uapi/asm/mman.h b/tools/arch/tile/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..6e64564
> --- /dev/null
> +++ b/tools/arch/tile/include/uapi/asm/mman.h
> @@ -0,0 +1,13 @@
> +#ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> +#define MAP_DENYWRITE 0x0800
> +#define MAP_EXECUTABLE 0x1000
> +#define MAP_GROWSDOWN 0x0100
> +#define MAP_HUGETLB 0x4000
> +#define MAP_LOCKED 0x0200
> +#define MAP_NONBLOCK 0x0080
> +#define MAP_NORESERVE 0x0400
> +#define MAP_POPULATE 0x0040
> +#define MAP_STACK MAP_GROWSDOWN
> +#include <asm-generic/mman-common.h>
> +#endif
> diff --git a/tools/arch/x86/include/uapi/asm/mman.h b/tools/arch/x86/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..62176803
> --- /dev/null
> +++ b/tools/arch/x86/include/uapi/asm/mman.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> +#define MAP_32BIT 0x40
> +#include <asm-generic/mman.h>
> +#endif
> diff --git a/tools/arch/xtensa/include/uapi/asm/mman.h b/tools/arch/xtensa/include/uapi/asm/mman.h
> new file mode 100644
> index 0000000..1c89538
> --- /dev/null
> +++ b/tools/arch/xtensa/include/uapi/asm/mman.h
> @@ -0,0 +1,38 @@
> +#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> +#define MADV_DODUMP 17
> +#define MADV_DOFORK 11
> +#define MADV_DONTDUMP 16
> +#define MADV_DONTFORK 10
> +#define MADV_DONTNEED 4
> +#define MADV_HUGEPAGE 14
> +#define MADV_MERGEABLE 12
> +#define MADV_NOHUGEPAGE 15
> +#define MADV_NORMAL 0
> +#define MADV_RANDOM 1
> +#define MADV_REMOVE 9
> +#define MADV_SEQUENTIAL 2
> +#define MADV_UNMERGEABLE 13
> +#define MADV_WILLNEED 3
> +#define MAP_ANONYMOUS 0x0800
> +#define MAP_DENYWRITE 0x2000
> +#define MAP_EXECUTABLE 0x4000
> +#define MAP_FILE 0
> +#define MAP_FIXED 0x010
> +#define MAP_GROWSDOWN 0x1000
> +#define MAP_HUGETLB 0x80000
> +#define MAP_LOCKED 0x8000
> +#define MAP_NONBLOCK 0x20000
> +#define MAP_NORESERVE 0x0400
> +#define MAP_POPULATE 0x10000
> +#define MAP_PRIVATE 0x002
> +#define MAP_SHARED 0x001
> +#define MAP_STACK 0x40000
> +#define PROT_EXEC 0x4
> +#define PROT_GROWSDOWN 0x01000000
> +#define PROT_GROWSUP 0x02000000
> +#define PROT_NONE 0x0
> +#define PROT_READ 0x1
> +#define PROT_SEM 0x10
> +#define PROT_WRITE 0x2
> +#endif
> diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
> new file mode 100644
> index 0000000..5827438
> --- /dev/null
> +++ b/tools/include/uapi/asm-generic/mman-common.h
> @@ -0,0 +1,75 @@
> +#ifndef __ASM_GENERIC_MMAN_COMMON_H
> +#define __ASM_GENERIC_MMAN_COMMON_H
> +
> +/*
> + Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
> + Based on: asm-xxx/mman.h
> +*/
> +
> +#define PROT_READ 0x1 /* page can be read */
> +#define PROT_WRITE 0x2 /* page can be written */
> +#define PROT_EXEC 0x4 /* page can be executed */
> +#define PROT_SEM 0x8 /* page may be used for atomic ops */
> +#define PROT_NONE 0x0 /* page can not be accessed */
> +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
> +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
> +
> +#define MAP_SHARED 0x01 /* Share changes */
> +#define MAP_PRIVATE 0x02 /* Changes are private */
> +#define MAP_TYPE 0x0f /* Mask for type of mapping */
> +#define MAP_FIXED 0x10 /* Interpret addr exactly */
> +#define MAP_ANONYMOUS 0x20 /* don't use a file */
> +#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
> +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */
> +#else
> +# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
> +#endif
> +
> +/*
> + * Flags for mlock
> + */
> +#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
> +
> +#define MS_ASYNC 1 /* sync memory asynchronously */
> +#define MS_INVALIDATE 2 /* invalidate the caches */
> +#define MS_SYNC 4 /* synchronous memory sync */
> +
> +#define MADV_NORMAL 0 /* no further special treatment */
> +#define MADV_RANDOM 1 /* expect random page references */
> +#define MADV_SEQUENTIAL 2 /* expect sequential page references */
> +#define MADV_WILLNEED 3 /* will need these pages */
> +#define MADV_DONTNEED 4 /* don't need these pages */
> +
> +/* common parameters: try to keep these consistent across architectures */
> +#define MADV_FREE 8 /* free pages only if memory pressure */
> +#define MADV_REMOVE 9 /* remove these pages & resources */
> +#define MADV_DONTFORK 10 /* don't inherit across fork */
> +#define MADV_DOFORK 11 /* do inherit across fork */
> +#define MADV_HWPOISON 100 /* poison a page for testing */
> +#define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */
> +
> +#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
> +#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
> +
> +#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
> +#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
> +
> +#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
> + overrides the coredump filter bits */
> +#define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */
> +
> +/* compatibility flags */
> +#define MAP_FILE 0
> +
> +/*
> + * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
> + * This gives us 6 bits, which is enough until someone invents 128 bit address
> + * spaces.
> + *
> + * Assume these are all power of twos.
> + * When 0 use the default page size.
> + */
> +#define MAP_HUGE_SHIFT 26
> +#define MAP_HUGE_MASK 0x3f
> +
> +#endif /* __ASM_GENERIC_MMAN_COMMON_H */
> diff --git a/tools/include/uapi/asm-generic/mman.h b/tools/include/uapi/asm-generic/mman.h
> new file mode 100644
> index 0000000..7162cd4
> --- /dev/null
> +++ b/tools/include/uapi/asm-generic/mman.h
> @@ -0,0 +1,22 @@
> +#ifndef __ASM_GENERIC_MMAN_H
> +#define __ASM_GENERIC_MMAN_H
> +
> +#include <asm-generic/mman-common.h>
> +
> +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
> +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
> +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
> +#define MAP_LOCKED 0x2000 /* pages are locked */
> +#define MAP_NORESERVE 0x4000 /* don't check for reservations */
> +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
> +#define MAP_NONBLOCK 0x10000 /* do not block on IO */
> +#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
> +#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
> +
> +/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
> +
> +#define MCL_CURRENT 1 /* lock all current mappings */
> +#define MCL_FUTURE 2 /* lock all future mappings */
> +#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
> +
> +#endif /* __ASM_GENERIC_MMAN_H */
> diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
> new file mode 100644
> index 0000000..ade4acd
> --- /dev/null
> +++ b/tools/include/uapi/linux/mman.h
> @@ -0,0 +1,13 @@
> +#ifndef _UAPI_LINUX_MMAN_H
> +#define _UAPI_LINUX_MMAN_H
> +
> +#include <asm/mman.h>
> +
> +#define MREMAP_MAYMOVE 1
> +#define MREMAP_FIXED 2
> +
> +#define OVERCOMMIT_GUESS 0
> +#define OVERCOMMIT_ALWAYS 1
> +#define OVERCOMMIT_NEVER 2
> +
> +#endif /* _UAPI_LINUX_MMAN_H */
> --
> 1.8.3.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-12 19:07 ` Arnaldo Carvalho de Melo
@ 2016-09-12 21:15 ` Arnaldo Carvalho de Melo
2016-09-13 6:36 ` Wangnan (F)
2016-09-14 9:28 ` Naveen N. Rao
0 siblings, 2 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-12 21:15 UTC (permalink / raw)
To: Wang Nan; +Cc: linux-kernel, lizefan, pi3orama
Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
> > Some mmap related macros have different values for different
> > architectures. This patch introduces uapi mman.h for each
> > architectures.
> >
> > Three headers are cloned from kernel include to tools/include:
> >
> > tools/include/uapi/asm-generic/mman-common.h
> > tools/include/uapi/asm-generic/mman.h
> > tools/include/uapi/linux/mman.h
>
> Cool, the above was done as copies, why not the rest? IIRC you mentioned
> some reasoning behind that decision, but we need it spelled out here.
>
> For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
> and couldn't find why we shouldn't copy it just like the three files
> above.
>
> I'm looking now at why the build breaks in so many systems, first hunch
> is that bits/ part (the ones without the failure details probably have
> the same errors), alpine uses musl libc, but some that broke are glibc
> based.
So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
but took a different path for 2/3, now it builds for all systems I have
containers for:
# time dm
1 67.700 alpine:3.4: Ok
2 23.565 android-ndk:r12b-arm: Ok
3 67.823 archlinux:latest: Ok
4 37.277 centos:5: Ok
5 57.621 centos:6: Ok
6 68.348 centos:7: Ok
7 61.971 debian:7: Ok
8 65.711 debian:8: Ok
9 36.894 debian:experimental: Ok
10 66.274 fedora:20: Ok
11 70.054 fedora:21: Ok
12 68.310 fedora:22: Ok
13 68.033 fedora:23: Ok
14 72.322 fedora:24: Ok
15 29.529 fedora:24-x-ARC-uClibc: Ok
16 77.458 fedora:rawhide: Ok
17 80.110 mageia:5: Ok
18 72.664 opensuse:13.2: Ok
19 70.878 opensuse:42.1: Ok
20 80.322 opensuse:tumbleweed: Ok
21 62.237 ubuntu:12.04.5: Ok
22 39.998 ubuntu:14.04: Ok
23 69.383 ubuntu:14.04.4: Ok
24 76.120 ubuntu:15.10: Ok
25 69.668 ubuntu:16.04: Ok
26 69.061 ubuntu:16.04-x-arm: Ok
27 73.337 ubuntu:16.04-x-arm64: Ok
28 77.061 ubuntu:16.04-x-powerpc64: Ok
29 55.340 ubuntu:16.04-x-powerpc64el: Ok
30 85.579 ubuntu:16.10: Ok
31 59.645 ubuntu:16.10-x-s390: Ok
real 32m59.385s
user 0m1.856s
sys 0m2.077s
#
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-12 21:15 ` Arnaldo Carvalho de Melo
@ 2016-09-13 6:36 ` Wangnan (F)
2016-09-14 9:28 ` Naveen N. Rao
1 sibling, 0 replies; 19+ messages in thread
From: Wangnan (F) @ 2016-09-13 6:36 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, lizefan, pi3orama
On 2016/9/13 5:15, Arnaldo Carvalho de Melo wrote:
> Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
>>> Some mmap related macros have different values for different
>>> architectures. This patch introduces uapi mman.h for each
>>> architectures.
>>>
>>> Three headers are cloned from kernel include to tools/include:
>>>
>>> tools/include/uapi/asm-generic/mman-common.h
>>> tools/include/uapi/asm-generic/mman.h
>>> tools/include/uapi/linux/mman.h
>> Cool, the above was done as copies, why not the rest? IIRC you mentioned
>> some reasoning behind that decision, but we need it spelled out here.
>>
>> For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
>> and couldn't find why we shouldn't copy it just like the three files
>> above.
>>
>> I'm looking now at why the build breaks in so many systems, first hunch
>> is that bits/ part (the ones without the failure details probably have
>> the same errors), alpine uses musl libc, but some that broke are glibc
>> based.
> So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
> but took a different path for 2/3, now it builds for all systems I have
> containers for:
Clever! The key is to use mman.h in uapi instead of <sys/mman.h>.
Code require these macros is coincidentally needn't the definition
of functions like mmap, munmap and mprotect. Your solution is
better.
Thank you.
> # time dm
> 1 67.700 alpine:3.4: Ok
> 2 23.565 android-ndk:r12b-arm: Ok
> 3 67.823 archlinux:latest: Ok
> 4 37.277 centos:5: Ok
> 5 57.621 centos:6: Ok
> 6 68.348 centos:7: Ok
> 7 61.971 debian:7: Ok
> 8 65.711 debian:8: Ok
> 9 36.894 debian:experimental: Ok
> 10 66.274 fedora:20: Ok
> 11 70.054 fedora:21: Ok
> 12 68.310 fedora:22: Ok
> 13 68.033 fedora:23: Ok
> 14 72.322 fedora:24: Ok
> 15 29.529 fedora:24-x-ARC-uClibc: Ok
> 16 77.458 fedora:rawhide: Ok
> 17 80.110 mageia:5: Ok
> 18 72.664 opensuse:13.2: Ok
> 19 70.878 opensuse:42.1: Ok
> 20 80.322 opensuse:tumbleweed: Ok
> 21 62.237 ubuntu:12.04.5: Ok
> 22 39.998 ubuntu:14.04: Ok
> 23 69.383 ubuntu:14.04.4: Ok
> 24 76.120 ubuntu:15.10: Ok
> 25 69.668 ubuntu:16.04: Ok
> 26 69.061 ubuntu:16.04-x-arm: Ok
> 27 73.337 ubuntu:16.04-x-arm64: Ok
> 28 77.061 ubuntu:16.04-x-powerpc64: Ok
> 29 55.340 ubuntu:16.04-x-powerpc64el: Ok
> 30 85.579 ubuntu:16.10: Ok
> 31 59.645 ubuntu:16.10-x-s390: Ok
>
> real 32m59.385s
> user 0m1.856s
> sys 0m2.077s
> #
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-12 21:15 ` Arnaldo Carvalho de Melo
2016-09-13 6:36 ` Wangnan (F)
@ 2016-09-14 9:28 ` Naveen N. Rao
2016-09-14 9:36 ` Wangnan (F)
2016-09-14 13:52 ` Arnaldo Carvalho de Melo
1 sibling, 2 replies; 19+ messages in thread
From: Naveen N. Rao @ 2016-09-14 9:28 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Wang Nan, linux-kernel, lizefan, pi3orama
On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
> > > Some mmap related macros have different values for different
> > > architectures. This patch introduces uapi mman.h for each
> > > architectures.
> > >
> > > Three headers are cloned from kernel include to tools/include:
> > >
> > > tools/include/uapi/asm-generic/mman-common.h
> > > tools/include/uapi/asm-generic/mman.h
> > > tools/include/uapi/linux/mman.h
> >
> > Cool, the above was done as copies, why not the rest? IIRC you mentioned
> > some reasoning behind that decision, but we need it spelled out here.
> >
> > For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
> > and couldn't find why we shouldn't copy it just like the three files
> > above.
> >
> > I'm looking now at why the build breaks in so many systems, first hunch
> > is that bits/ part (the ones without the failure details probably have
> > the same errors), alpine uses musl libc, but some that broke are glibc
> > based.
>
> So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
> but took a different path for 2/3, now it builds for all systems I have
> containers for:
This still fails for me on ppc64. Perhaps we should guard
P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
conditional defines")?
- Naveen
---
In file included from builtin-trace.c:560:0:
trace/beauty/mmap.c: In function ‘syscall_arg__scnprintf_mmap_flags’:
trace/beauty/mmap.c:38:14: error: ‘MAP_32BIT’ undeclared (first use in this function)
if (flags & MAP_##n) { \
^
trace/beauty/mmap.c:45:2: note: in expansion of macro ‘P_MMAP_FLAG’
P_MMAP_FLAG(32BIT);
^
trace/beauty/mmap.c:38:14: note: each undeclared identifier is reported only once for each function it appears in
if (flags & MAP_##n) { \
^
trace/beauty/mmap.c:45:2: note: in expansion of macro ‘P_MMAP_FLAG’
P_MMAP_FLAG(32BIT);
^
CC bench/mem-functions.o
mv: cannot stat ‘./.builtin-trace.o.tmp’: No such file or directory
make[2]: *** [builtin-trace.o] Error 1
make[2]: *** Waiting for unfinished jobs....
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 9:28 ` Naveen N. Rao
@ 2016-09-14 9:36 ` Wangnan (F)
2016-09-14 10:00 ` Naveen N. Rao
2016-09-14 13:52 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 19+ messages in thread
From: Wangnan (F) @ 2016-09-14 9:36 UTC (permalink / raw)
To: Naveen N. Rao, Arnaldo Carvalho de Melo; +Cc: linux-kernel, lizefan, pi3orama
On 2016/9/14 17:28, Naveen N. Rao wrote:
> On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
>> Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
>>> Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
>>>> Some mmap related macros have different values for different
>>>> architectures. This patch introduces uapi mman.h for each
>>>> architectures.
>>>>
>>>> Three headers are cloned from kernel include to tools/include:
>>>>
>>>> tools/include/uapi/asm-generic/mman-common.h
>>>> tools/include/uapi/asm-generic/mman.h
>>>> tools/include/uapi/linux/mman.h
>>> Cool, the above was done as copies, why not the rest? IIRC you mentioned
>>> some reasoning behind that decision, but we need it spelled out here.
>>>
>>> For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
>>> and couldn't find why we shouldn't copy it just like the three files
>>> above.
>>>
>>> I'm looking now at why the build breaks in so many systems, first hunch
>>> is that bits/ part (the ones without the failure details probably have
>>> the same errors), alpine uses musl libc, but some that broke are glibc
>>> based.
>> So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
>> but took a different path for 2/3, now it builds for all systems I have
>> containers for:
> This still fails for me on ppc64. Perhaps we should guard
> P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
> earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
> conditional defines")?
Perhaps we should set all non-exist flag to 0 in each uapi mman.h?
Thank you.
> - Naveen
>
> ---
> In file included from builtin-trace.c:560:0:
> trace/beauty/mmap.c: In function ‘syscall_arg__scnprintf_mmap_flags’:
> trace/beauty/mmap.c:38:14: error: ‘MAP_32BIT’ undeclared (first use in this function)
> if (flags & MAP_##n) { \
> ^
> trace/beauty/mmap.c:45:2: note: in expansion of macro ‘P_MMAP_FLAG’
> P_MMAP_FLAG(32BIT);
> ^
> trace/beauty/mmap.c:38:14: note: each undeclared identifier is reported only once for each function it appears in
> if (flags & MAP_##n) { \
> ^
> trace/beauty/mmap.c:45:2: note: in expansion of macro ‘P_MMAP_FLAG’
> P_MMAP_FLAG(32BIT);
> ^
> CC bench/mem-functions.o
> mv: cannot stat ‘./.builtin-trace.o.tmp’: No such file or directory
> make[2]: *** [builtin-trace.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 9:36 ` Wangnan (F)
@ 2016-09-14 10:00 ` Naveen N. Rao
2016-09-14 10:23 ` Wangnan (F)
0 siblings, 1 reply; 19+ messages in thread
From: Naveen N. Rao @ 2016-09-14 10:00 UTC (permalink / raw)
To: Wangnan (F); +Cc: Arnaldo Carvalho de Melo, linux-kernel, lizefan, pi3orama
On 2016/09/14 05:36PM, Wang Nan wrote:
>
>
> On 2016/9/14 17:28, Naveen N. Rao wrote:
> > On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
> > > > > Some mmap related macros have different values for different
> > > > > architectures. This patch introduces uapi mman.h for each
> > > > > architectures.
> > > > >
> > > > > Three headers are cloned from kernel include to tools/include:
> > > > >
> > > > > tools/include/uapi/asm-generic/mman-common.h
> > > > > tools/include/uapi/asm-generic/mman.h
> > > > > tools/include/uapi/linux/mman.h
> > > > Cool, the above was done as copies, why not the rest? IIRC you mentioned
> > > > some reasoning behind that decision, but we need it spelled out here.
> > > >
> > > > For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
> > > > and couldn't find why we shouldn't copy it just like the three files
> > > > above.
> > > >
> > > > I'm looking now at why the build breaks in so many systems, first hunch
> > > > is that bits/ part (the ones without the failure details probably have
> > > > the same errors), alpine uses musl libc, but some that broke are glibc
> > > > based.
> > > So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
> > > but took a different path for 2/3, now it builds for all systems I have
> > > containers for:
> > This still fails for me on ppc64. Perhaps we should guard
> > P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
> > earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
> > conditional defines")?
>
> Perhaps we should set all non-exist flag to 0 in each uapi mman.h?
Will that work for MADV_* since the macro there is for a case statement?
- Naveen
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 10:00 ` Naveen N. Rao
@ 2016-09-14 10:23 ` Wangnan (F)
2016-09-14 10:46 ` Naveen N. Rao
0 siblings, 1 reply; 19+ messages in thread
From: Wangnan (F) @ 2016-09-14 10:23 UTC (permalink / raw)
To: Naveen N. Rao; +Cc: Arnaldo Carvalho de Melo, linux-kernel, lizefan, pi3orama
On 2016/9/14 18:00, Naveen N. Rao wrote:
> On 2016/09/14 05:36PM, Wang Nan wrote:
>>
>> On 2016/9/14 17:28, Naveen N. Rao wrote:
>>> On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
>>>> Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
>>>>> Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
>>>>>> Some mmap related macros have different values for different
>>>>>> architectures. This patch introduces uapi mman.h for each
>>>>>> architectures.
>>>>>>
>>>>>> Three headers are cloned from kernel include to tools/include:
>>>>>>
>>>>>> tools/include/uapi/asm-generic/mman-common.h
>>>>>> tools/include/uapi/asm-generic/mman.h
>>>>>> tools/include/uapi/linux/mman.h
>>>>> Cool, the above was done as copies, why not the rest? IIRC you mentioned
>>>>> some reasoning behind that decision, but we need it spelled out here.
>>>>>
>>>>> For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
>>>>> and couldn't find why we shouldn't copy it just like the three files
>>>>> above.
>>>>>
>>>>> I'm looking now at why the build breaks in so many systems, first hunch
>>>>> is that bits/ part (the ones without the failure details probably have
>>>>> the same errors), alpine uses musl libc, but some that broke are glibc
>>>>> based.
>>>> So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
>>>> but took a different path for 2/3, now it builds for all systems I have
>>>> containers for:
>>> This still fails for me on ppc64. Perhaps we should guard
>>> P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
>>> earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
>>> conditional defines")?
>> Perhaps we should set all non-exist flag to 0 in each uapi mman.h?
> Will that work for MADV_* since the macro there is for a case statement?
Then fall back to include/uapi/asm-generic/mman-common.h. And I
realized the missing of MADV_FEEE in tools/perf/trace/beauty/mmap.c.
Is that intentionally?
Thank you.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 10:23 ` Wangnan (F)
@ 2016-09-14 10:46 ` Naveen N. Rao
2016-09-14 10:49 ` Wangnan (F)
0 siblings, 1 reply; 19+ messages in thread
From: Naveen N. Rao @ 2016-09-14 10:46 UTC (permalink / raw)
To: Wangnan (F); +Cc: Arnaldo Carvalho de Melo, linux-kernel, lizefan, pi3orama
On 2016/09/14 06:23PM, Wang Nan wrote:
>
>
> On 2016/9/14 18:00, Naveen N. Rao wrote:
> > On 2016/09/14 05:36PM, Wang Nan wrote:
> > >
> > > On 2016/9/14 17:28, Naveen N. Rao wrote:
> > > > On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
> > > > > Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > > > Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
> > > > > > > Some mmap related macros have different values for different
> > > > > > > architectures. This patch introduces uapi mman.h for each
> > > > > > > architectures.
> > > > > > >
> > > > > > > Three headers are cloned from kernel include to tools/include:
> > > > > > >
> > > > > > > tools/include/uapi/asm-generic/mman-common.h
> > > > > > > tools/include/uapi/asm-generic/mman.h
> > > > > > > tools/include/uapi/linux/mman.h
> > > > > > Cool, the above was done as copies, why not the rest? IIRC you mentioned
> > > > > > some reasoning behind that decision, but we need it spelled out here.
> > > > > >
> > > > > > For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
> > > > > > and couldn't find why we shouldn't copy it just like the three files
> > > > > > above.
> > > > > >
> > > > > > I'm looking now at why the build breaks in so many systems, first hunch
> > > > > > is that bits/ part (the ones without the failure details probably have
> > > > > > the same errors), alpine uses musl libc, but some that broke are glibc
> > > > > > based.
> > > > > So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
> > > > > but took a different path for 2/3, now it builds for all systems I have
> > > > > containers for:
> > > > This still fails for me on ppc64. Perhaps we should guard
> > > > P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
> > > > earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
> > > > conditional defines")?
> > > Perhaps we should set all non-exist flag to 0 in each uapi mman.h?
> > Will that work for MADV_* since the macro there is for a case statement?
>
> Then fall back to include/uapi/asm-generic/mman-common.h. And I
mman-common.h is already included on powerpc:
# cat tools/arch/powerpc/include/uapi/asm/mman.h
#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_GROWSDOWN 0x0100
#define MAP_HUGETLB 0x40000
#define MAP_LOCKED 0x80
#define MAP_NONBLOCK 0x10000
#define MAP_NORESERVE 0x40
#define MAP_POPULATE 0x8000
#define MAP_STACK 0x20000
#include <uapi/asm-generic/mman-common.h>
#endif
> realized the missing of MADV_FEEE in tools/perf/trace/beauty/mmap.c.
> Is that intentionally?
Not sure, Arnaldo should know.
Thanks,
Naveen
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 10:46 ` Naveen N. Rao
@ 2016-09-14 10:49 ` Wangnan (F)
0 siblings, 0 replies; 19+ messages in thread
From: Wangnan (F) @ 2016-09-14 10:49 UTC (permalink / raw)
To: Naveen N. Rao; +Cc: Arnaldo Carvalho de Melo, linux-kernel, lizefan, pi3orama
On 2016/9/14 18:46, Naveen N. Rao wrote:
> On 2016/09/14 06:23PM, Wang Nan wrote:
>>
>> On 2016/9/14 18:00, Naveen N. Rao wrote:
>>> On 2016/09/14 05:36PM, Wang Nan wrote:
>>>> On 2016/9/14 17:28, Naveen N. Rao wrote:
>>>>> On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
>>>>>> Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
>>>>>>> Em Mon, Sep 12, 2016 at 12:54:29PM +0000, Wang Nan escreveu:
>>>>>>>> Some mmap related macros have different values for different
>>>>>>>> architectures. This patch introduces uapi mman.h for each
>>>>>>>> architectures.
>>>>>>>>
>>>>>>>> Three headers are cloned from kernel include to tools/include:
>>>>>>>>
>>>>>>>> tools/include/uapi/asm-generic/mman-common.h
>>>>>>>> tools/include/uapi/asm-generic/mman.h
>>>>>>>> tools/include/uapi/linux/mman.h
>>>>>>> Cool, the above was done as copies, why not the rest? IIRC you mentioned
>>>>>>> some reasoning behind that decision, but we need it spelled out here.
>>>>>>>
>>>>>>> For instance, I went on and look at arch/xtensa/include/uapi/asm/mman.h,
>>>>>>> and couldn't find why we shouldn't copy it just like the three files
>>>>>>> above.
>>>>>>>
>>>>>>> I'm looking now at why the build breaks in so many systems, first hunch
>>>>>>> is that bits/ part (the ones without the failure details probably have
>>>>>>> the same errors), alpine uses musl libc, but some that broke are glibc
>>>>>>> based.
>>>>>> So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
>>>>>> but took a different path for 2/3, now it builds for all systems I have
>>>>>> containers for:
>>>>> This still fails for me on ppc64. Perhaps we should guard
>>>>> P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
>>>>> earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
>>>>> conditional defines")?
>>>> Perhaps we should set all non-exist flag to 0 in each uapi mman.h?
>>> Will that work for MADV_* since the macro there is for a case statement?
>> Then fall back to include/uapi/asm-generic/mman-common.h. And I
> mman-common.h is already included on powerpc:
>
> # cat tools/arch/powerpc/include/uapi/asm/mman.h
> #ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> #define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> #define MAP_DENYWRITE 0x0800
> #define MAP_EXECUTABLE 0x1000
> #define MAP_GROWSDOWN 0x0100
> #define MAP_HUGETLB 0x40000
> #define MAP_LOCKED 0x80
> #define MAP_NONBLOCK 0x10000
> #define MAP_NORESERVE 0x40
> #define MAP_POPULATE 0x8000
> #define MAP_STACK 0x20000
> #include <uapi/asm-generic/mman-common.h>
> #endif
So for powerpc is free from MADV_* problem.
Alpha, MIPS, parisc and xtensa misses some MADV_* macros,
we should define them in their uapi/mman.h.
Thank you.
>> realized the missing of MADV_FEEE in tools/perf/trace/beauty/mmap.c.
>> Is that intentionally?
> Not sure, Arnaldo should know.
>
> Thanks,
> Naveen
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 9:28 ` Naveen N. Rao
2016-09-14 9:36 ` Wangnan (F)
@ 2016-09-14 13:52 ` Arnaldo Carvalho de Melo
2016-09-14 16:34 ` Naveen N. Rao
1 sibling, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-14 13:52 UTC (permalink / raw)
To: Naveen N. Rao; +Cc: Wang Nan, linux-kernel, lizefan, pi3orama
Em Wed, Sep 14, 2016 at 02:58:10PM +0530, Naveen N. Rao escreveu:
> On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> > So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
> > but took a different path for 2/3, now it builds for all systems I have
> > containers for:
> This still fails for me on ppc64. Perhaps we should guard
> P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
> earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
> conditional defines")?
Humm, yeah, we have to find a way to make it clear that some flags are
not present in all arches, I'll think about the solution Wang came up
with, i.e. having it defined to zero on arches where it is not
supported, which at first sounds ugly :-\
One thing related to this, but for future work, is to be able to support
doing a ' perf trace record' on x86_64 and then doing a 'perf trace -i
perf.data' with the resulting file, i.e. cross-platform syscall arg
beautifying, i.e. a cross-arch strace.
Right now we use audit lib to at least map the syscall ids using, IIRC,
the header env stuff, but we need to go to the syscall args as well.
Future work, sure.
And yeah, I'll try and cross-build audit-lib for my powerpc cross build
containers, so that I can catch this bug before applying these patches
and make sure things like this get caught in the future.
- Arnaldo
> - Naveen
>
> ---
> In file included from builtin-trace.c:560:0:
> trace/beauty/mmap.c: In function ‘syscall_arg__scnprintf_mmap_flags’:
> trace/beauty/mmap.c:38:14: error: ‘MAP_32BIT’ undeclared (first use in this function)
> if (flags & MAP_##n) { \
> ^
> trace/beauty/mmap.c:45:2: note: in expansion of macro ‘P_MMAP_FLAG’
> P_MMAP_FLAG(32BIT);
> ^
> trace/beauty/mmap.c:38:14: note: each undeclared identifier is reported only once for each function it appears in
> if (flags & MAP_##n) { \
> ^
> trace/beauty/mmap.c:45:2: note: in expansion of macro ‘P_MMAP_FLAG’
> P_MMAP_FLAG(32BIT);
> ^
> CC bench/mem-functions.o
> mv: cannot stat ‘./.builtin-trace.o.tmp’: No such file or directory
> make[2]: *** [builtin-trace.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 13:52 ` Arnaldo Carvalho de Melo
@ 2016-09-14 16:34 ` Naveen N. Rao
2016-09-14 17:00 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 19+ messages in thread
From: Naveen N. Rao @ 2016-09-14 16:34 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Wang Nan, linux-kernel, lizefan, pi3orama
On 2016/09/14 10:52AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 14, 2016 at 02:58:10PM +0530, Naveen N. Rao escreveu:
> > On 2016/09/12 06:15PM, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Sep 12, 2016 at 04:07:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > So, please take a look at my perf/core branch, I applied 1/3 and 3/3,
> > > but took a different path for 2/3, now it builds for all systems I have
> > > containers for:
>
> > This still fails for me on ppc64. Perhaps we should guard
> > P_MMAP_FLAG(32BIT) and potentially others with a #ifdef, which was
> > earlier reverted by commit 256763b0 ("perf trace beauty mmap: Add more
> > conditional defines")?
>
> Humm, yeah, we have to find a way to make it clear that some flags are
> not present in all arches, I'll think about the solution Wang came up
> with, i.e. having it defined to zero on arches where it is not
> supported, which at first sounds ugly :-\
>
> One thing related to this, but for future work, is to be able to support
> doing a ' perf trace record' on x86_64 and then doing a 'perf trace -i
> perf.data' with the resulting file, i.e. cross-platform syscall arg
> beautifying, i.e. a cross-arch strace.
>
> Right now we use audit lib to at least map the syscall ids using, IIRC,
> the header env stuff, but we need to go to the syscall args as well.
> Future work, sure.
>
> And yeah, I'll try and cross-build audit-lib for my powerpc cross build
> containers, so that I can catch this bug before applying these patches
> and make sure things like this get caught in the future.
Thanks, Arnaldo!
Though, if it is too much work, I don't mind reporting/trying to fix the
odd build failure. I've setup daily builds to catch any such issues.
Regards,
Naveen
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 16:34 ` Naveen N. Rao
@ 2016-09-14 17:00 ` Arnaldo Carvalho de Melo
2016-09-15 14:47 ` Naveen N. Rao
0 siblings, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-14 17:00 UTC (permalink / raw)
To: Naveen N. Rao; +Cc: Wang Nan, linux-kernel, lizefan, pi3orama
Em Wed, Sep 14, 2016 at 10:04:28PM +0530, Naveen N. Rao escreveu:
> On 2016/09/14 10:52AM, Arnaldo Carvalho de Melo wrote:
> > And yeah, I'll try and cross-build audit-lib for my powerpc cross build
> > containers, so that I can catch this bug before applying these patches
> > and make sure things like this get caught in the future.
> Thanks, Arnaldo!
> Though, if it is too much work, I don't mind reporting/trying to fix the
> odd build failure. I've setup daily builds to catch any such issues.
Please do so! Even with me adding a cross built audit-libs to the mix,
there are lots of other libraries I'm not covering, just zlib, elfutils
and now, audit-libs are being covered.
- Arnaldo
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/3] tools include: Add uapi mman.h for each architecture
2016-09-14 17:00 ` Arnaldo Carvalho de Melo
@ 2016-09-15 14:47 ` Naveen N. Rao
0 siblings, 0 replies; 19+ messages in thread
From: Naveen N. Rao @ 2016-09-15 14:47 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Wang Nan, linux-kernel, lizefan, pi3orama
On 2016/09/14 02:00PM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Sep 14, 2016 at 10:04:28PM +0530, Naveen N. Rao escreveu:
> > On 2016/09/14 10:52AM, Arnaldo Carvalho de Melo wrote:
> > > And yeah, I'll try and cross-build audit-lib for my powerpc cross build
> > > containers, so that I can catch this bug before applying these patches
> > > and make sure things like this get caught in the future.
>
> > Thanks, Arnaldo!
> > Though, if it is too much work, I don't mind reporting/trying to fix the
> > odd build failure. I've setup daily builds to catch any such issues.
>
> Please do so! Even with me adding a cross built audit-libs to the mix,
> there are lots of other libraries I'm not covering, just zlib, elfutils
> and now, audit-libs are being covered.
Sure. It's pretty rudimentary now (just a script, infact). One of these
days, I hope to put together a set of VMs/containers to get better
coverage.
Regards,
Naveen
^ permalink raw reply [flat|nested] 19+ messages in thread
* [tip:perf/core] tools include: Add uapi mman.h for each architecture
2016-09-12 12:54 ` [PATCH 1/3] tools include: Add uapi mman.h for each architecture Wang Nan
2016-09-12 19:07 ` Arnaldo Carvalho de Melo
@ 2016-09-20 21:37 ` tip-bot for Wang Nan
1 sibling, 0 replies; 19+ messages in thread
From: tip-bot for Wang Nan @ 2016-09-20 21:37 UTC (permalink / raw)
To: linux-tip-commits; +Cc: lizefan, linux-kernel, acme, hpa, mingo, wangnan0, tglx
Commit-ID: f3539c12d8196ce0a1993364d30b3a18908470d1
Gitweb: http://git.kernel.org/tip/f3539c12d8196ce0a1993364d30b3a18908470d1
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Mon, 12 Sep 2016 12:54:29 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 13 Sep 2016 15:26:08 -0300
tools include: Add uapi mman.h for each architecture
Some mmap related macros have different values for different
architectures. This patch introduces uapi mman.h for each
architectures.
Three headers are cloned from kernel include to tools/include:
tools/include/uapi/asm-generic/mman-common.h
tools/include/uapi/asm-generic/mman.h
tools/include/uapi/linux/mman.h
The main part of this patch is generated by following script:
macros=`cat $0 | awk 'V==1 {print}; /^# start macro list/ {V=1}'`
for arch in `ls tools/arch`
do
[ -d tools/arch/$arch/include/uapi/asm ] || mkdir -p tools/arch/$arch/include/uapi/asm
src=arch/$arch/include/uapi/asm/mman.h
target=tools/arch/$arch/include/uapi/asm/mman.h
guard="TOOLS_ARCH_"`echo $arch | awk '{print toupper($0)}'`_UAPI_ASM_MMAN_FIX_H
echo '#ifndef '$guard > $target
echo '#define '$guard >> $target
[ -f $src ] &&
for m in $macros
do
if grep '#define[ \t]*'$m $src > /dev/null 2>&1
then
grep -h '#define[ \t]*'$m $src | sed 's/[ \t]*\/\*.*$//g' >> $target
fi
done
if [ -f $src ]
then
grep '#include <asm-generic' $src >> $target
else
echo "#include <asm-generic/mman.h>" >> $target
fi
echo '#endif' >> $target
echo "$target"
done
exit 0
# Following macros are extracted from:
# tools/perf/trace/beauty/mmap.c
#
# start macro list
MADV_DODUMP
MADV_DOFORK
MADV_DONTDUMP
MADV_DONTFORK
MADV_DONTNEED
MADV_HUGEPAGE
MADV_HWPOISON
MADV_MERGEABLE
MADV_NOHUGEPAGE
MADV_NORMAL
MADV_RANDOM
MADV_REMOVE
MADV_SEQUENTIAL
MADV_SOFT_OFFLINE
MADV_UNMERGEABLE
MADV_WILLNEED
MAP_32BIT
MAP_ANONYMOUS
MAP_DENYWRITE
MAP_EXECUTABLE
MAP_FILE
MAP_FIXED
MAP_GROWSDOWN
MAP_HUGETLB
MAP_LOCKED
MAP_NONBLOCK
MAP_NORESERVE
MAP_POPULATE
MAP_PRIVATE
MAP_SHARED
MAP_STACK
MAP_UNINITIALIZED
MREMAP_FIXED
MREMAP_MAYMOVE
PROT_EXEC
PROT_GROWSDOWN
PROT_GROWSUP
PROT_NONE
PROT_READ
PROT_SEM
PROT_WRITE
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1473684871-209320-2-git-send-email-wangnan0@huawei.com
[ Added new files to tools/perf/MANIFEST to fix the detached tarball build, add mman.h for ARC ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/arch/alpha/include/uapi/asm/mman.h | 38 +++++++++++++++++++++
tools/arch/arc/include/uapi/asm/mman.h | 4 +++
tools/arch/arm/include/uapi/asm/mman.h | 4 +++
tools/arch/arm64/include/uapi/asm/mman.h | 4 +++
tools/arch/frv/include/uapi/asm/mman.h | 4 +++
tools/arch/h8300/include/uapi/asm/mman.h | 4 +++
tools/arch/hexagon/include/uapi/asm/mman.h | 4 +++
tools/arch/ia64/include/uapi/asm/mman.h | 4 +++
tools/arch/m32r/include/uapi/asm/mman.h | 4 +++
tools/arch/microblaze/include/uapi/asm/mman.h | 4 +++
tools/arch/mips/include/uapi/asm/mman.h | 39 ++++++++++++++++++++++
tools/arch/mn10300/include/uapi/asm/mman.h | 4 +++
tools/arch/parisc/include/uapi/asm/mman.h | 38 +++++++++++++++++++++
tools/arch/powerpc/include/uapi/asm/mman.h | 13 ++++++++
tools/arch/s390/include/uapi/asm/mman.h | 4 +++
tools/arch/score/include/uapi/asm/mman.h | 4 +++
tools/arch/sh/include/uapi/asm/mman.h | 4 +++
tools/arch/sparc/include/uapi/asm/mman.h | 13 ++++++++
tools/arch/tile/include/uapi/asm/mman.h | 13 ++++++++
tools/arch/x86/include/uapi/asm/mman.h | 5 +++
tools/arch/xtensa/include/uapi/asm/mman.h | 38 +++++++++++++++++++++
.../include}/uapi/asm-generic/mman-common.h | 0
tools/include/uapi/asm-generic/mman.h | 22 ++++++++++++
tools/include/uapi/linux/mman.h | 13 ++++++++
tools/perf/MANIFEST | 4 +++
25 files changed, 288 insertions(+)
diff --git a/tools/arch/alpha/include/uapi/asm/mman.h b/tools/arch/alpha/include/uapi/asm/mman.h
new file mode 100644
index 0000000..6ed4ad4
--- /dev/null
+++ b/tools/arch/alpha/include/uapi/asm/mman.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 17
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 16
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 6
+#define MADV_HUGEPAGE 14
+#define MADV_MERGEABLE 12
+#define MADV_NOHUGEPAGE 15
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 13
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x10
+#define MAP_DENYWRITE 0x02000
+#define MAP_EXECUTABLE 0x04000
+#define MAP_FILE 0
+#define MAP_FIXED 0x100
+#define MAP_GROWSDOWN 0x01000
+#define MAP_HUGETLB 0x100000
+#define MAP_LOCKED 0x08000
+#define MAP_NONBLOCK 0x40000
+#define MAP_NORESERVE 0x10000
+#define MAP_POPULATE 0x20000
+#define MAP_PRIVATE 0x02
+#define MAP_SHARED 0x01
+#define MAP_STACK 0x80000
+#define PROT_EXEC 0x4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x0
+#define PROT_READ 0x1
+#define PROT_SEM 0x8
+#define PROT_WRITE 0x2
+#endif
diff --git a/tools/arch/arc/include/uapi/asm/mman.h b/tools/arch/arc/include/uapi/asm/mman.h
new file mode 100644
index 0000000..f76765d
--- /dev/null
+++ b/tools/arch/arc/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_ARC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ARC_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/arm/include/uapi/asm/mman.h b/tools/arch/arm/include/uapi/asm/mman.h
new file mode 100644
index 0000000..f200638
--- /dev/null
+++ b/tools/arch/arm/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/arm64/include/uapi/asm/mman.h b/tools/arch/arm64/include/uapi/asm/mman.h
new file mode 100644
index 0000000..a7dd975
--- /dev/null
+++ b/tools/arch/arm64/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/frv/include/uapi/asm/mman.h b/tools/arch/frv/include/uapi/asm/mman.h
new file mode 100644
index 0000000..99bba05
--- /dev/null
+++ b/tools/arch/frv/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/h8300/include/uapi/asm/mman.h b/tools/arch/h8300/include/uapi/asm/mman.h
new file mode 100644
index 0000000..df95096
--- /dev/null
+++ b/tools/arch/h8300/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/hexagon/include/uapi/asm/mman.h b/tools/arch/hexagon/include/uapi/asm/mman.h
new file mode 100644
index 0000000..f1adcce
--- /dev/null
+++ b/tools/arch/hexagon/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/ia64/include/uapi/asm/mman.h b/tools/arch/ia64/include/uapi/asm/mman.h
new file mode 100644
index 0000000..23420eb
--- /dev/null
+++ b/tools/arch/ia64/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/m32r/include/uapi/asm/mman.h b/tools/arch/m32r/include/uapi/asm/mman.h
new file mode 100644
index 0000000..a35ebd6
--- /dev/null
+++ b/tools/arch/m32r/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/microblaze/include/uapi/asm/mman.h b/tools/arch/microblaze/include/uapi/asm/mman.h
new file mode 100644
index 0000000..75f460a
--- /dev/null
+++ b/tools/arch/microblaze/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/mips/include/uapi/asm/mman.h b/tools/arch/mips/include/uapi/asm/mman.h
new file mode 100644
index 0000000..db88fa4
--- /dev/null
+++ b/tools/arch/mips/include/uapi/asm/mman.h
@@ -0,0 +1,39 @@
+#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 17
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 16
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 4
+#define MADV_HUGEPAGE 14
+#define MADV_HWPOISON 100
+#define MADV_MERGEABLE 12
+#define MADV_NOHUGEPAGE 15
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 13
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x0800
+#define MAP_DENYWRITE 0x2000
+#define MAP_EXECUTABLE 0x4000
+#define MAP_FILE 0
+#define MAP_FIXED 0x010
+#define MAP_GROWSDOWN 0x1000
+#define MAP_HUGETLB 0x80000
+#define MAP_LOCKED 0x8000
+#define MAP_NONBLOCK 0x20000
+#define MAP_NORESERVE 0x0400
+#define MAP_POPULATE 0x10000
+#define MAP_PRIVATE 0x002
+#define MAP_SHARED 0x001
+#define MAP_STACK 0x40000
+#define PROT_EXEC 0x04
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x00
+#define PROT_READ 0x01
+#define PROT_SEM 0x10
+#define PROT_WRITE 0x02
+#endif
diff --git a/tools/arch/mn10300/include/uapi/asm/mman.h b/tools/arch/mn10300/include/uapi/asm/mman.h
new file mode 100644
index 0000000..81faa5d
--- /dev/null
+++ b/tools/arch/mn10300/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
new file mode 100644
index 0000000..c4a9d9f
--- /dev/null
+++ b/tools/arch/parisc/include/uapi/asm/mman.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 70
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 69
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 4
+#define MADV_HUGEPAGE 67
+#define MADV_MERGEABLE 65
+#define MADV_NOHUGEPAGE 68
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 66
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x10
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_FILE 0
+#define MAP_FIXED 0x04
+#define MAP_GROWSDOWN 0x8000
+#define MAP_HUGETLB 0x80000
+#define MAP_LOCKED 0x2000
+#define MAP_NONBLOCK 0x20000
+#define MAP_NORESERVE 0x4000
+#define MAP_POPULATE 0x10000
+#define MAP_PRIVATE 0x02
+#define MAP_SHARED 0x01
+#define MAP_STACK 0x40000
+#define PROT_EXEC 0x4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x0
+#define PROT_READ 0x1
+#define PROT_SEM 0x8
+#define PROT_WRITE 0x2
+#endif
diff --git a/tools/arch/powerpc/include/uapi/asm/mman.h b/tools/arch/powerpc/include/uapi/asm/mman.h
new file mode 100644
index 0000000..7a56ab9
--- /dev/null
+++ b/tools/arch/powerpc/include/uapi/asm/mman.h
@@ -0,0 +1,13 @@
+#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_GROWSDOWN 0x0100
+#define MAP_HUGETLB 0x40000
+#define MAP_LOCKED 0x80
+#define MAP_NONBLOCK 0x10000
+#define MAP_NORESERVE 0x40
+#define MAP_POPULATE 0x8000
+#define MAP_STACK 0x20000
+#include <uapi/asm-generic/mman-common.h>
+#endif
diff --git a/tools/arch/s390/include/uapi/asm/mman.h b/tools/arch/s390/include/uapi/asm/mman.h
new file mode 100644
index 0000000..fe53b91
--- /dev/null
+++ b/tools/arch/s390/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/score/include/uapi/asm/mman.h b/tools/arch/score/include/uapi/asm/mman.h
new file mode 100644
index 0000000..ba1ee9c
--- /dev/null
+++ b/tools/arch/score/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/sh/include/uapi/asm/mman.h b/tools/arch/sh/include/uapi/asm/mman.h
new file mode 100644
index 0000000..5a47d8c
--- /dev/null
+++ b/tools/arch/sh/include/uapi/asm/mman.h
@@ -0,0 +1,4 @@
+#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/sparc/include/uapi/asm/mman.h b/tools/arch/sparc/include/uapi/asm/mman.h
new file mode 100644
index 0000000..b88f3ac
--- /dev/null
+++ b/tools/arch/sparc/include/uapi/asm/mman.h
@@ -0,0 +1,13 @@
+#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_GROWSDOWN 0x0200
+#define MAP_HUGETLB 0x40000
+#define MAP_LOCKED 0x100
+#define MAP_NONBLOCK 0x10000
+#define MAP_NORESERVE 0x40
+#define MAP_POPULATE 0x8000
+#define MAP_STACK 0x20000
+#include <uapi/asm-generic/mman-common.h>
+#endif
diff --git a/tools/arch/tile/include/uapi/asm/mman.h b/tools/arch/tile/include/uapi/asm/mman.h
new file mode 100644
index 0000000..b0a054f
--- /dev/null
+++ b/tools/arch/tile/include/uapi/asm/mman.h
@@ -0,0 +1,13 @@
+#ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
+#define MAP_DENYWRITE 0x0800
+#define MAP_EXECUTABLE 0x1000
+#define MAP_GROWSDOWN 0x0100
+#define MAP_HUGETLB 0x4000
+#define MAP_LOCKED 0x0200
+#define MAP_NONBLOCK 0x0080
+#define MAP_NORESERVE 0x0400
+#define MAP_POPULATE 0x0040
+#define MAP_STACK MAP_GROWSDOWN
+#include <uapi/asm-generic/mman-common.h>
+#endif
diff --git a/tools/arch/x86/include/uapi/asm/mman.h b/tools/arch/x86/include/uapi/asm/mman.h
new file mode 100644
index 0000000..b73c1af
--- /dev/null
+++ b/tools/arch/x86/include/uapi/asm/mman.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
+#define MAP_32BIT 0x40
+#include <uapi/asm-generic/mman.h>
+#endif
diff --git a/tools/arch/xtensa/include/uapi/asm/mman.h b/tools/arch/xtensa/include/uapi/asm/mman.h
new file mode 100644
index 0000000..1c89538
--- /dev/null
+++ b/tools/arch/xtensa/include/uapi/asm/mman.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
+#define MADV_DODUMP 17
+#define MADV_DOFORK 11
+#define MADV_DONTDUMP 16
+#define MADV_DONTFORK 10
+#define MADV_DONTNEED 4
+#define MADV_HUGEPAGE 14
+#define MADV_MERGEABLE 12
+#define MADV_NOHUGEPAGE 15
+#define MADV_NORMAL 0
+#define MADV_RANDOM 1
+#define MADV_REMOVE 9
+#define MADV_SEQUENTIAL 2
+#define MADV_UNMERGEABLE 13
+#define MADV_WILLNEED 3
+#define MAP_ANONYMOUS 0x0800
+#define MAP_DENYWRITE 0x2000
+#define MAP_EXECUTABLE 0x4000
+#define MAP_FILE 0
+#define MAP_FIXED 0x010
+#define MAP_GROWSDOWN 0x1000
+#define MAP_HUGETLB 0x80000
+#define MAP_LOCKED 0x8000
+#define MAP_NONBLOCK 0x20000
+#define MAP_NORESERVE 0x0400
+#define MAP_POPULATE 0x10000
+#define MAP_PRIVATE 0x002
+#define MAP_SHARED 0x001
+#define MAP_STACK 0x40000
+#define PROT_EXEC 0x4
+#define PROT_GROWSDOWN 0x01000000
+#define PROT_GROWSUP 0x02000000
+#define PROT_NONE 0x0
+#define PROT_READ 0x1
+#define PROT_SEM 0x10
+#define PROT_WRITE 0x2
+#endif
diff --git a/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h
similarity index 100%
copy from include/uapi/asm-generic/mman-common.h
copy to tools/include/uapi/asm-generic/mman-common.h
diff --git a/tools/include/uapi/asm-generic/mman.h b/tools/include/uapi/asm-generic/mman.h
new file mode 100644
index 0000000..10fa785
--- /dev/null
+++ b/tools/include/uapi/asm-generic/mman.h
@@ -0,0 +1,22 @@
+#ifndef __ASM_GENERIC_MMAN_H
+#define __ASM_GENERIC_MMAN_H
+
+#include <uapi/asm-generic/mman-common.h>
+
+#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MAP_LOCKED 0x2000 /* pages are locked */
+#define MAP_NORESERVE 0x4000 /* don't check for reservations */
+#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
+#define MAP_NONBLOCK 0x10000 /* do not block on IO */
+#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
+
+/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
+
+#define MCL_CURRENT 1 /* lock all current mappings */
+#define MCL_FUTURE 2 /* lock all future mappings */
+#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
+
+#endif /* __ASM_GENERIC_MMAN_H */
diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
new file mode 100644
index 0000000..81d8edf
--- /dev/null
+++ b/tools/include/uapi/linux/mman.h
@@ -0,0 +1,13 @@
+#ifndef _UAPI_LINUX_MMAN_H
+#define _UAPI_LINUX_MMAN_H
+
+#include <uapi/asm/mman.h>
+
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+
+#define OVERCOMMIT_GUESS 0
+#define OVERCOMMIT_ALWAYS 1
+#define OVERCOMMIT_NEVER 2
+
+#endif /* _UAPI_LINUX_MMAN_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index ff200c6..0bda2cc 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -66,9 +66,12 @@ tools/include/linux/hash.h
tools/include/linux/kernel.h
tools/include/linux/list.h
tools/include/linux/log2.h
+tools/include/uapi/asm-generic/mman-common.h
+tools/include/uapi/asm-generic/mman.h
tools/include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf_common.h
tools/include/uapi/linux/hw_breakpoint.h
+tools/include/uapi/linux/mman.h
tools/include/uapi/linux/perf_event.h
tools/include/linux/poison.h
tools/include/linux/rbtree.h
@@ -79,4 +82,5 @@ tools/include/linux/types.h
tools/include/linux/err.h
tools/include/linux/bitmap.h
tools/include/linux/time64.h
+tools/arch/*/include/uapi/asm/mman.h
tools/arch/*/include/uapi/asm/perf_regs.h
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [tip:perf/core] perf build: Compare mman.h related headers against kernel originals
2016-09-12 12:54 ` [PATCH 3/3] perf build: Compare mman.h related headers againest kernel Wang Nan
@ 2016-09-20 21:39 ` tip-bot for Wang Nan
0 siblings, 0 replies; 19+ messages in thread
From: tip-bot for Wang Nan @ 2016-09-20 21:39 UTC (permalink / raw)
To: linux-tip-commits; +Cc: wangnan0, hpa, linux-kernel, acme, lizefan, mingo, tglx
Commit-ID: 0a4a7e435f458e996d0f21a9ebc964e0b0d64eba
Gitweb: http://git.kernel.org/tip/0a4a7e435f458e996d0f21a9ebc964e0b0d64eba
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Mon, 12 Sep 2016 12:54:31 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 13 Sep 2016 16:13:29 -0300
perf build: Compare mman.h related headers against kernel originals
As with other cloned headers, compare the newly introduced mman related
headers against their source copy in kernel tree.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1473684871-209320-4-git-send-email-wangnan0@huawei.com
[ Added -I to ignore the uapi/ difference ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile.perf | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 828cfd7..d710db1 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -432,6 +432,15 @@ $(PERF_IN): prepare FORCE
@(test -f ../../include/linux/coresight-pmu.h && ( \
(diff -B ../include/linux/coresight-pmu.h ../../include/linux/coresight-pmu.h >/dev/null) \
|| echo "Warning: tools/include/linux/coresight-pmu.h differs from kernel" >&2 )) || true
+ @(test -f ../../include/uapi/asm-generic/mman-common.h && ( \
+ (diff -B ../include/uapi/asm-generic/mman-common.h ../../include/uapi/asm-generic/mman-common.h >/dev/null) \
+ || echo "Warning: tools/include/uapi/asm-generic/mman-common.h differs from kernel" >&2 )) || true
+ @(test -f ../../include/uapi/asm-generic/mman.h && ( \
+ (diff -B -I "^#include <\(uapi/\)*asm-generic/mman-common.h>$$" ../include/uapi/asm-generic/mman.h ../../include/uapi/asm-generic/mman.h >/dev/null) \
+ || echo "Warning: tools/include/uapi/asm-generic/mman.h differs from kernel" >&2 )) || true
+ @(test -f ../../include/uapi/linux/mman.h && ( \
+ (diff -B -I "^#include <\(uapi/\)*asm/mman.h>$$" ../include/uapi/linux/mman.h ../../include/uapi/linux/mman.h >/dev/null) \
+ || echo "Warning: tools/include/uapi/linux/mman.h differs from kernel" >&2 )) || true
$(Q)$(MAKE) $(build)=perf
$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
^ permalink raw reply related [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-09-20 21:39 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12 12:54 [PATCH 0/3] perf: Fix mmap related macros Wang Nan
2016-09-12 12:54 ` [PATCH 1/3] tools include: Add uapi mman.h for each architecture Wang Nan
2016-09-12 19:07 ` Arnaldo Carvalho de Melo
2016-09-12 21:15 ` Arnaldo Carvalho de Melo
2016-09-13 6:36 ` Wangnan (F)
2016-09-14 9:28 ` Naveen N. Rao
2016-09-14 9:36 ` Wangnan (F)
2016-09-14 10:00 ` Naveen N. Rao
2016-09-14 10:23 ` Wangnan (F)
2016-09-14 10:46 ` Naveen N. Rao
2016-09-14 10:49 ` Wangnan (F)
2016-09-14 13:52 ` Arnaldo Carvalho de Melo
2016-09-14 16:34 ` Naveen N. Rao
2016-09-14 17:00 ` Arnaldo Carvalho de Melo
2016-09-15 14:47 ` Naveen N. Rao
2016-09-20 21:37 ` [tip:perf/core] " tip-bot for Wang Nan
2016-09-12 12:54 ` [PATCH 2/3] tools include: Introduce bits/mman.h Wang Nan
2016-09-12 12:54 ` [PATCH 3/3] perf build: Compare mman.h related headers againest kernel Wang Nan
2016-09-20 21:39 ` [tip:perf/core] perf build: Compare mman.h related headers against kernel originals tip-bot for Wang Nan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).