All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix mman macros using mman-fix.h
@ 2016-09-06  5:48 Wang Nan
  2016-09-06  5:48 ` [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h Wang Nan
  2016-09-06  5:48 ` [PATCH 2/2] perf tools: Fix mman macros using mman-fix.h Wang Nan
  0 siblings, 2 replies; 8+ messages in thread
From: Wang Nan @ 2016-09-06  5:48 UTC (permalink / raw)
  To: acme; +Cc: nilayvaish, linux-kernel, lizefan, Wang Nan

Macros in mman like MAP_HUGETLB are missed in some old systems, causes
building error like this:

  CC       /tmp/build/perf/arch/x86/util/perf_regs.o
  util/event.c: In function 'perf_event__synthesize_mmap_events':
  util/event.c:350: error: 'MAP_HUGETLB' undeclared (first use in this function)
  util/event.c:350: error: (Each undeclared identifier is reported only once
		  util/event.c:350: error: for each function it appears in.)

The first patch generates mman-fix.h for each arch, the second patch
fixes these macros use mman-fix.h.

Wang Nan (2):
  perf tools: Introduce memory mapping macros in mman-fix.h
  perf tools: Fix mman macros using mman-fix.h

 tools/arch/alpha/include/uapi/asm/mman-fix.h      | 38 ++++++++++++++
 tools/arch/arm/include/uapi/asm/mman-fix.h        |  5 ++
 tools/arch/arm64/include/uapi/asm/mman-fix.h      |  5 ++
 tools/arch/frv/include/uapi/asm/mman-fix.h        |  5 ++
 tools/arch/h8300/include/uapi/asm/mman-fix.h      |  5 ++
 tools/arch/hexagon/include/uapi/asm/mman-fix.h    |  5 ++
 tools/arch/ia64/include/uapi/asm/mman-fix.h       |  5 ++
 tools/arch/m32r/include/uapi/asm/mman-fix.h       |  5 ++
 tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 ++
 tools/arch/mips/include/uapi/asm/mman-fix.h       | 41 +++++++++++++++
 tools/arch/mn10300/include/uapi/asm/mman-fix.h    |  5 ++
 tools/arch/parisc/include/uapi/asm/mman-fix.h     | 38 ++++++++++++++
 tools/arch/powerpc/include/uapi/asm/mman-fix.h    | 11 ++++
 tools/arch/s390/include/uapi/asm/mman-fix.h       |  5 ++
 tools/arch/score/include/uapi/asm/mman-fix.h      |  5 ++
 tools/arch/sh/include/uapi/asm/mman-fix.h         |  5 ++
 tools/arch/sparc/include/uapi/asm/mman-fix.h      | 11 ++++
 tools/arch/tile/include/uapi/asm/mman-fix.h       | 11 ++++
 tools/arch/x86/include/uapi/asm/mman-fix.h        |  8 +++
 tools/arch/xtensa/include/uapi/asm/mman-fix.h     | 38 ++++++++++++++
 tools/include/uapi/asm-generic/mman-fix.h         | 46 +++++++++++++++++
 tools/perf/MANIFEST                               |  2 +
 tools/perf/trace/beauty/mmap.c                    | 63 +----------------------
 tools/perf/util/event.c                           |  5 +-
 tools/perf/util/map.c                             |  3 +-
 25 files changed, 307 insertions(+), 68 deletions(-)
 create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/xtensa/include/uapi/asm/mman-fix.h
 create mode 100644 tools/include/uapi/asm-generic/mman-fix.h

-- 
1.8.3.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h
  2016-09-06  5:48 [PATCH 0/2] Fix mman macros using mman-fix.h Wang Nan
@ 2016-09-06  5:48 ` Wang Nan
  2016-09-06 12:59   ` Arnaldo Carvalho de Melo
  2016-09-06  5:48 ` [PATCH 2/2] perf tools: Fix mman macros using mman-fix.h Wang Nan
  1 sibling, 1 reply; 8+ messages in thread
From: Wang Nan @ 2016-09-06  5:48 UTC (permalink / raw)
  To: acme
  Cc: nilayvaish, linux-kernel, lizefan, Wang Nan, Hou Pengyang,
	He Kuang, Arnaldo Carvalho de Melo

tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
tools/perf/util/map.c depend on several macros in mman.h, which
are lost on old systems like ubuntu 12.04. They are architecture
dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
into tools/ is not easy because mman.h for some unusual archs
(like tile) have extra dependencies.

This patch introduces only required macros into mman-fix.h.
Macros list is gotten from tools/perf/trace/beauty/mmap.c.

This patch is gnerated using following bash script:

 #!/bin/bash

 function begin_mman_fix_header()
 {
   echo "#ifndef $1" >  $2
   echo "#define $1" >> $2
   echo "#include <sys/mman.h>" >> $2
 }

 function finish_mman_fix_header()
 {
   echo "#endif // $1" >> $2
   echo "Finish writing $2"
 }

 function build_mman_fix_header()
 {
   guard=$1
   shift
   target=$1
   shift
   begin_mman_fix_header $guard $target
   for src in $@
   do
     if [ -f $src ]
     then
       for macro in $macros
       do
         if grep '#define[ \t]*'$macro $src > /dev/null 2>&1
         then
           echo "#ifndef $macro" >> $target
           grep '#define[ \t]*'$macro $src | sed 's/[ \t]*\/\*.*$//g' >> $target
           echo "#endif" >> $target
         fi
       done
     fi
   done
 }

 macros=`grep ifndef tools/perf/trace/beauty/mmap.c | awk '{print $2}'`

 baseheader=tools/include/uapi/asm-generic/mman-fix.h
 build_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader include/uapi/asm-generic/mman*
 echo "#ifndef MAP_UNINITIALIZED" >> $baseheader
 echo "#define MAP_UNINITIALIZED 0x4000000" >> $baseheader
 echo "#endif" >> $baseheader
 finish_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader

 archs=`ls tools/arch`
 for arch in $archs
 do
   archheader=tools/arch/$arch/include/uapi/asm/mman-fix.h
   if [ ! -d tools/arch/$arch/include/uapi/asm ]
   then
     mkdir -p tools/arch/$arch/include/uapi/asm
   fi
   uppercase=`echo $arch | awk '{print toupper($0)}'`
   build_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader arch/$arch/include/uapi/asm/mman.h
   echo "#include <asm-generic/mman-fix.h>" >> $archheader
   finish_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader
 done

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Hou Pengyang <houpengyang@huawei.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/arch/alpha/include/uapi/asm/mman-fix.h      | 38 +++++++++++++++++++
 tools/arch/arm/include/uapi/asm/mman-fix.h        |  5 +++
 tools/arch/arm64/include/uapi/asm/mman-fix.h      |  5 +++
 tools/arch/frv/include/uapi/asm/mman-fix.h        |  5 +++
 tools/arch/h8300/include/uapi/asm/mman-fix.h      |  5 +++
 tools/arch/hexagon/include/uapi/asm/mman-fix.h    |  5 +++
 tools/arch/ia64/include/uapi/asm/mman-fix.h       |  5 +++
 tools/arch/m32r/include/uapi/asm/mman-fix.h       |  5 +++
 tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 +++
 tools/arch/mips/include/uapi/asm/mman-fix.h       | 41 ++++++++++++++++++++
 tools/arch/mn10300/include/uapi/asm/mman-fix.h    |  5 +++
 tools/arch/parisc/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
 tools/arch/powerpc/include/uapi/asm/mman-fix.h    | 11 ++++++
 tools/arch/s390/include/uapi/asm/mman-fix.h       |  5 +++
 tools/arch/score/include/uapi/asm/mman-fix.h      |  5 +++
 tools/arch/sh/include/uapi/asm/mman-fix.h         |  5 +++
 tools/arch/sparc/include/uapi/asm/mman-fix.h      | 11 ++++++
 tools/arch/tile/include/uapi/asm/mman-fix.h       | 11 ++++++
 tools/arch/x86/include/uapi/asm/mman-fix.h        |  8 ++++
 tools/arch/xtensa/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
 tools/include/uapi/asm-generic/mman-fix.h         | 46 +++++++++++++++++++++++
 tools/perf/MANIFEST                               |  2 +
 22 files changed, 304 insertions(+)
 create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
 create mode 100644 tools/arch/xtensa/include/uapi/asm/mman-fix.h
 create mode 100644 tools/include/uapi/asm-generic/mman-fix.h

diff --git a/tools/arch/alpha/include/uapi/asm/mman-fix.h b/tools/arch/alpha/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..f807a71
--- /dev/null
+++ b/tools/arch/alpha/include/uapi/asm/mman-fix.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef PROT_SEM
+#define PROT_SEM	0x8
+#endif
+#ifndef MAP_FIXED
+#define MAP_FIXED	0x100
+#endif
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS	0x10
+#endif
+#ifndef MAP_STACK
+#define MAP_STACK	0x80000
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x100000
+#endif
+#ifndef MADV_MERGEABLE
+#define MADV_MERGEABLE   12
+#endif
+#ifndef MADV_UNMERGEABLE
+#define MADV_UNMERGEABLE 13
+#endif
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE	14
+#endif
+#ifndef MADV_NOHUGEPAGE
+#define MADV_NOHUGEPAGE	15
+#endif
+#ifndef MADV_DONTDUMP
+#define MADV_DONTDUMP   16
+#endif
+#ifndef MADV_DODUMP
+#define MADV_DODUMP	17
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/arm/include/uapi/asm/mman-fix.h b/tools/arch/arm/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..a29dae1
--- /dev/null
+++ b/tools/arch/arm/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/arm64/include/uapi/asm/mman-fix.h b/tools/arch/arm64/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..e50c0d1
--- /dev/null
+++ b/tools/arch/arm64/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/frv/include/uapi/asm/mman-fix.h b/tools/arch/frv/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..8c2eb44
--- /dev/null
+++ b/tools/arch/frv/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/h8300/include/uapi/asm/mman-fix.h b/tools/arch/h8300/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..e639fe6
--- /dev/null
+++ b/tools/arch/h8300/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/hexagon/include/uapi/asm/mman-fix.h b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..dda9359
--- /dev/null
+++ b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/ia64/include/uapi/asm/mman-fix.h b/tools/arch/ia64/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..1e98f36
--- /dev/null
+++ b/tools/arch/ia64/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/m32r/include/uapi/asm/mman-fix.h b/tools/arch/m32r/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..74aa94d
--- /dev/null
+++ b/tools/arch/m32r/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/microblaze/include/uapi/asm/mman-fix.h b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..90b7a53
--- /dev/null
+++ b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/mips/include/uapi/asm/mman-fix.h b/tools/arch/mips/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..ef58cd7
--- /dev/null
+++ b/tools/arch/mips/include/uapi/asm/mman-fix.h
@@ -0,0 +1,41 @@
+#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef PROT_SEM
+#define PROT_SEM	0x10
+#endif
+#ifndef MAP_FIXED
+#define MAP_FIXED	0x010
+#endif
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS	0x0800
+#endif
+#ifndef MAP_STACK
+#define MAP_STACK	0x40000
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x80000
+#endif
+#ifndef MADV_HWPOISON
+#define MADV_HWPOISON	 100
+#endif
+#ifndef MADV_MERGEABLE
+#define MADV_MERGEABLE	 12
+#endif
+#ifndef MADV_UNMERGEABLE
+#define MADV_UNMERGEABLE 13
+#endif
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE	14
+#endif
+#ifndef MADV_NOHUGEPAGE
+#define MADV_NOHUGEPAGE 15
+#endif
+#ifndef MADV_DONTDUMP
+#define MADV_DONTDUMP	16
+#endif
+#ifndef MADV_DODUMP
+#define MADV_DODUMP	17
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/mn10300/include/uapi/asm/mman-fix.h b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..86a2903
--- /dev/null
+++ b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/parisc/include/uapi/asm/mman-fix.h b/tools/arch/parisc/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..c157a03
--- /dev/null
+++ b/tools/arch/parisc/include/uapi/asm/mman-fix.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef PROT_SEM
+#define PROT_SEM	0x8
+#endif
+#ifndef MAP_FIXED
+#define MAP_FIXED	0x04
+#endif
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS	0x10
+#endif
+#ifndef MAP_STACK
+#define MAP_STACK	0x40000
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x80000
+#endif
+#ifndef MADV_MERGEABLE
+#define MADV_MERGEABLE   65
+#endif
+#ifndef MADV_UNMERGEABLE
+#define MADV_UNMERGEABLE 66
+#endif
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE	67
+#endif
+#ifndef MADV_NOHUGEPAGE
+#define MADV_NOHUGEPAGE	68
+#endif
+#ifndef MADV_DONTDUMP
+#define MADV_DONTDUMP   69
+#endif
+#ifndef MADV_DODUMP
+#define MADV_DODUMP	70
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/powerpc/include/uapi/asm/mman-fix.h b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..4b552fa
--- /dev/null
+++ b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
@@ -0,0 +1,11 @@
+#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef MAP_STACK
+#define MAP_STACK	0x20000
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x40000
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/s390/include/uapi/asm/mman-fix.h b/tools/arch/s390/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..d7755dd
--- /dev/null
+++ b/tools/arch/s390/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/score/include/uapi/asm/mman-fix.h b/tools/arch/score/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..97ad192
--- /dev/null
+++ b/tools/arch/score/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/sh/include/uapi/asm/mman-fix.h b/tools/arch/sh/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..d17bca8
--- /dev/null
+++ b/tools/arch/sh/include/uapi/asm/mman-fix.h
@@ -0,0 +1,5 @@
+#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/sparc/include/uapi/asm/mman-fix.h b/tools/arch/sparc/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..3ac4ba0
--- /dev/null
+++ b/tools/arch/sparc/include/uapi/asm/mman-fix.h
@@ -0,0 +1,11 @@
+#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef MAP_STACK
+#define MAP_STACK	0x20000
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x40000
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/tile/include/uapi/asm/mman-fix.h b/tools/arch/tile/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..105a3b0e
--- /dev/null
+++ b/tools/arch/tile/include/uapi/asm/mman-fix.h
@@ -0,0 +1,11 @@
+#ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef MAP_STACK
+#define MAP_STACK	MAP_GROWSDOWN
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x4000
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/x86/include/uapi/asm/mman-fix.h b/tools/arch/x86/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..0cda2bf
--- /dev/null
+++ b/tools/arch/x86/include/uapi/asm/mman-fix.h
@@ -0,0 +1,8 @@
+#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef MAP_32BIT
+#define MAP_32BIT	0x40
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/arch/xtensa/include/uapi/asm/mman-fix.h b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
new file mode 100644
index 0000000..9ec9051
--- /dev/null
+++ b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
@@ -0,0 +1,38 @@
+#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
+#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef PROT_SEM
+#define PROT_SEM	0x10
+#endif
+#ifndef MAP_FIXED
+#define MAP_FIXED	0x010
+#endif
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS	0x0800
+#endif
+#ifndef MAP_STACK
+#define MAP_STACK	0x40000
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x80000
+#endif
+#ifndef MADV_MERGEABLE
+#define MADV_MERGEABLE   12
+#endif
+#ifndef MADV_UNMERGEABLE
+#define MADV_UNMERGEABLE 13
+#endif
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE	14
+#endif
+#ifndef MADV_NOHUGEPAGE
+#define MADV_NOHUGEPAGE	15
+#endif
+#ifndef MADV_DONTDUMP
+#define MADV_DONTDUMP   16
+#endif
+#ifndef MADV_DODUMP
+#define MADV_DODUMP	17
+#endif
+#include <asm-generic/mman-fix.h>
+#endif // TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/include/uapi/asm-generic/mman-fix.h b/tools/include/uapi/asm-generic/mman-fix.h
new file mode 100644
index 0000000..f47eb4c
--- /dev/null
+++ b/tools/include/uapi/asm-generic/mman-fix.h
@@ -0,0 +1,46 @@
+#ifndef __TOOLS_UAPI_ASM_MMAN_FIX_H
+#define __TOOLS_UAPI_ASM_MMAN_FIX_H
+#include <sys/mman.h>
+#ifndef PROT_SEM
+#define PROT_SEM	0x8
+#endif
+#ifndef MAP_FIXED
+#define MAP_FIXED	0x10
+#endif
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS	0x20
+#endif
+#ifndef MADV_HWPOISON
+#define MADV_HWPOISON	100
+#endif
+#ifndef MADV_SOFT_OFFLINE
+#define MADV_SOFT_OFFLINE 101
+#endif
+#ifndef MADV_MERGEABLE
+#define MADV_MERGEABLE   12
+#endif
+#ifndef MADV_UNMERGEABLE
+#define MADV_UNMERGEABLE 13
+#endif
+#ifndef MADV_HUGEPAGE
+#define MADV_HUGEPAGE	14
+#endif
+#ifndef MADV_NOHUGEPAGE
+#define MADV_NOHUGEPAGE	15
+#endif
+#ifndef MADV_DONTDUMP
+#define MADV_DONTDUMP   16
+#endif
+#ifndef MADV_DODUMP
+#define MADV_DODUMP	17
+#endif
+#ifndef MAP_STACK
+#define MAP_STACK	0x20000
+#endif
+#ifndef MAP_HUGETLB
+#define MAP_HUGETLB	0x40000
+#endif
+#ifndef MAP_UNINITIALIZED
+#define MAP_UNINITIALIZED 0x4000000
+#endif
+#endif // __TOOLS_UAPI_ASM_MMAN_FIX_H
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index ff200c6..56ac24f 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -66,6 +66,7 @@ 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-fix.h
 tools/include/uapi/linux/bpf.h
 tools/include/uapi/linux/bpf_common.h
 tools/include/uapi/linux/hw_breakpoint.h
@@ -80,3 +81,4 @@ tools/include/linux/err.h
 tools/include/linux/bitmap.h
 tools/include/linux/time64.h
 tools/arch/*/include/uapi/asm/perf_regs.h
+tools/arch/*/include/uapi/asm/mman-fix.h
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] perf tools: Fix mman macros using mman-fix.h
  2016-09-06  5:48 [PATCH 0/2] Fix mman macros using mman-fix.h Wang Nan
  2016-09-06  5:48 ` [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h Wang Nan
@ 2016-09-06  5:48 ` Wang Nan
  1 sibling, 0 replies; 8+ messages in thread
From: Wang Nan @ 2016-09-06  5:48 UTC (permalink / raw)
  To: acme
  Cc: nilayvaish, linux-kernel, lizefan, Wang Nan, Hou Pengyang,
	He Kuang, Arnaldo Carvalho de Melo

Use mman-fix.h to fix potential undefined macros in mman.h for
building perf in old systems.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Hou Pengyang <houpengyang@huawei.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/trace/beauty/mmap.c | 63 +-----------------------------------------
 tools/perf/util/event.c        |  5 +---
 tools/perf/util/map.c          |  3 +-
 3 files changed, 3 insertions(+), 68 deletions(-)

diff --git a/tools/perf/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c
index d0a3a8e..c96b3e2 100644
--- a/tools/perf/trace/beauty/mmap.c
+++ b/tools/perf/trace/beauty/mmap.c
@@ -1,8 +1,5 @@
 #include <sys/mman.h>
-
-#ifndef PROT_SEM
-#define PROT_SEM 0x8
-#endif
+#include <asm/mman-fix.h>
 
 static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
 					       struct syscall_arg *arg)
@@ -33,31 +30,6 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
 
 #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot
 
-#ifndef MAP_FIXED
-#define MAP_FIXED		     0x10
-#endif
-
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS		     0x20
-#endif
-
-#ifndef MAP_32BIT
-#define MAP_32BIT		     0x40
-#endif
-
-#ifndef MAP_STACK
-#define MAP_STACK		  0x20000
-#endif
-
-#ifndef MAP_HUGETLB
-#define MAP_HUGETLB		  0x40000
-#endif
-
-#ifndef MAP_UNINITIALIZED
-#define MAP_UNINITIALIZED	0x4000000
-#endif
-
-
 static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
 						struct syscall_arg *arg)
 {
@@ -125,39 +97,6 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size,
 
 #define SCA_MREMAP_FLAGS syscall_arg__scnprintf_mremap_flags
 
-#ifndef MADV_HWPOISON
-#define MADV_HWPOISON		100
-#endif
-
-#ifndef MADV_SOFT_OFFLINE
-#define MADV_SOFT_OFFLINE	101
-#endif
-
-#ifndef MADV_MERGEABLE
-#define MADV_MERGEABLE		 12
-#endif
-
-#ifndef MADV_UNMERGEABLE
-#define MADV_UNMERGEABLE	 13
-#endif
-
-#ifndef MADV_HUGEPAGE
-#define MADV_HUGEPAGE		 14
-#endif
-
-#ifndef MADV_NOHUGEPAGE
-#define MADV_NOHUGEPAGE		 15
-#endif
-
-#ifndef MADV_DONTDUMP
-#define MADV_DONTDUMP		 16
-#endif
-
-#ifndef MADV_DODUMP
-#define MADV_DODUMP		 17
-#endif
-
-
 static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
 						      struct syscall_arg *arg)
 {
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 23c3ebd..df85931 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,5 +1,6 @@
 #include <linux/types.h>
 #include <sys/mman.h>
+#include <asm/mman-fix.h>
 #include <api/fs/fs.h>
 #include "event.h"
 #include "debug.h"
@@ -249,10 +250,8 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
 	bool truncation = false;
 	unsigned long long timeout = proc_map_timeout * 1000000ULL;
 	int rc = 0;
-#ifdef MAP_HUGETLB
 	const char *hugetlbfs_mnt = hugetlbfs__mountpoint();
 	int hugetlbfs_mnt_len = hugetlbfs_mnt ? strlen(hugetlbfs_mnt) : 0;
-#endif
 
 	if (machine__is_default_guest(machine))
 		return 0;
@@ -347,12 +346,10 @@ out:
 
 		if (!strcmp(execname, ""))
 			strcpy(execname, anonstr);
-#ifdef MAP_HUGETLB
 		if (!strncmp(execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) {
 			strcpy(execname, anonstr);
 			event->mmap2.flags |= MAP_HUGETLB;
 		}
-#endif
 
 		size = strlen(execname) + 1;
 		memcpy(event->mmap2.filename, execname, size);
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index f52d460..76c68853 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -7,6 +7,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <asm/mman-fix.h>
 #include "map.h"
 #include "thread.h"
 #include "strlist.h"
@@ -29,9 +30,7 @@ static inline int is_anon_memory(const char *filename, u32 flags)
 {
 	u32 anon_flags = 0;
 
-#ifdef MAP_HUGETLB
 	anon_flags |= MAP_HUGETLB;
-#endif
 	return flags & anon_flags ||
 	       !strcmp(filename, "//anon") ||
 	       !strncmp(filename, "/dev/zero", sizeof("/dev/zero") - 1) ||
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h
  2016-09-06  5:48 ` [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h Wang Nan
@ 2016-09-06 12:59   ` Arnaldo Carvalho de Melo
  2016-09-06 13:25     ` Wangnan (F)
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-06 12:59 UTC (permalink / raw)
  To: Wang Nan
  Cc: nilayvaish, linux-kernel, lizefan, Hou Pengyang, He Kuang,
	Arnaldo Carvalho de Melo

Em Tue, Sep 06, 2016 at 05:48:51AM +0000, Wang Nan escreveu:
> tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
> tools/perf/util/map.c depend on several macros in mman.h, which
> are lost on old systems like ubuntu 12.04. They are architecture

Not "lost on old systems", changing that to "not present on old systems"

> dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
> into tools/ is not easy because mman.h for some unusual archs
> (like tile) have extra dependencies.

> This patch introduces only required macros into mman-fix.h.
> Macros list is gotten from tools/perf/trace/beauty/mmap.c.

ok, I'll try keeping the  include/uapi/asm-generic/mman.h and
arch/alpha/include/uapi/asm/mman.h with just what you added, so that at
least the .c files appears as using the headers were those things are
defined in the kernel sources.

Ah, and good eyes in realizing this is not the same value for all
arches!

- Arnaldo
 
> This patch is gnerated using following bash script:
> 
>  #!/bin/bash
> 
>  function begin_mman_fix_header()
>  {
>    echo "#ifndef $1" >  $2
>    echo "#define $1" >> $2
>    echo "#include <sys/mman.h>" >> $2
>  }
> 
>  function finish_mman_fix_header()
>  {
>    echo "#endif // $1" >> $2
>    echo "Finish writing $2"
>  }
> 
>  function build_mman_fix_header()
>  {
>    guard=$1
>    shift
>    target=$1
>    shift
>    begin_mman_fix_header $guard $target
>    for src in $@
>    do
>      if [ -f $src ]
>      then
>        for macro in $macros
>        do
>          if grep '#define[ \t]*'$macro $src > /dev/null 2>&1
>          then
>            echo "#ifndef $macro" >> $target
>            grep '#define[ \t]*'$macro $src | sed 's/[ \t]*\/\*.*$//g' >> $target
>            echo "#endif" >> $target
>          fi
>        done
>      fi
>    done
>  }
> 
>  macros=`grep ifndef tools/perf/trace/beauty/mmap.c | awk '{print $2}'`
> 
>  baseheader=tools/include/uapi/asm-generic/mman-fix.h
>  build_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader include/uapi/asm-generic/mman*
>  echo "#ifndef MAP_UNINITIALIZED" >> $baseheader
>  echo "#define MAP_UNINITIALIZED 0x4000000" >> $baseheader
>  echo "#endif" >> $baseheader
>  finish_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader
> 
>  archs=`ls tools/arch`
>  for arch in $archs
>  do
>    archheader=tools/arch/$arch/include/uapi/asm/mman-fix.h
>    if [ ! -d tools/arch/$arch/include/uapi/asm ]
>    then
>      mkdir -p tools/arch/$arch/include/uapi/asm
>    fi
>    uppercase=`echo $arch | awk '{print toupper($0)}'`
>    build_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader arch/$arch/include/uapi/asm/mman.h
>    echo "#include <asm-generic/mman-fix.h>" >> $archheader
>    finish_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader
>  done
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Cc: Nilay Vaish <nilayvaish@gmail.com>
> Cc: Hou Pengyang <houpengyang@huawei.com>
> Cc: He Kuang <hekuang@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/arch/alpha/include/uapi/asm/mman-fix.h      | 38 +++++++++++++++++++
>  tools/arch/arm/include/uapi/asm/mman-fix.h        |  5 +++
>  tools/arch/arm64/include/uapi/asm/mman-fix.h      |  5 +++
>  tools/arch/frv/include/uapi/asm/mman-fix.h        |  5 +++
>  tools/arch/h8300/include/uapi/asm/mman-fix.h      |  5 +++
>  tools/arch/hexagon/include/uapi/asm/mman-fix.h    |  5 +++
>  tools/arch/ia64/include/uapi/asm/mman-fix.h       |  5 +++
>  tools/arch/m32r/include/uapi/asm/mman-fix.h       |  5 +++
>  tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 +++
>  tools/arch/mips/include/uapi/asm/mman-fix.h       | 41 ++++++++++++++++++++
>  tools/arch/mn10300/include/uapi/asm/mman-fix.h    |  5 +++
>  tools/arch/parisc/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
>  tools/arch/powerpc/include/uapi/asm/mman-fix.h    | 11 ++++++
>  tools/arch/s390/include/uapi/asm/mman-fix.h       |  5 +++
>  tools/arch/score/include/uapi/asm/mman-fix.h      |  5 +++
>  tools/arch/sh/include/uapi/asm/mman-fix.h         |  5 +++
>  tools/arch/sparc/include/uapi/asm/mman-fix.h      | 11 ++++++
>  tools/arch/tile/include/uapi/asm/mman-fix.h       | 11 ++++++
>  tools/arch/x86/include/uapi/asm/mman-fix.h        |  8 ++++
>  tools/arch/xtensa/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
>  tools/include/uapi/asm-generic/mman-fix.h         | 46 +++++++++++++++++++++++
>  tools/perf/MANIFEST                               |  2 +
>  22 files changed, 304 insertions(+)
>  create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/arch/xtensa/include/uapi/asm/mman-fix.h
>  create mode 100644 tools/include/uapi/asm-generic/mman-fix.h
> 
> diff --git a/tools/arch/alpha/include/uapi/asm/mman-fix.h b/tools/arch/alpha/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..f807a71
> --- /dev/null
> +++ b/tools/arch/alpha/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,38 @@
> +#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef PROT_SEM
> +#define PROT_SEM	0x8
> +#endif
> +#ifndef MAP_FIXED
> +#define MAP_FIXED	0x100
> +#endif
> +#ifndef MAP_ANONYMOUS
> +#define MAP_ANONYMOUS	0x10
> +#endif
> +#ifndef MAP_STACK
> +#define MAP_STACK	0x80000
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x100000
> +#endif
> +#ifndef MADV_MERGEABLE
> +#define MADV_MERGEABLE   12
> +#endif
> +#ifndef MADV_UNMERGEABLE
> +#define MADV_UNMERGEABLE 13
> +#endif
> +#ifndef MADV_HUGEPAGE
> +#define MADV_HUGEPAGE	14
> +#endif
> +#ifndef MADV_NOHUGEPAGE
> +#define MADV_NOHUGEPAGE	15
> +#endif
> +#ifndef MADV_DONTDUMP
> +#define MADV_DONTDUMP   16
> +#endif
> +#ifndef MADV_DODUMP
> +#define MADV_DODUMP	17
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/arm/include/uapi/asm/mman-fix.h b/tools/arch/arm/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..a29dae1
> --- /dev/null
> +++ b/tools/arch/arm/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/arm64/include/uapi/asm/mman-fix.h b/tools/arch/arm64/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..e50c0d1
> --- /dev/null
> +++ b/tools/arch/arm64/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/frv/include/uapi/asm/mman-fix.h b/tools/arch/frv/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..8c2eb44
> --- /dev/null
> +++ b/tools/arch/frv/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/h8300/include/uapi/asm/mman-fix.h b/tools/arch/h8300/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..e639fe6
> --- /dev/null
> +++ b/tools/arch/h8300/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/hexagon/include/uapi/asm/mman-fix.h b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..dda9359
> --- /dev/null
> +++ b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/ia64/include/uapi/asm/mman-fix.h b/tools/arch/ia64/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..1e98f36
> --- /dev/null
> +++ b/tools/arch/ia64/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/m32r/include/uapi/asm/mman-fix.h b/tools/arch/m32r/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..74aa94d
> --- /dev/null
> +++ b/tools/arch/m32r/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/microblaze/include/uapi/asm/mman-fix.h b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..90b7a53
> --- /dev/null
> +++ b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/mips/include/uapi/asm/mman-fix.h b/tools/arch/mips/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..ef58cd7
> --- /dev/null
> +++ b/tools/arch/mips/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,41 @@
> +#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef PROT_SEM
> +#define PROT_SEM	0x10
> +#endif
> +#ifndef MAP_FIXED
> +#define MAP_FIXED	0x010
> +#endif
> +#ifndef MAP_ANONYMOUS
> +#define MAP_ANONYMOUS	0x0800
> +#endif
> +#ifndef MAP_STACK
> +#define MAP_STACK	0x40000
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x80000
> +#endif
> +#ifndef MADV_HWPOISON
> +#define MADV_HWPOISON	 100
> +#endif
> +#ifndef MADV_MERGEABLE
> +#define MADV_MERGEABLE	 12
> +#endif
> +#ifndef MADV_UNMERGEABLE
> +#define MADV_UNMERGEABLE 13
> +#endif
> +#ifndef MADV_HUGEPAGE
> +#define MADV_HUGEPAGE	14
> +#endif
> +#ifndef MADV_NOHUGEPAGE
> +#define MADV_NOHUGEPAGE 15
> +#endif
> +#ifndef MADV_DONTDUMP
> +#define MADV_DONTDUMP	16
> +#endif
> +#ifndef MADV_DODUMP
> +#define MADV_DODUMP	17
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/mn10300/include/uapi/asm/mman-fix.h b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..86a2903
> --- /dev/null
> +++ b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/parisc/include/uapi/asm/mman-fix.h b/tools/arch/parisc/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..c157a03
> --- /dev/null
> +++ b/tools/arch/parisc/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,38 @@
> +#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef PROT_SEM
> +#define PROT_SEM	0x8
> +#endif
> +#ifndef MAP_FIXED
> +#define MAP_FIXED	0x04
> +#endif
> +#ifndef MAP_ANONYMOUS
> +#define MAP_ANONYMOUS	0x10
> +#endif
> +#ifndef MAP_STACK
> +#define MAP_STACK	0x40000
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x80000
> +#endif
> +#ifndef MADV_MERGEABLE
> +#define MADV_MERGEABLE   65
> +#endif
> +#ifndef MADV_UNMERGEABLE
> +#define MADV_UNMERGEABLE 66
> +#endif
> +#ifndef MADV_HUGEPAGE
> +#define MADV_HUGEPAGE	67
> +#endif
> +#ifndef MADV_NOHUGEPAGE
> +#define MADV_NOHUGEPAGE	68
> +#endif
> +#ifndef MADV_DONTDUMP
> +#define MADV_DONTDUMP   69
> +#endif
> +#ifndef MADV_DODUMP
> +#define MADV_DODUMP	70
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/powerpc/include/uapi/asm/mman-fix.h b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..4b552fa
> --- /dev/null
> +++ b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,11 @@
> +#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef MAP_STACK
> +#define MAP_STACK	0x20000
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x40000
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/s390/include/uapi/asm/mman-fix.h b/tools/arch/s390/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..d7755dd
> --- /dev/null
> +++ b/tools/arch/s390/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/score/include/uapi/asm/mman-fix.h b/tools/arch/score/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..97ad192
> --- /dev/null
> +++ b/tools/arch/score/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/sh/include/uapi/asm/mman-fix.h b/tools/arch/sh/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..d17bca8
> --- /dev/null
> +++ b/tools/arch/sh/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,5 @@
> +#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/sparc/include/uapi/asm/mman-fix.h b/tools/arch/sparc/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..3ac4ba0
> --- /dev/null
> +++ b/tools/arch/sparc/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,11 @@
> +#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef MAP_STACK
> +#define MAP_STACK	0x20000
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x40000
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/tile/include/uapi/asm/mman-fix.h b/tools/arch/tile/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..105a3b0e
> --- /dev/null
> +++ b/tools/arch/tile/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,11 @@
> +#ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef MAP_STACK
> +#define MAP_STACK	MAP_GROWSDOWN
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x4000
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/x86/include/uapi/asm/mman-fix.h b/tools/arch/x86/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..0cda2bf
> --- /dev/null
> +++ b/tools/arch/x86/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,8 @@
> +#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef MAP_32BIT
> +#define MAP_32BIT	0x40
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/arch/xtensa/include/uapi/asm/mman-fix.h b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
> new file mode 100644
> index 0000000..9ec9051
> --- /dev/null
> +++ b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
> @@ -0,0 +1,38 @@
> +#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> +#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef PROT_SEM
> +#define PROT_SEM	0x10
> +#endif
> +#ifndef MAP_FIXED
> +#define MAP_FIXED	0x010
> +#endif
> +#ifndef MAP_ANONYMOUS
> +#define MAP_ANONYMOUS	0x0800
> +#endif
> +#ifndef MAP_STACK
> +#define MAP_STACK	0x40000
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x80000
> +#endif
> +#ifndef MADV_MERGEABLE
> +#define MADV_MERGEABLE   12
> +#endif
> +#ifndef MADV_UNMERGEABLE
> +#define MADV_UNMERGEABLE 13
> +#endif
> +#ifndef MADV_HUGEPAGE
> +#define MADV_HUGEPAGE	14
> +#endif
> +#ifndef MADV_NOHUGEPAGE
> +#define MADV_NOHUGEPAGE	15
> +#endif
> +#ifndef MADV_DONTDUMP
> +#define MADV_DONTDUMP   16
> +#endif
> +#ifndef MADV_DODUMP
> +#define MADV_DODUMP	17
> +#endif
> +#include <asm-generic/mman-fix.h>
> +#endif // TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/include/uapi/asm-generic/mman-fix.h b/tools/include/uapi/asm-generic/mman-fix.h
> new file mode 100644
> index 0000000..f47eb4c
> --- /dev/null
> +++ b/tools/include/uapi/asm-generic/mman-fix.h
> @@ -0,0 +1,46 @@
> +#ifndef __TOOLS_UAPI_ASM_MMAN_FIX_H
> +#define __TOOLS_UAPI_ASM_MMAN_FIX_H
> +#include <sys/mman.h>
> +#ifndef PROT_SEM
> +#define PROT_SEM	0x8
> +#endif
> +#ifndef MAP_FIXED
> +#define MAP_FIXED	0x10
> +#endif
> +#ifndef MAP_ANONYMOUS
> +#define MAP_ANONYMOUS	0x20
> +#endif
> +#ifndef MADV_HWPOISON
> +#define MADV_HWPOISON	100
> +#endif
> +#ifndef MADV_SOFT_OFFLINE
> +#define MADV_SOFT_OFFLINE 101
> +#endif
> +#ifndef MADV_MERGEABLE
> +#define MADV_MERGEABLE   12
> +#endif
> +#ifndef MADV_UNMERGEABLE
> +#define MADV_UNMERGEABLE 13
> +#endif
> +#ifndef MADV_HUGEPAGE
> +#define MADV_HUGEPAGE	14
> +#endif
> +#ifndef MADV_NOHUGEPAGE
> +#define MADV_NOHUGEPAGE	15
> +#endif
> +#ifndef MADV_DONTDUMP
> +#define MADV_DONTDUMP   16
> +#endif
> +#ifndef MADV_DODUMP
> +#define MADV_DODUMP	17
> +#endif
> +#ifndef MAP_STACK
> +#define MAP_STACK	0x20000
> +#endif
> +#ifndef MAP_HUGETLB
> +#define MAP_HUGETLB	0x40000
> +#endif
> +#ifndef MAP_UNINITIALIZED
> +#define MAP_UNINITIALIZED 0x4000000
> +#endif
> +#endif // __TOOLS_UAPI_ASM_MMAN_FIX_H
> diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
> index ff200c6..56ac24f 100644
> --- a/tools/perf/MANIFEST
> +++ b/tools/perf/MANIFEST
> @@ -66,6 +66,7 @@ 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-fix.h
>  tools/include/uapi/linux/bpf.h
>  tools/include/uapi/linux/bpf_common.h
>  tools/include/uapi/linux/hw_breakpoint.h
> @@ -80,3 +81,4 @@ tools/include/linux/err.h
>  tools/include/linux/bitmap.h
>  tools/include/linux/time64.h
>  tools/arch/*/include/uapi/asm/perf_regs.h
> +tools/arch/*/include/uapi/asm/mman-fix.h
> -- 
> 1.8.3.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h
  2016-09-06 12:59   ` Arnaldo Carvalho de Melo
@ 2016-09-06 13:25     ` Wangnan (F)
  2016-09-06 13:39       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Wangnan (F) @ 2016-09-06 13:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: nilayvaish, linux-kernel, lizefan, Hou Pengyang, He Kuang,
	Arnaldo Carvalho de Melo



On 2016/9/6 20:59, Arnaldo Carvalho de Melo wrote:
> Em Tue, Sep 06, 2016 at 05:48:51AM +0000, Wang Nan escreveu:
>> tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
>> tools/perf/util/map.c depend on several macros in mman.h, which
>> are lost on old systems like ubuntu 12.04. They are architecture
> Not "lost on old systems", changing that to "not present on old systems"
>
>> dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
>> into tools/ is not easy because mman.h for some unusual archs
>> (like tile) have extra dependencies.
>> This patch introduces only required macros into mman-fix.h.
>> Macros list is gotten from tools/perf/trace/beauty/mmap.c.
> ok, I'll try keeping the  include/uapi/asm-generic/mman.h and
> arch/alpha/include/uapi/asm/mman.h with just what you added, so that at
> least the .c files appears as using the headers were those things are
> defined in the kernel sources.
>
> Ah, and good eyes in realizing this is not the same value for all
> arches!

This is why we have to define these macros for each archs.
Your solution in tools/perf/trace/beauty/mmap.c works for
x86 only.

However, I don't like this patchset because we add 300+
lines of code and 22 new files for less than 15 macros,
and only one of them I really concern. Moreover, futhre
code require more symbols in uapi and we have to add new
headers, finally we will clone the whole uapi. We have
to stop doing this...

For the hugetlb problem, I think you can take the v2 patch
without this 2 patches:

http://lkml.kernel.org/r/1473137909-142064-1-git-send-email-wangnan0@huawei.com

so old system can compile without hugetlb support.

This is the reason why I separated into 2 patch series.

Thank you.

> - Arnaldo
>   
>> This patch is gnerated using following bash script:
>>
>>   #!/bin/bash
>>
>>   function begin_mman_fix_header()
>>   {
>>     echo "#ifndef $1" >  $2
>>     echo "#define $1" >> $2
>>     echo "#include <sys/mman.h>" >> $2
>>   }
>>
>>   function finish_mman_fix_header()
>>   {
>>     echo "#endif // $1" >> $2
>>     echo "Finish writing $2"
>>   }
>>
>>   function build_mman_fix_header()
>>   {
>>     guard=$1
>>     shift
>>     target=$1
>>     shift
>>     begin_mman_fix_header $guard $target
>>     for src in $@
>>     do
>>       if [ -f $src ]
>>       then
>>         for macro in $macros
>>         do
>>           if grep '#define[ \t]*'$macro $src > /dev/null 2>&1
>>           then
>>             echo "#ifndef $macro" >> $target
>>             grep '#define[ \t]*'$macro $src | sed 's/[ \t]*\/\*.*$//g' >> $target
>>             echo "#endif" >> $target
>>           fi
>>         done
>>       fi
>>     done
>>   }
>>
>>   macros=`grep ifndef tools/perf/trace/beauty/mmap.c | awk '{print $2}'`
>>
>>   baseheader=tools/include/uapi/asm-generic/mman-fix.h
>>   build_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader include/uapi/asm-generic/mman*
>>   echo "#ifndef MAP_UNINITIALIZED" >> $baseheader
>>   echo "#define MAP_UNINITIALIZED 0x4000000" >> $baseheader
>>   echo "#endif" >> $baseheader
>>   finish_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader
>>
>>   archs=`ls tools/arch`
>>   for arch in $archs
>>   do
>>     archheader=tools/arch/$arch/include/uapi/asm/mman-fix.h
>>     if [ ! -d tools/arch/$arch/include/uapi/asm ]
>>     then
>>       mkdir -p tools/arch/$arch/include/uapi/asm
>>     fi
>>     uppercase=`echo $arch | awk '{print toupper($0)}'`
>>     build_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader arch/$arch/include/uapi/asm/mman.h
>>     echo "#include <asm-generic/mman-fix.h>" >> $archheader
>>     finish_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader
>>   done
>>
>> Signed-off-by: Wang Nan <wangnan0@huawei.com>
>> Cc: Nilay Vaish <nilayvaish@gmail.com>
>> Cc: Hou Pengyang <houpengyang@huawei.com>
>> Cc: He Kuang <hekuang@huawei.com>
>> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
>> ---
>>   tools/arch/alpha/include/uapi/asm/mman-fix.h      | 38 +++++++++++++++++++
>>   tools/arch/arm/include/uapi/asm/mman-fix.h        |  5 +++
>>   tools/arch/arm64/include/uapi/asm/mman-fix.h      |  5 +++
>>   tools/arch/frv/include/uapi/asm/mman-fix.h        |  5 +++
>>   tools/arch/h8300/include/uapi/asm/mman-fix.h      |  5 +++
>>   tools/arch/hexagon/include/uapi/asm/mman-fix.h    |  5 +++
>>   tools/arch/ia64/include/uapi/asm/mman-fix.h       |  5 +++
>>   tools/arch/m32r/include/uapi/asm/mman-fix.h       |  5 +++
>>   tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 +++
>>   tools/arch/mips/include/uapi/asm/mman-fix.h       | 41 ++++++++++++++++++++
>>   tools/arch/mn10300/include/uapi/asm/mman-fix.h    |  5 +++
>>   tools/arch/parisc/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
>>   tools/arch/powerpc/include/uapi/asm/mman-fix.h    | 11 ++++++
>>   tools/arch/s390/include/uapi/asm/mman-fix.h       |  5 +++
>>   tools/arch/score/include/uapi/asm/mman-fix.h      |  5 +++
>>   tools/arch/sh/include/uapi/asm/mman-fix.h         |  5 +++
>>   tools/arch/sparc/include/uapi/asm/mman-fix.h      | 11 ++++++
>>   tools/arch/tile/include/uapi/asm/mman-fix.h       | 11 ++++++
>>   tools/arch/x86/include/uapi/asm/mman-fix.h        |  8 ++++
>>   tools/arch/xtensa/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
>>   tools/include/uapi/asm-generic/mman-fix.h         | 46 +++++++++++++++++++++++
>>   tools/perf/MANIFEST                               |  2 +
>>   22 files changed, 304 insertions(+)
>>   create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/arch/xtensa/include/uapi/asm/mman-fix.h
>>   create mode 100644 tools/include/uapi/asm-generic/mman-fix.h
>>
>> diff --git a/tools/arch/alpha/include/uapi/asm/mman-fix.h b/tools/arch/alpha/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..f807a71
>> --- /dev/null
>> +++ b/tools/arch/alpha/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,38 @@
>> +#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef PROT_SEM
>> +#define PROT_SEM	0x8
>> +#endif
>> +#ifndef MAP_FIXED
>> +#define MAP_FIXED	0x100
>> +#endif
>> +#ifndef MAP_ANONYMOUS
>> +#define MAP_ANONYMOUS	0x10
>> +#endif
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	0x80000
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x100000
>> +#endif
>> +#ifndef MADV_MERGEABLE
>> +#define MADV_MERGEABLE   12
>> +#endif
>> +#ifndef MADV_UNMERGEABLE
>> +#define MADV_UNMERGEABLE 13
>> +#endif
>> +#ifndef MADV_HUGEPAGE
>> +#define MADV_HUGEPAGE	14
>> +#endif
>> +#ifndef MADV_NOHUGEPAGE
>> +#define MADV_NOHUGEPAGE	15
>> +#endif
>> +#ifndef MADV_DONTDUMP
>> +#define MADV_DONTDUMP   16
>> +#endif
>> +#ifndef MADV_DODUMP
>> +#define MADV_DODUMP	17
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/arm/include/uapi/asm/mman-fix.h b/tools/arch/arm/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..a29dae1
>> --- /dev/null
>> +++ b/tools/arch/arm/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/arm64/include/uapi/asm/mman-fix.h b/tools/arch/arm64/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..e50c0d1
>> --- /dev/null
>> +++ b/tools/arch/arm64/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/frv/include/uapi/asm/mman-fix.h b/tools/arch/frv/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..8c2eb44
>> --- /dev/null
>> +++ b/tools/arch/frv/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/h8300/include/uapi/asm/mman-fix.h b/tools/arch/h8300/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..e639fe6
>> --- /dev/null
>> +++ b/tools/arch/h8300/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/hexagon/include/uapi/asm/mman-fix.h b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..dda9359
>> --- /dev/null
>> +++ b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/ia64/include/uapi/asm/mman-fix.h b/tools/arch/ia64/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..1e98f36
>> --- /dev/null
>> +++ b/tools/arch/ia64/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/m32r/include/uapi/asm/mman-fix.h b/tools/arch/m32r/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..74aa94d
>> --- /dev/null
>> +++ b/tools/arch/m32r/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/microblaze/include/uapi/asm/mman-fix.h b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..90b7a53
>> --- /dev/null
>> +++ b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/mips/include/uapi/asm/mman-fix.h b/tools/arch/mips/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..ef58cd7
>> --- /dev/null
>> +++ b/tools/arch/mips/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,41 @@
>> +#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef PROT_SEM
>> +#define PROT_SEM	0x10
>> +#endif
>> +#ifndef MAP_FIXED
>> +#define MAP_FIXED	0x010
>> +#endif
>> +#ifndef MAP_ANONYMOUS
>> +#define MAP_ANONYMOUS	0x0800
>> +#endif
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	0x40000
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x80000
>> +#endif
>> +#ifndef MADV_HWPOISON
>> +#define MADV_HWPOISON	 100
>> +#endif
>> +#ifndef MADV_MERGEABLE
>> +#define MADV_MERGEABLE	 12
>> +#endif
>> +#ifndef MADV_UNMERGEABLE
>> +#define MADV_UNMERGEABLE 13
>> +#endif
>> +#ifndef MADV_HUGEPAGE
>> +#define MADV_HUGEPAGE	14
>> +#endif
>> +#ifndef MADV_NOHUGEPAGE
>> +#define MADV_NOHUGEPAGE 15
>> +#endif
>> +#ifndef MADV_DONTDUMP
>> +#define MADV_DONTDUMP	16
>> +#endif
>> +#ifndef MADV_DODUMP
>> +#define MADV_DODUMP	17
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/mn10300/include/uapi/asm/mman-fix.h b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..86a2903
>> --- /dev/null
>> +++ b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/parisc/include/uapi/asm/mman-fix.h b/tools/arch/parisc/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..c157a03
>> --- /dev/null
>> +++ b/tools/arch/parisc/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,38 @@
>> +#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef PROT_SEM
>> +#define PROT_SEM	0x8
>> +#endif
>> +#ifndef MAP_FIXED
>> +#define MAP_FIXED	0x04
>> +#endif
>> +#ifndef MAP_ANONYMOUS
>> +#define MAP_ANONYMOUS	0x10
>> +#endif
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	0x40000
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x80000
>> +#endif
>> +#ifndef MADV_MERGEABLE
>> +#define MADV_MERGEABLE   65
>> +#endif
>> +#ifndef MADV_UNMERGEABLE
>> +#define MADV_UNMERGEABLE 66
>> +#endif
>> +#ifndef MADV_HUGEPAGE
>> +#define MADV_HUGEPAGE	67
>> +#endif
>> +#ifndef MADV_NOHUGEPAGE
>> +#define MADV_NOHUGEPAGE	68
>> +#endif
>> +#ifndef MADV_DONTDUMP
>> +#define MADV_DONTDUMP   69
>> +#endif
>> +#ifndef MADV_DODUMP
>> +#define MADV_DODUMP	70
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/powerpc/include/uapi/asm/mman-fix.h b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..4b552fa
>> --- /dev/null
>> +++ b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,11 @@
>> +#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	0x20000
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x40000
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/s390/include/uapi/asm/mman-fix.h b/tools/arch/s390/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..d7755dd
>> --- /dev/null
>> +++ b/tools/arch/s390/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/score/include/uapi/asm/mman-fix.h b/tools/arch/score/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..97ad192
>> --- /dev/null
>> +++ b/tools/arch/score/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/sh/include/uapi/asm/mman-fix.h b/tools/arch/sh/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..d17bca8
>> --- /dev/null
>> +++ b/tools/arch/sh/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,5 @@
>> +#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/sparc/include/uapi/asm/mman-fix.h b/tools/arch/sparc/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..3ac4ba0
>> --- /dev/null
>> +++ b/tools/arch/sparc/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,11 @@
>> +#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	0x20000
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x40000
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/tile/include/uapi/asm/mman-fix.h b/tools/arch/tile/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..105a3b0e
>> --- /dev/null
>> +++ b/tools/arch/tile/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,11 @@
>> +#ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	MAP_GROWSDOWN
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x4000
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/x86/include/uapi/asm/mman-fix.h b/tools/arch/x86/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..0cda2bf
>> --- /dev/null
>> +++ b/tools/arch/x86/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,8 @@
>> +#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef MAP_32BIT
>> +#define MAP_32BIT	0x40
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/arch/xtensa/include/uapi/asm/mman-fix.h b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
>> new file mode 100644
>> index 0000000..9ec9051
>> --- /dev/null
>> +++ b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
>> @@ -0,0 +1,38 @@
>> +#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
>> +#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef PROT_SEM
>> +#define PROT_SEM	0x10
>> +#endif
>> +#ifndef MAP_FIXED
>> +#define MAP_FIXED	0x010
>> +#endif
>> +#ifndef MAP_ANONYMOUS
>> +#define MAP_ANONYMOUS	0x0800
>> +#endif
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	0x40000
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x80000
>> +#endif
>> +#ifndef MADV_MERGEABLE
>> +#define MADV_MERGEABLE   12
>> +#endif
>> +#ifndef MADV_UNMERGEABLE
>> +#define MADV_UNMERGEABLE 13
>> +#endif
>> +#ifndef MADV_HUGEPAGE
>> +#define MADV_HUGEPAGE	14
>> +#endif
>> +#ifndef MADV_NOHUGEPAGE
>> +#define MADV_NOHUGEPAGE	15
>> +#endif
>> +#ifndef MADV_DONTDUMP
>> +#define MADV_DONTDUMP   16
>> +#endif
>> +#ifndef MADV_DODUMP
>> +#define MADV_DODUMP	17
>> +#endif
>> +#include <asm-generic/mman-fix.h>
>> +#endif // TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/include/uapi/asm-generic/mman-fix.h b/tools/include/uapi/asm-generic/mman-fix.h
>> new file mode 100644
>> index 0000000..f47eb4c
>> --- /dev/null
>> +++ b/tools/include/uapi/asm-generic/mman-fix.h
>> @@ -0,0 +1,46 @@
>> +#ifndef __TOOLS_UAPI_ASM_MMAN_FIX_H
>> +#define __TOOLS_UAPI_ASM_MMAN_FIX_H
>> +#include <sys/mman.h>
>> +#ifndef PROT_SEM
>> +#define PROT_SEM	0x8
>> +#endif
>> +#ifndef MAP_FIXED
>> +#define MAP_FIXED	0x10
>> +#endif
>> +#ifndef MAP_ANONYMOUS
>> +#define MAP_ANONYMOUS	0x20
>> +#endif
>> +#ifndef MADV_HWPOISON
>> +#define MADV_HWPOISON	100
>> +#endif
>> +#ifndef MADV_SOFT_OFFLINE
>> +#define MADV_SOFT_OFFLINE 101
>> +#endif
>> +#ifndef MADV_MERGEABLE
>> +#define MADV_MERGEABLE   12
>> +#endif
>> +#ifndef MADV_UNMERGEABLE
>> +#define MADV_UNMERGEABLE 13
>> +#endif
>> +#ifndef MADV_HUGEPAGE
>> +#define MADV_HUGEPAGE	14
>> +#endif
>> +#ifndef MADV_NOHUGEPAGE
>> +#define MADV_NOHUGEPAGE	15
>> +#endif
>> +#ifndef MADV_DONTDUMP
>> +#define MADV_DONTDUMP   16
>> +#endif
>> +#ifndef MADV_DODUMP
>> +#define MADV_DODUMP	17
>> +#endif
>> +#ifndef MAP_STACK
>> +#define MAP_STACK	0x20000
>> +#endif
>> +#ifndef MAP_HUGETLB
>> +#define MAP_HUGETLB	0x40000
>> +#endif
>> +#ifndef MAP_UNINITIALIZED
>> +#define MAP_UNINITIALIZED 0x4000000
>> +#endif
>> +#endif // __TOOLS_UAPI_ASM_MMAN_FIX_H
>> diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
>> index ff200c6..56ac24f 100644
>> --- a/tools/perf/MANIFEST
>> +++ b/tools/perf/MANIFEST
>> @@ -66,6 +66,7 @@ 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-fix.h
>>   tools/include/uapi/linux/bpf.h
>>   tools/include/uapi/linux/bpf_common.h
>>   tools/include/uapi/linux/hw_breakpoint.h
>> @@ -80,3 +81,4 @@ tools/include/linux/err.h
>>   tools/include/linux/bitmap.h
>>   tools/include/linux/time64.h
>>   tools/arch/*/include/uapi/asm/perf_regs.h
>> +tools/arch/*/include/uapi/asm/mman-fix.h
>> -- 
>> 1.8.3.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h
  2016-09-06 13:25     ` Wangnan (F)
@ 2016-09-06 13:39       ` Arnaldo Carvalho de Melo
  2016-09-06 15:28         ` Wangnan (F)
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-06 13:39 UTC (permalink / raw)
  To: Wangnan (F)
  Cc: nilayvaish, linux-kernel, lizefan, Hou Pengyang, He Kuang,
	Arnaldo Carvalho de Melo

Em Tue, Sep 06, 2016 at 09:25:47PM +0800, Wangnan (F) escreveu:
> 
> 
> On 2016/9/6 20:59, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Sep 06, 2016 at 05:48:51AM +0000, Wang Nan escreveu:
> > > tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
> > > tools/perf/util/map.c depend on several macros in mman.h, which
> > > are lost on old systems like ubuntu 12.04. They are architecture
> > Not "lost on old systems", changing that to "not present on old systems"
> > 
> > > dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
> > > into tools/ is not easy because mman.h for some unusual archs
> > > (like tile) have extra dependencies.
> > > This patch introduces only required macros into mman-fix.h.
> > > Macros list is gotten from tools/perf/trace/beauty/mmap.c.
> > ok, I'll try keeping the  include/uapi/asm-generic/mman.h and
> > arch/alpha/include/uapi/asm/mman.h with just what you added, so that at
> > least the .c files appears as using the headers were those things are
> > defined in the kernel sources.
> > 
> > Ah, and good eyes in realizing this is not the same value for all
> > arches!
> 
> This is why we have to define these macros for each archs.
> Your solution in tools/perf/trace/beauty/mmap.c works for
> x86 only.
> 
> However, I don't like this patchset because we add 300+
> lines of code and 22 new files for less than 15 macros,
> and only one of them I really concern. Moreover, futhre
> code require more symbols in uapi and we have to add new
> headers, finally we will clone the whole uapi. We have
> to stop doing this...

Why? If we want to support older newer kernels running on older distros,
which is a valid goal, or recent tool source code on older distros,
where fallbacks will take place with their older kernels, and if we have
the build automated for that (I have) then why not keep the tools
building on as many different userspaces as possible?

I'm not even putting this as a burden to you, that may choose to support
only recent systems, but since I have this automated and can catch such
problems, I intend to keep the tool building in as many systems as
possible.

The good thing about my report was that you noticed a problem in
existing code, i.e. the 'perf trace' beautifier that was working only on
x86, thanks for that!
 
> For the hugetlb problem, I think you can take the v2 patch
> without this 2 patches:
> 
> http://lkml.kernel.org/r/1473137909-142064-1-git-send-email-wangnan0@huawei.com
> 
> so old system can compile without hugetlb support.

Right, I understood your intention, to have both independent.
 
> This is the reason why I separated into 2 patch series.
> 
> Thank you.

thanks,

- Arnaldo
 
> > - Arnaldo
> > > This patch is gnerated using following bash script:
> > > 
> > >   #!/bin/bash
> > > 
> > >   function begin_mman_fix_header()
> > >   {
> > >     echo "#ifndef $1" >  $2
> > >     echo "#define $1" >> $2
> > >     echo "#include <sys/mman.h>" >> $2
> > >   }
> > > 
> > >   function finish_mman_fix_header()
> > >   {
> > >     echo "#endif // $1" >> $2
> > >     echo "Finish writing $2"
> > >   }
> > > 
> > >   function build_mman_fix_header()
> > >   {
> > >     guard=$1
> > >     shift
> > >     target=$1
> > >     shift
> > >     begin_mman_fix_header $guard $target
> > >     for src in $@
> > >     do
> > >       if [ -f $src ]
> > >       then
> > >         for macro in $macros
> > >         do
> > >           if grep '#define[ \t]*'$macro $src > /dev/null 2>&1
> > >           then
> > >             echo "#ifndef $macro" >> $target
> > >             grep '#define[ \t]*'$macro $src | sed 's/[ \t]*\/\*.*$//g' >> $target
> > >             echo "#endif" >> $target
> > >           fi
> > >         done
> > >       fi
> > >     done
> > >   }
> > > 
> > >   macros=`grep ifndef tools/perf/trace/beauty/mmap.c | awk '{print $2}'`
> > > 
> > >   baseheader=tools/include/uapi/asm-generic/mman-fix.h
> > >   build_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader include/uapi/asm-generic/mman*
> > >   echo "#ifndef MAP_UNINITIALIZED" >> $baseheader
> > >   echo "#define MAP_UNINITIALIZED 0x4000000" >> $baseheader
> > >   echo "#endif" >> $baseheader
> > >   finish_mman_fix_header __TOOLS_UAPI_ASM_MMAN_FIX_H $baseheader
> > > 
> > >   archs=`ls tools/arch`
> > >   for arch in $archs
> > >   do
> > >     archheader=tools/arch/$arch/include/uapi/asm/mman-fix.h
> > >     if [ ! -d tools/arch/$arch/include/uapi/asm ]
> > >     then
> > >       mkdir -p tools/arch/$arch/include/uapi/asm
> > >     fi
> > >     uppercase=`echo $arch | awk '{print toupper($0)}'`
> > >     build_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader arch/$arch/include/uapi/asm/mman.h
> > >     echo "#include <asm-generic/mman-fix.h>" >> $archheader
> > >     finish_mman_fix_header TOOLS_ARCH_${uppercase}_UAPI_ASM_MMAN_FIX_H $archheader
> > >   done
> > > 
> > > Signed-off-by: Wang Nan <wangnan0@huawei.com>
> > > Cc: Nilay Vaish <nilayvaish@gmail.com>
> > > Cc: Hou Pengyang <houpengyang@huawei.com>
> > > Cc: He Kuang <hekuang@huawei.com>
> > > Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> > > ---
> > >   tools/arch/alpha/include/uapi/asm/mman-fix.h      | 38 +++++++++++++++++++
> > >   tools/arch/arm/include/uapi/asm/mman-fix.h        |  5 +++
> > >   tools/arch/arm64/include/uapi/asm/mman-fix.h      |  5 +++
> > >   tools/arch/frv/include/uapi/asm/mman-fix.h        |  5 +++
> > >   tools/arch/h8300/include/uapi/asm/mman-fix.h      |  5 +++
> > >   tools/arch/hexagon/include/uapi/asm/mman-fix.h    |  5 +++
> > >   tools/arch/ia64/include/uapi/asm/mman-fix.h       |  5 +++
> > >   tools/arch/m32r/include/uapi/asm/mman-fix.h       |  5 +++
> > >   tools/arch/microblaze/include/uapi/asm/mman-fix.h |  5 +++
> > >   tools/arch/mips/include/uapi/asm/mman-fix.h       | 41 ++++++++++++++++++++
> > >   tools/arch/mn10300/include/uapi/asm/mman-fix.h    |  5 +++
> > >   tools/arch/parisc/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
> > >   tools/arch/powerpc/include/uapi/asm/mman-fix.h    | 11 ++++++
> > >   tools/arch/s390/include/uapi/asm/mman-fix.h       |  5 +++
> > >   tools/arch/score/include/uapi/asm/mman-fix.h      |  5 +++
> > >   tools/arch/sh/include/uapi/asm/mman-fix.h         |  5 +++
> > >   tools/arch/sparc/include/uapi/asm/mman-fix.h      | 11 ++++++
> > >   tools/arch/tile/include/uapi/asm/mman-fix.h       | 11 ++++++
> > >   tools/arch/x86/include/uapi/asm/mman-fix.h        |  8 ++++
> > >   tools/arch/xtensa/include/uapi/asm/mman-fix.h     | 38 +++++++++++++++++++
> > >   tools/include/uapi/asm-generic/mman-fix.h         | 46 +++++++++++++++++++++++
> > >   tools/perf/MANIFEST                               |  2 +
> > >   22 files changed, 304 insertions(+)
> > >   create mode 100644 tools/arch/alpha/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/arm/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/arm64/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/frv/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/h8300/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/hexagon/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/ia64/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/m32r/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/microblaze/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/mips/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/mn10300/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/parisc/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/powerpc/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/s390/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/score/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/sh/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/sparc/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/tile/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/x86/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/arch/xtensa/include/uapi/asm/mman-fix.h
> > >   create mode 100644 tools/include/uapi/asm-generic/mman-fix.h
> > > 
> > > diff --git a/tools/arch/alpha/include/uapi/asm/mman-fix.h b/tools/arch/alpha/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..f807a71
> > > --- /dev/null
> > > +++ b/tools/arch/alpha/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,38 @@
> > > +#ifndef TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef PROT_SEM
> > > +#define PROT_SEM	0x8
> > > +#endif
> > > +#ifndef MAP_FIXED
> > > +#define MAP_FIXED	0x100
> > > +#endif
> > > +#ifndef MAP_ANONYMOUS
> > > +#define MAP_ANONYMOUS	0x10
> > > +#endif
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	0x80000
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x100000
> > > +#endif
> > > +#ifndef MADV_MERGEABLE
> > > +#define MADV_MERGEABLE   12
> > > +#endif
> > > +#ifndef MADV_UNMERGEABLE
> > > +#define MADV_UNMERGEABLE 13
> > > +#endif
> > > +#ifndef MADV_HUGEPAGE
> > > +#define MADV_HUGEPAGE	14
> > > +#endif
> > > +#ifndef MADV_NOHUGEPAGE
> > > +#define MADV_NOHUGEPAGE	15
> > > +#endif
> > > +#ifndef MADV_DONTDUMP
> > > +#define MADV_DONTDUMP   16
> > > +#endif
> > > +#ifndef MADV_DODUMP
> > > +#define MADV_DODUMP	17
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_ALPHA_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/arm/include/uapi/asm/mman-fix.h b/tools/arch/arm/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..a29dae1
> > > --- /dev/null
> > > +++ b/tools/arch/arm/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_ARM_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/arm64/include/uapi/asm/mman-fix.h b/tools/arch/arm64/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..e50c0d1
> > > --- /dev/null
> > > +++ b/tools/arch/arm64/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_ARM64_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/frv/include/uapi/asm/mman-fix.h b/tools/arch/frv/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..8c2eb44
> > > --- /dev/null
> > > +++ b/tools/arch/frv/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/h8300/include/uapi/asm/mman-fix.h b/tools/arch/h8300/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..e639fe6
> > > --- /dev/null
> > > +++ b/tools/arch/h8300/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/hexagon/include/uapi/asm/mman-fix.h b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..dda9359
> > > --- /dev/null
> > > +++ b/tools/arch/hexagon/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_HEXAGON_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/ia64/include/uapi/asm/mman-fix.h b/tools/arch/ia64/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..1e98f36
> > > --- /dev/null
> > > +++ b/tools/arch/ia64/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_IA64_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/m32r/include/uapi/asm/mman-fix.h b/tools/arch/m32r/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..74aa94d
> > > --- /dev/null
> > > +++ b/tools/arch/m32r/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_M32R_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/microblaze/include/uapi/asm/mman-fix.h b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..90b7a53
> > > --- /dev/null
> > > +++ b/tools/arch/microblaze/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_MICROBLAZE_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/mips/include/uapi/asm/mman-fix.h b/tools/arch/mips/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..ef58cd7
> > > --- /dev/null
> > > +++ b/tools/arch/mips/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,41 @@
> > > +#ifndef TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef PROT_SEM
> > > +#define PROT_SEM	0x10
> > > +#endif
> > > +#ifndef MAP_FIXED
> > > +#define MAP_FIXED	0x010
> > > +#endif
> > > +#ifndef MAP_ANONYMOUS
> > > +#define MAP_ANONYMOUS	0x0800
> > > +#endif
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	0x40000
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x80000
> > > +#endif
> > > +#ifndef MADV_HWPOISON
> > > +#define MADV_HWPOISON	 100
> > > +#endif
> > > +#ifndef MADV_MERGEABLE
> > > +#define MADV_MERGEABLE	 12
> > > +#endif
> > > +#ifndef MADV_UNMERGEABLE
> > > +#define MADV_UNMERGEABLE 13
> > > +#endif
> > > +#ifndef MADV_HUGEPAGE
> > > +#define MADV_HUGEPAGE	14
> > > +#endif
> > > +#ifndef MADV_NOHUGEPAGE
> > > +#define MADV_NOHUGEPAGE 15
> > > +#endif
> > > +#ifndef MADV_DONTDUMP
> > > +#define MADV_DONTDUMP	16
> > > +#endif
> > > +#ifndef MADV_DODUMP
> > > +#define MADV_DODUMP	17
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_MIPS_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/mn10300/include/uapi/asm/mman-fix.h b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..86a2903
> > > --- /dev/null
> > > +++ b/tools/arch/mn10300/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/parisc/include/uapi/asm/mman-fix.h b/tools/arch/parisc/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..c157a03
> > > --- /dev/null
> > > +++ b/tools/arch/parisc/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,38 @@
> > > +#ifndef TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef PROT_SEM
> > > +#define PROT_SEM	0x8
> > > +#endif
> > > +#ifndef MAP_FIXED
> > > +#define MAP_FIXED	0x04
> > > +#endif
> > > +#ifndef MAP_ANONYMOUS
> > > +#define MAP_ANONYMOUS	0x10
> > > +#endif
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	0x40000
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x80000
> > > +#endif
> > > +#ifndef MADV_MERGEABLE
> > > +#define MADV_MERGEABLE   65
> > > +#endif
> > > +#ifndef MADV_UNMERGEABLE
> > > +#define MADV_UNMERGEABLE 66
> > > +#endif
> > > +#ifndef MADV_HUGEPAGE
> > > +#define MADV_HUGEPAGE	67
> > > +#endif
> > > +#ifndef MADV_NOHUGEPAGE
> > > +#define MADV_NOHUGEPAGE	68
> > > +#endif
> > > +#ifndef MADV_DONTDUMP
> > > +#define MADV_DONTDUMP   69
> > > +#endif
> > > +#ifndef MADV_DODUMP
> > > +#define MADV_DODUMP	70
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_PARISC_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/powerpc/include/uapi/asm/mman-fix.h b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..4b552fa
> > > --- /dev/null
> > > +++ b/tools/arch/powerpc/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,11 @@
> > > +#ifndef TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	0x20000
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x40000
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_POWERPC_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/s390/include/uapi/asm/mman-fix.h b/tools/arch/s390/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..d7755dd
> > > --- /dev/null
> > > +++ b/tools/arch/s390/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_S390_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/score/include/uapi/asm/mman-fix.h b/tools/arch/score/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..97ad192
> > > --- /dev/null
> > > +++ b/tools/arch/score/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_SCORE_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/sh/include/uapi/asm/mman-fix.h b/tools/arch/sh/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..d17bca8
> > > --- /dev/null
> > > +++ b/tools/arch/sh/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,5 @@
> > > +#ifndef TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_SH_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/sparc/include/uapi/asm/mman-fix.h b/tools/arch/sparc/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..3ac4ba0
> > > --- /dev/null
> > > +++ b/tools/arch/sparc/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,11 @@
> > > +#ifndef TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	0x20000
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x40000
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_SPARC_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/tile/include/uapi/asm/mman-fix.h b/tools/arch/tile/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..105a3b0e
> > > --- /dev/null
> > > +++ b/tools/arch/tile/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,11 @@
> > > +#ifndef TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	MAP_GROWSDOWN
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x4000
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_TILE_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/x86/include/uapi/asm/mman-fix.h b/tools/arch/x86/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..0cda2bf
> > > --- /dev/null
> > > +++ b/tools/arch/x86/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,8 @@
> > > +#ifndef TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef MAP_32BIT
> > > +#define MAP_32BIT	0x40
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_X86_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/arch/xtensa/include/uapi/asm/mman-fix.h b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
> > > new file mode 100644
> > > index 0000000..9ec9051
> > > --- /dev/null
> > > +++ b/tools/arch/xtensa/include/uapi/asm/mman-fix.h
> > > @@ -0,0 +1,38 @@
> > > +#ifndef TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> > > +#define TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef PROT_SEM
> > > +#define PROT_SEM	0x10
> > > +#endif
> > > +#ifndef MAP_FIXED
> > > +#define MAP_FIXED	0x010
> > > +#endif
> > > +#ifndef MAP_ANONYMOUS
> > > +#define MAP_ANONYMOUS	0x0800
> > > +#endif
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	0x40000
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x80000
> > > +#endif
> > > +#ifndef MADV_MERGEABLE
> > > +#define MADV_MERGEABLE   12
> > > +#endif
> > > +#ifndef MADV_UNMERGEABLE
> > > +#define MADV_UNMERGEABLE 13
> > > +#endif
> > > +#ifndef MADV_HUGEPAGE
> > > +#define MADV_HUGEPAGE	14
> > > +#endif
> > > +#ifndef MADV_NOHUGEPAGE
> > > +#define MADV_NOHUGEPAGE	15
> > > +#endif
> > > +#ifndef MADV_DONTDUMP
> > > +#define MADV_DONTDUMP   16
> > > +#endif
> > > +#ifndef MADV_DODUMP
> > > +#define MADV_DODUMP	17
> > > +#endif
> > > +#include <asm-generic/mman-fix.h>
> > > +#endif // TOOLS_ARCH_XTENSA_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/include/uapi/asm-generic/mman-fix.h b/tools/include/uapi/asm-generic/mman-fix.h
> > > new file mode 100644
> > > index 0000000..f47eb4c
> > > --- /dev/null
> > > +++ b/tools/include/uapi/asm-generic/mman-fix.h
> > > @@ -0,0 +1,46 @@
> > > +#ifndef __TOOLS_UAPI_ASM_MMAN_FIX_H
> > > +#define __TOOLS_UAPI_ASM_MMAN_FIX_H
> > > +#include <sys/mman.h>
> > > +#ifndef PROT_SEM
> > > +#define PROT_SEM	0x8
> > > +#endif
> > > +#ifndef MAP_FIXED
> > > +#define MAP_FIXED	0x10
> > > +#endif
> > > +#ifndef MAP_ANONYMOUS
> > > +#define MAP_ANONYMOUS	0x20
> > > +#endif
> > > +#ifndef MADV_HWPOISON
> > > +#define MADV_HWPOISON	100
> > > +#endif
> > > +#ifndef MADV_SOFT_OFFLINE
> > > +#define MADV_SOFT_OFFLINE 101
> > > +#endif
> > > +#ifndef MADV_MERGEABLE
> > > +#define MADV_MERGEABLE   12
> > > +#endif
> > > +#ifndef MADV_UNMERGEABLE
> > > +#define MADV_UNMERGEABLE 13
> > > +#endif
> > > +#ifndef MADV_HUGEPAGE
> > > +#define MADV_HUGEPAGE	14
> > > +#endif
> > > +#ifndef MADV_NOHUGEPAGE
> > > +#define MADV_NOHUGEPAGE	15
> > > +#endif
> > > +#ifndef MADV_DONTDUMP
> > > +#define MADV_DONTDUMP   16
> > > +#endif
> > > +#ifndef MADV_DODUMP
> > > +#define MADV_DODUMP	17
> > > +#endif
> > > +#ifndef MAP_STACK
> > > +#define MAP_STACK	0x20000
> > > +#endif
> > > +#ifndef MAP_HUGETLB
> > > +#define MAP_HUGETLB	0x40000
> > > +#endif
> > > +#ifndef MAP_UNINITIALIZED
> > > +#define MAP_UNINITIALIZED 0x4000000
> > > +#endif
> > > +#endif // __TOOLS_UAPI_ASM_MMAN_FIX_H
> > > diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
> > > index ff200c6..56ac24f 100644
> > > --- a/tools/perf/MANIFEST
> > > +++ b/tools/perf/MANIFEST
> > > @@ -66,6 +66,7 @@ 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-fix.h
> > >   tools/include/uapi/linux/bpf.h
> > >   tools/include/uapi/linux/bpf_common.h
> > >   tools/include/uapi/linux/hw_breakpoint.h
> > > @@ -80,3 +81,4 @@ tools/include/linux/err.h
> > >   tools/include/linux/bitmap.h
> > >   tools/include/linux/time64.h
> > >   tools/arch/*/include/uapi/asm/perf_regs.h
> > > +tools/arch/*/include/uapi/asm/mman-fix.h
> > > -- 
> > > 1.8.3.4
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h
  2016-09-06 13:39       ` Arnaldo Carvalho de Melo
@ 2016-09-06 15:28         ` Wangnan (F)
  2016-09-06 17:43           ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Wangnan (F) @ 2016-09-06 15:28 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: nilayvaish, linux-kernel, lizefan, Hou Pengyang, He Kuang,
	Arnaldo Carvalho de Melo



On 2016/9/6 21:39, Arnaldo Carvalho de Melo wrote:
> Em Tue, Sep 06, 2016 at 09:25:47PM +0800, Wangnan (F) escreveu:
>>
>> On 2016/9/6 20:59, Arnaldo Carvalho de Melo wrote:
>>> Em Tue, Sep 06, 2016 at 05:48:51AM +0000, Wang Nan escreveu:
>>>> tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
>>>> tools/perf/util/map.c depend on several macros in mman.h, which
>>>> are lost on old systems like ubuntu 12.04. They are architecture
>>> Not "lost on old systems", changing that to "not present on old systems"
>>>
>>>> dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
>>>> into tools/ is not easy because mman.h for some unusual archs
>>>> (like tile) have extra dependencies.
>>>> This patch introduces only required macros into mman-fix.h.
>>>> Macros list is gotten from tools/perf/trace/beauty/mmap.c.
>>> ok, I'll try keeping the  include/uapi/asm-generic/mman.h and
>>> arch/alpha/include/uapi/asm/mman.h with just what you added, so that at
>>> least the .c files appears as using the headers were those things are
>>> defined in the kernel sources.
>>>
>>> Ah, and good eyes in realizing this is not the same value for all
>>> arches!
>> This is why we have to define these macros for each archs.
>> Your solution in tools/perf/trace/beauty/mmap.c works for
>> x86 only.
>>
>> However, I don't like this patchset because we add 300+
>> lines of code and 22 new files for less than 15 macros,
>> and only one of them I really concern. Moreover, futhre
>> code require more symbols in uapi and we have to add new
>> headers, finally we will clone the whole uapi. We have
>> to stop doing this...
> Why? If we want to support older newer kernels running on older distros,
> which is a valid goal, or recent tool source code on older distros,
> where fallbacks will take place with their older kernels, and if we have
> the build automated for that (I have) then why not keep the tools
> building on as many different userspaces as possible?

Your automated building checker is great. I mean we have
to find a way to stop pulling kernel headers to tools/include.

But since we haven't find such a way, I'll continously improve
this mman.h stuff. As your suggestion, I'll try to put them
in uapi/mman.h, not mman-fix.h. This require a building check
for each arch.

Thank you.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h
  2016-09-06 15:28         ` Wangnan (F)
@ 2016-09-06 17:43           ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-09-06 17:43 UTC (permalink / raw)
  To: Wangnan (F)
  Cc: nilayvaish, linux-kernel, lizefan, Hou Pengyang, He Kuang,
	Arnaldo Carvalho de Melo

Em Tue, Sep 06, 2016 at 11:28:35PM +0800, Wangnan (F) escreveu:
> On 2016/9/6 21:39, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Sep 06, 2016 at 09:25:47PM +0800, Wangnan (F) escreveu:
> > > 
> > > On 2016/9/6 20:59, Arnaldo Carvalho de Melo wrote:
> > > > Em Tue, Sep 06, 2016 at 05:48:51AM +0000, Wang Nan escreveu:
> > > > > tools/perf/trace/beauty/mmap.c, tools/perf/util/event.c and
> > > > > tools/perf/util/map.c depend on several macros in mman.h, which
> > > > > are lost on old systems like ubuntu 12.04. They are architecture
> > > > Not "lost on old systems", changing that to "not present on old systems"
> > > > 
> > > > > dependened macros. Importing ./arch/*/include/uapi/asm/mman.h
> > > > > into tools/ is not easy because mman.h for some unusual archs
> > > > > (like tile) have extra dependencies.
> > > > > This patch introduces only required macros into mman-fix.h.
> > > > > Macros list is gotten from tools/perf/trace/beauty/mmap.c.
> > > > ok, I'll try keeping the  include/uapi/asm-generic/mman.h and
> > > > arch/alpha/include/uapi/asm/mman.h with just what you added, so that at
> > > > least the .c files appears as using the headers were those things are
> > > > defined in the kernel sources.
> > > > 
> > > > Ah, and good eyes in realizing this is not the same value for all
> > > > arches!
> > > This is why we have to define these macros for each archs.
> > > Your solution in tools/perf/trace/beauty/mmap.c works for
> > > x86 only.
> > > 
> > > However, I don't like this patchset because we add 300+
> > > lines of code and 22 new files for less than 15 macros,
> > > and only one of them I really concern. Moreover, futhre
> > > code require more symbols in uapi and we have to add new
> > > headers, finally we will clone the whole uapi. We have
> > > to stop doing this...
> > Why? If we want to support older newer kernels running on older distros,
> > which is a valid goal, or recent tool source code on older distros,
> > where fallbacks will take place with their older kernels, and if we have
> > the build automated for that (I have) then why not keep the tools
> > building on as many different userspaces as possible?
> 
> Your automated building checker is great. I mean we have
> to find a way to stop pulling kernel headers to tools/include.

Well, if we want the source code to build on older systems, then we must
provide #defines for things not present in such older systems, we would
have to put it somewhere, so why not to put it in the same header as the
kernel puts?
 
> But since we haven't find such a way, I'll continously improve
> this mman.h stuff.

We could, for instance, use the kernel headers, then, building perf on
older systems would not be a problem, the kernel sources goes with the
perf tool sources, they are in the same repository.

But this requires that the kernel developers make sure the perf tool
builds, which was deemed a burden to them. Thus the copy.

> As your suggestion, I'll try to put them in uapi/mman.h, not

Thanks!

> mman-fix.h. This require a building check for each arch.

Well, for the things that are strict copies, yes, having those diff
based checks would help us to figure out new files in the kernel for
which we have copies, but that isn't so _strictly_ needed for cases
where we avoided some of the dependencies in the kernel headers by
copying just what we need in tools/.

- Arnaldo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-06 17:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06  5:48 [PATCH 0/2] Fix mman macros using mman-fix.h Wang Nan
2016-09-06  5:48 ` [PATCH 1/2] perf tools: Introduce memory mapping macros in mman-fix.h Wang Nan
2016-09-06 12:59   ` Arnaldo Carvalho de Melo
2016-09-06 13:25     ` Wangnan (F)
2016-09-06 13:39       ` Arnaldo Carvalho de Melo
2016-09-06 15:28         ` Wangnan (F)
2016-09-06 17:43           ` Arnaldo Carvalho de Melo
2016-09-06  5:48 ` [PATCH 2/2] perf tools: Fix mman macros using mman-fix.h Wang Nan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.