aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2014-05-05 13:37:51 -0400
committerIngo Molnar <mingo@kernel.org>2014-05-05 13:37:51 -0400
commit3e46d21285577a8c9e4c37f9b1002e567c440b28 (patch)
tree9a49847d06c707aa0b441bc88babe76ede3c0de1
parent3617660e4e1618a888a2e3a4067224534302cb33 (diff)
parent73a31b7c6a85e2f033524058bad5bce900e4f2ed (diff)
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/core
Pull perf/core improvements and fixes from Jiri Olsa: * Cleanups for perf.h header (Jiri Olsa) * Consolidate types.h and export.h within tools (Borislav Petkov) Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/include/linux/compiler.h2
-rw-r--r--tools/include/linux/export.h (renamed from tools/virtio/linux/export.h)5
-rw-r--r--tools/include/linux/types.h (renamed from tools/lib/lockdep/uinclude/linux/types.h)29
-rw-r--r--tools/lib/lockdep/Makefile2
-rw-r--r--tools/lib/lockdep/uinclude/linux/export.h7
-rw-r--r--tools/perf/MANIFEST2
-rw-r--r--tools/perf/Makefile.perf5
-rw-r--r--tools/perf/arch/x86/include/perf_regs.h2
-rw-r--r--tools/perf/arch/x86/util/tsc.c2
-rw-r--r--tools/perf/arch/x86/util/tsc.h2
-rw-r--r--tools/perf/perf-sys.h190
-rw-r--r--tools/perf/perf.h254
-rw-r--r--tools/perf/tests/attr.c7
-rw-r--r--tools/perf/tests/code-reading.c3
-rw-r--r--tools/perf/tests/dso-data.c2
-rw-r--r--tools/perf/tests/dwarf-unwind.c2
-rw-r--r--tools/perf/tests/keep-tracking.c2
-rw-r--r--tools/perf/tests/parse-no-sample-id-all.c2
-rw-r--r--tools/perf/tests/perf-time-to-tsc.c3
-rw-r--r--tools/perf/tests/rdpmc.c2
-rw-r--r--tools/perf/tests/sample-parsing.c2
-rw-r--r--tools/perf/ui/browser.h4
-rw-r--r--tools/perf/ui/progress.h2
-rw-r--r--tools/perf/util/annotate.h2
-rw-r--r--tools/perf/util/build-id.h2
-rw-r--r--tools/perf/util/callchain.h7
-rw-r--r--tools/perf/util/dso.h2
-rw-r--r--tools/perf/util/event.h24
-rw-r--r--tools/perf/util/evsel.h4
-rw-r--r--tools/perf/util/header.h4
-rw-r--r--tools/perf/util/include/linux/bitmap.h3
-rw-r--r--tools/perf/util/include/linux/export.h6
-rw-r--r--tools/perf/util/include/linux/list.h1
-rw-r--r--tools/perf/util/include/linux/types.h29
-rw-r--r--tools/perf/util/map.h2
-rw-r--r--tools/perf/util/parse-events.h3
-rw-r--r--tools/perf/util/parse-events.y2
-rw-r--r--tools/perf/util/perf_regs.h2
-rw-r--r--tools/perf/util/pmu.h2
-rw-r--r--tools/perf/util/stat.h2
-rw-r--r--tools/perf/util/svghelper.c2
-rw-r--r--tools/perf/util/svghelper.h2
-rw-r--r--tools/perf/util/symbol.h1
-rw-r--r--tools/perf/util/top.h2
-rw-r--r--tools/perf/util/types.h19
-rw-r--r--tools/perf/util/unwind-libdw.c2
-rw-r--r--tools/perf/util/unwind.h2
-rw-r--r--tools/perf/util/util.h2
-rw-r--r--tools/perf/util/values.h2
-rw-r--r--tools/virtio/Makefile2
-rw-r--r--tools/virtio/linux/kernel.h7
-rw-r--r--tools/virtio/linux/types.h28
52 files changed, 304 insertions, 397 deletions
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index fbc6665c6d53..88461f09cc86 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -35,4 +35,6 @@
35# define unlikely(x) __builtin_expect(!!(x), 0) 35# define unlikely(x) __builtin_expect(!!(x), 0)
36#endif 36#endif
37 37
38#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
39
38#endif /* _TOOLS_LINUX_COMPILER_H */ 40#endif /* _TOOLS_LINUX_COMPILER_H */
diff --git a/tools/virtio/linux/export.h b/tools/include/linux/export.h
index 7311d326894a..d07e586b9ba0 100644
--- a/tools/virtio/linux/export.h
+++ b/tools/include/linux/export.h
@@ -1,5 +1,10 @@
1#ifndef _TOOLS_LINUX_EXPORT_H_
2#define _TOOLS_LINUX_EXPORT_H_
3
1#define EXPORT_SYMBOL(sym) 4#define EXPORT_SYMBOL(sym)
2#define EXPORT_SYMBOL_GPL(sym) 5#define EXPORT_SYMBOL_GPL(sym)
3#define EXPORT_SYMBOL_GPL_FUTURE(sym) 6#define EXPORT_SYMBOL_GPL_FUTURE(sym)
4#define EXPORT_UNUSED_SYMBOL(sym) 7#define EXPORT_UNUSED_SYMBOL(sym)
5#define EXPORT_UNUSED_SYMBOL_GPL(sym) 8#define EXPORT_UNUSED_SYMBOL_GPL(sym)
9
10#endif
diff --git a/tools/lib/lockdep/uinclude/linux/types.h b/tools/include/linux/types.h
index 929938f426de..b5cf25e05df2 100644
--- a/tools/lib/lockdep/uinclude/linux/types.h
+++ b/tools/include/linux/types.h
@@ -1,8 +1,9 @@
1#ifndef _LIBLOCKDEP_LINUX_TYPES_H_ 1#ifndef _TOOLS_LINUX_TYPES_H_
2#define _LIBLOCKDEP_LINUX_TYPES_H_ 2#define _TOOLS_LINUX_TYPES_H_
3 3
4#include <stdbool.h> 4#include <stdbool.h>
5#include <stddef.h> 5#include <stddef.h>
6#include <stdint.h>
6 7
7#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */ 8#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
8#include <asm/types.h> 9#include <asm/types.h>
@@ -10,10 +11,22 @@
10struct page; 11struct page;
11struct kmem_cache; 12struct kmem_cache;
12 13
13typedef unsigned gfp_t; 14typedef enum {
15 GFP_KERNEL,
16 GFP_ATOMIC,
17 __GFP_HIGHMEM,
18 __GFP_HIGH
19} gfp_t;
14 20
15typedef __u64 u64; 21/*
16typedef __s64 s64; 22 * We define u64 as uint64_t for every architecture
23 * so that we can print it with "%"PRIx64 without getting warnings.
24 *
25 * typedef __u64 u64;
26 * typedef __s64 s64;
27 */
28typedef uint64_t u64;
29typedef int64_t s64;
17 30
18typedef __u32 u32; 31typedef __u32 u32;
19typedef __s32 s32; 32typedef __s32 s32;
@@ -35,6 +48,10 @@ typedef __s8 s8;
35#define __bitwise 48#define __bitwise
36#endif 49#endif
37 50
51#define __force
52#define __user
53#define __must_check
54#define __cold
38 55
39typedef __u16 __bitwise __le16; 56typedef __u16 __bitwise __le16;
40typedef __u16 __bitwise __be16; 57typedef __u16 __bitwise __be16;
@@ -55,4 +72,4 @@ struct hlist_node {
55 struct hlist_node *next, **pprev; 72 struct hlist_node *next, **pprev;
56}; 73};
57 74
58#endif 75#endif /* _TOOLS_LINUX_TYPES_H_ */
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile
index cb09d3ff8f58..85ef05da7453 100644
--- a/tools/lib/lockdep/Makefile
+++ b/tools/lib/lockdep/Makefile
@@ -105,7 +105,7 @@ N =
105 105
106export Q VERBOSE 106export Q VERBOSE
107 107
108INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include $(CONFIG_INCLUDES) 108INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include -I../../include $(CONFIG_INCLUDES)
109 109
110# Set compile option CFLAGS if not set elsewhere 110# Set compile option CFLAGS if not set elsewhere
111CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g 111CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g
diff --git a/tools/lib/lockdep/uinclude/linux/export.h b/tools/lib/lockdep/uinclude/linux/export.h
deleted file mode 100644
index 6bdf3492c535..000000000000
--- a/tools/lib/lockdep/uinclude/linux/export.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _LIBLOCKDEP_LINUX_EXPORT_H_
2#define _LIBLOCKDEP_LINUX_EXPORT_H_
3
4#define EXPORT_SYMBOL(sym)
5#define EXPORT_SYMBOL_GPL(sym)
6
7#endif
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index c0c87c87b60f..45da209b6ed3 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -7,6 +7,8 @@ tools/lib/symbol/kallsyms.h
7tools/include/asm/bug.h 7tools/include/asm/bug.h
8tools/include/linux/compiler.h 8tools/include/linux/compiler.h
9tools/include/linux/hash.h 9tools/include/linux/hash.h
10tools/include/linux/export.h
11tools/include/linux/types.h
10include/linux/const.h 12include/linux/const.h
11include/linux/perf_event.h 13include/linux/perf_event.h
12include/linux/rbtree.h 14include/linux/rbtree.h
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5e21aad44142..2baf61cec7ff 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -222,12 +222,12 @@ LIB_H += util/include/linux/const.h
222LIB_H += util/include/linux/ctype.h 222LIB_H += util/include/linux/ctype.h
223LIB_H += util/include/linux/kernel.h 223LIB_H += util/include/linux/kernel.h
224LIB_H += util/include/linux/list.h 224LIB_H += util/include/linux/list.h
225LIB_H += util/include/linux/export.h 225LIB_H += ../include/linux/export.h
226LIB_H += util/include/linux/poison.h 226LIB_H += util/include/linux/poison.h
227LIB_H += util/include/linux/rbtree.h 227LIB_H += util/include/linux/rbtree.h
228LIB_H += util/include/linux/rbtree_augmented.h 228LIB_H += util/include/linux/rbtree_augmented.h
229LIB_H += util/include/linux/string.h 229LIB_H += util/include/linux/string.h
230LIB_H += util/include/linux/types.h 230LIB_H += ../include/linux/types.h
231LIB_H += util/include/linux/linkage.h 231LIB_H += util/include/linux/linkage.h
232LIB_H += util/include/asm/asm-offsets.h 232LIB_H += util/include/asm/asm-offsets.h
233LIB_H += ../include/asm/bug.h 233LIB_H += ../include/asm/bug.h
@@ -252,7 +252,6 @@ LIB_H += util/event.h
252LIB_H += util/evsel.h 252LIB_H += util/evsel.h
253LIB_H += util/evlist.h 253LIB_H += util/evlist.h
254LIB_H += util/exec_cmd.h 254LIB_H += util/exec_cmd.h
255LIB_H += util/types.h
256LIB_H += util/levenshtein.h 255LIB_H += util/levenshtein.h
257LIB_H += util/machine.h 256LIB_H += util/machine.h
258LIB_H += util/map.h 257LIB_H += util/map.h
diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h
index fc819ca34a7e..7df517acfef8 100644
--- a/tools/perf/arch/x86/include/perf_regs.h
+++ b/tools/perf/arch/x86/include/perf_regs.h
@@ -2,7 +2,7 @@
2#define ARCH_PERF_REGS_H 2#define ARCH_PERF_REGS_H
3 3
4#include <stdlib.h> 4#include <stdlib.h>
5#include "../../util/types.h" 5#include <linux/types.h>
6#include <asm/perf_regs.h> 6#include <asm/perf_regs.h>
7 7
8void perf_regs_load(u64 *regs); 8void perf_regs_load(u64 *regs);
diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c
index b2519e49424f..40021fa3129b 100644
--- a/tools/perf/arch/x86/util/tsc.c
+++ b/tools/perf/arch/x86/util/tsc.c
@@ -4,7 +4,7 @@
4#include <linux/perf_event.h> 4#include <linux/perf_event.h>
5 5
6#include "../../perf.h" 6#include "../../perf.h"
7#include "../../util/types.h" 7#include <linux/types.h>
8#include "../../util/debug.h" 8#include "../../util/debug.h"
9#include "tsc.h" 9#include "tsc.h"
10 10
diff --git a/tools/perf/arch/x86/util/tsc.h b/tools/perf/arch/x86/util/tsc.h
index a24dec81c795..2affe0366b59 100644
--- a/tools/perf/arch/x86/util/tsc.h
+++ b/tools/perf/arch/x86/util/tsc.h
@@ -1,7 +1,7 @@
1#ifndef TOOLS_PERF_ARCH_X86_UTIL_TSC_H__ 1#ifndef TOOLS_PERF_ARCH_X86_UTIL_TSC_H__
2#define TOOLS_PERF_ARCH_X86_UTIL_TSC_H__ 2#define TOOLS_PERF_ARCH_X86_UTIL_TSC_H__
3 3
4#include "../../util/types.h" 4#include <linux/types.h>
5 5
6struct perf_tsc_conversion { 6struct perf_tsc_conversion {
7 u16 time_shift; 7 u16 time_shift;
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
new file mode 100644
index 000000000000..5268a1481d23
--- /dev/null
+++ b/tools/perf/perf-sys.h
@@ -0,0 +1,190 @@
1#ifndef _PERF_SYS_H
2#define _PERF_SYS_H
3
4#include <unistd.h>
5#include <sys/types.h>
6#include <sys/syscall.h>
7#include <linux/types.h>
8#include <linux/perf_event.h>
9#include <asm/unistd.h>
10
11#if defined(__i386__)
12#define mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
13#define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
14#define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
15#define cpu_relax() asm volatile("rep; nop" ::: "memory");
16#define CPUINFO_PROC "model name"
17#ifndef __NR_perf_event_open
18# define __NR_perf_event_open 336
19#endif
20#ifndef __NR_futex
21# define __NR_futex 240
22#endif
23#ifndef __NR_gettid
24# define __NR_gettid 224
25#endif
26#endif
27
28#if defined(__x86_64__)
29#define mb() asm volatile("mfence" ::: "memory")
30#define wmb() asm volatile("sfence" ::: "memory")
31#define rmb() asm volatile("lfence" ::: "memory")
32#define cpu_relax() asm volatile("rep; nop" ::: "memory");
33#define CPUINFO_PROC "model name"
34#ifndef __NR_perf_event_open
35# define __NR_perf_event_open 298
36#endif
37#ifndef __NR_futex
38# define __NR_futex 202
39#endif
40#ifndef __NR_gettid
41# define __NR_gettid 186
42#endif
43#endif
44
45#ifdef __powerpc__
46#include "../../arch/powerpc/include/uapi/asm/unistd.h"
47#define mb() asm volatile ("sync" ::: "memory")
48#define wmb() asm volatile ("sync" ::: "memory")
49#define rmb() asm volatile ("sync" ::: "memory")
50#define CPUINFO_PROC "cpu"
51#endif
52
53#ifdef __s390__
54#define mb() asm volatile("bcr 15,0" ::: "memory")
55#define wmb() asm volatile("bcr 15,0" ::: "memory")
56#define rmb() asm volatile("bcr 15,0" ::: "memory")
57#endif
58
59#ifdef __sh__
60#if defined(__SH4A__) || defined(__SH5__)
61# define mb() asm volatile("synco" ::: "memory")
62# define wmb() asm volatile("synco" ::: "memory")
63# define rmb() asm volatile("synco" ::: "memory")
64#else
65# define mb() asm volatile("" ::: "memory")
66# define wmb() asm volatile("" ::: "memory")
67# define rmb() asm volatile("" ::: "memory")
68#endif
69#define CPUINFO_PROC "cpu type"
70#endif
71
72#ifdef __hppa__
73#define mb() asm volatile("" ::: "memory")
74#define wmb() asm volatile("" ::: "memory")
75#define rmb() asm volatile("" ::: "memory")
76#define CPUINFO_PROC "cpu"
77#endif
78
79#ifdef __sparc__
80#ifdef __LP64__
81#define mb() asm volatile("ba,pt %%xcc, 1f\n" \
82 "membar #StoreLoad\n" \
83 "1:\n":::"memory")
84#else
85#define mb() asm volatile("":::"memory")
86#endif
87#define wmb() asm volatile("":::"memory")
88#define rmb() asm volatile("":::"memory")
89#define CPUINFO_PROC "cpu"
90#endif
91
92#ifdef __alpha__
93#define mb() asm volatile("mb" ::: "memory")
94#define wmb() asm volatile("wmb" ::: "memory")
95#define rmb() asm volatile("mb" ::: "memory")
96#define CPUINFO_PROC "cpu model"
97#endif
98
99#ifdef __ia64__
100#define mb() asm volatile ("mf" ::: "memory")
101#define wmb() asm volatile ("mf" ::: "memory")
102#define rmb() asm volatile ("mf" ::: "memory")
103#define cpu_relax() asm volatile ("hint @pause" ::: "memory")
104#define CPUINFO_PROC "model name"
105#endif
106
107#ifdef __arm__
108/*
109 * Use the __kuser_memory_barrier helper in the CPU helper page. See
110 * arch/arm/kernel/entry-armv.S in the kernel source for details.
111 */
112#define mb() ((void(*)(void))0xffff0fa0)()
113#define wmb() ((void(*)(void))0xffff0fa0)()
114#define rmb() ((void(*)(void))0xffff0fa0)()
115#define CPUINFO_PROC "Processor"
116#endif
117
118#ifdef __aarch64__
119#define mb() asm volatile("dmb ish" ::: "memory")
120#define wmb() asm volatile("dmb ishst" ::: "memory")
121#define rmb() asm volatile("dmb ishld" ::: "memory")
122#define cpu_relax() asm volatile("yield" ::: "memory")
123#endif
124
125#ifdef __mips__
126#define mb() asm volatile( \
127 ".set mips2\n\t" \
128 "sync\n\t" \
129 ".set mips0" \
130 : /* no output */ \
131 : /* no input */ \
132 : "memory")
133#define wmb() mb()
134#define rmb() mb()
135#define CPUINFO_PROC "cpu model"
136#endif
137
138#ifdef __arc__
139#define mb() asm volatile("" ::: "memory")
140#define wmb() asm volatile("" ::: "memory")
141#define rmb() asm volatile("" ::: "memory")
142#define CPUINFO_PROC "Processor"
143#endif
144
145#ifdef __metag__
146#define mb() asm volatile("" ::: "memory")
147#define wmb() asm volatile("" ::: "memory")
148#define rmb() asm volatile("" ::: "memory")
149#define CPUINFO_PROC "CPU"
150#endif
151
152#ifdef __xtensa__
153#define mb() asm volatile("memw" ::: "memory")
154#define wmb() asm volatile("memw" ::: "memory")
155#define rmb() asm volatile("" ::: "memory")
156#define CPUINFO_PROC "core ID"
157#endif
158
159#ifdef __tile__
160#define mb() asm volatile ("mf" ::: "memory")
161#define wmb() asm volatile ("mf" ::: "memory")
162#define rmb() asm volatile ("mf" ::: "memory")
163#define cpu_relax() asm volatile ("mfspr zero, PASS" ::: "memory")
164#define CPUINFO_PROC "model name"
165#endif
166
167#define barrier() asm volatile ("" ::: "memory")
168
169#ifndef cpu_relax
170#define cpu_relax() barrier()
171#endif
172
173static inline int
174sys_perf_event_open(struct perf_event_attr *attr,
175 pid_t pid, int cpu, int group_fd,
176 unsigned long flags)
177{
178 int fd;
179
180 fd = syscall(__NR_perf_event_open, attr, pid, cpu,
181 group_fd, flags);
182
183#ifdef HAVE_ATTR_TEST
184 if (unlikely(test_attr__enabled))
185 test_attr__open(attr, pid, cpu, fd, group_fd, flags);
186#endif
187 return fd;
188}
189
190#endif /* _PERF_SYS_H */
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index ebdad3376c67..510c65f72858 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -1,188 +1,18 @@
1#ifndef _PERF_PERF_H 1#ifndef _PERF_PERF_H
2#define _PERF_PERF_H 2#define _PERF_PERF_H
3 3
4#include <asm/unistd.h>
5
6#if defined(__i386__)
7#define mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
8#define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
9#define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
10#define cpu_relax() asm volatile("rep; nop" ::: "memory");
11#define CPUINFO_PROC "model name"
12#ifndef __NR_perf_event_open
13# define __NR_perf_event_open 336
14#endif
15#ifndef __NR_futex
16# define __NR_futex 240
17#endif
18#ifndef __NR_gettid
19# define __NR_gettid 224
20#endif
21#endif
22
23#if defined(__x86_64__)
24#define mb() asm volatile("mfence" ::: "memory")
25#define wmb() asm volatile("sfence" ::: "memory")
26#define rmb() asm volatile("lfence" ::: "memory")
27#define cpu_relax() asm volatile("rep; nop" ::: "memory");
28#define CPUINFO_PROC "model name"
29#ifndef __NR_perf_event_open
30# define __NR_perf_event_open 298
31#endif
32#ifndef __NR_futex
33# define __NR_futex 202
34#endif
35#ifndef __NR_gettid
36# define __NR_gettid 186
37#endif
38#endif
39
40#ifdef __powerpc__
41#include "../../arch/powerpc/include/uapi/asm/unistd.h"
42#define mb() asm volatile ("sync" ::: "memory")
43#define wmb() asm volatile ("sync" ::: "memory")
44#define rmb() asm volatile ("sync" ::: "memory")
45#define CPUINFO_PROC "cpu"
46#endif
47
48#ifdef __s390__
49#define mb() asm volatile("bcr 15,0" ::: "memory")
50#define wmb() asm volatile("bcr 15,0" ::: "memory")
51#define rmb() asm volatile("bcr 15,0" ::: "memory")
52#endif
53
54#ifdef __sh__
55#if defined(__SH4A__) || defined(__SH5__)
56# define mb() asm volatile("synco" ::: "memory")
57# define wmb() asm volatile("synco" ::: "memory")
58# define rmb() asm volatile("synco" ::: "memory")
59#else
60# define mb() asm volatile("" ::: "memory")
61# define wmb() asm volatile("" ::: "memory")
62# define rmb() asm volatile("" ::: "memory")
63#endif
64#define CPUINFO_PROC "cpu type"
65#endif
66
67#ifdef __hppa__
68#define mb() asm volatile("" ::: "memory")
69#define wmb() asm volatile("" ::: "memory")
70#define rmb() asm volatile("" ::: "memory")
71#define CPUINFO_PROC "cpu"
72#endif
73
74#ifdef __sparc__
75#ifdef __LP64__
76#define mb() asm volatile("ba,pt %%xcc, 1f\n" \
77 "membar #StoreLoad\n" \
78 "1:\n":::"memory")
79#else
80#define mb() asm volatile("":::"memory")
81#endif
82#define wmb() asm volatile("":::"memory")
83#define rmb() asm volatile("":::"memory")
84#define CPUINFO_PROC "cpu"
85#endif
86
87#ifdef __alpha__
88#define mb() asm volatile("mb" ::: "memory")
89#define wmb() asm volatile("wmb" ::: "memory")
90#define rmb() asm volatile("mb" ::: "memory")
91#define CPUINFO_PROC "cpu model"
92#endif
93
94#ifdef __ia64__
95#define mb() asm volatile ("mf" ::: "memory")
96#define wmb() asm volatile ("mf" ::: "memory")
97#define rmb() asm volatile ("mf" ::: "memory")
98#define cpu_relax() asm volatile ("hint @pause" ::: "memory")
99#define CPUINFO_PROC "model name"
100#endif
101
102#ifdef __arm__
103/*
104 * Use the __kuser_memory_barrier helper in the CPU helper page. See
105 * arch/arm/kernel/entry-armv.S in the kernel source for details.
106 */
107#define mb() ((void(*)(void))0xffff0fa0)()
108#define wmb() ((void(*)(void))0xffff0fa0)()
109#define rmb() ((void(*)(void))0xffff0fa0)()
110#define CPUINFO_PROC "Processor"
111#endif
112
113#ifdef __aarch64__
114#define mb() asm volatile("dmb ish" ::: "memory")
115#define wmb() asm volatile("dmb ishst" ::: "memory")
116#define rmb() asm volatile("dmb ishld" ::: "memory")
117#define cpu_relax() asm volatile("yield" ::: "memory")
118#endif
119
120#ifdef __mips__
121#define mb() asm volatile( \
122 ".set mips2\n\t" \
123 "sync\n\t" \
124 ".set mips0" \
125 : /* no output */ \
126 : /* no input */ \
127 : "memory")
128#define wmb() mb()
129#define rmb() mb()
130#define CPUINFO_PROC "cpu model"
131#endif
132
133#ifdef __arc__
134#define mb() asm volatile("" ::: "memory")
135#define wmb() asm volatile("" ::: "memory")
136#define rmb() asm volatile("" ::: "memory")
137#define CPUINFO_PROC "Processor"
138#endif
139
140#ifdef __metag__
141#define mb() asm volatile("" ::: "memory")
142#define wmb() asm volatile("" ::: "memory")
143#define rmb() asm volatile("" ::: "memory")
144#define CPUINFO_PROC "CPU"
145#endif
146
147#ifdef __xtensa__
148#define mb() asm volatile("memw" ::: "memory")
149#define wmb() asm volatile("memw" ::: "memory")
150#define rmb() asm volatile("" ::: "memory")
151#define CPUINFO_PROC "core ID"
152#endif
153
154#ifdef __tile__
155#define mb() asm volatile ("mf" ::: "memory")
156#define wmb() asm volatile ("mf" ::: "memory")
157#define rmb() asm volatile ("mf" ::: "memory")
158#define cpu_relax() asm volatile ("mfspr zero, PASS" ::: "memory")
159#define CPUINFO_PROC "model name"
160#endif
161
162#define barrier() asm volatile ("" ::: "memory")
163
164#ifndef cpu_relax
165#define cpu_relax() barrier()
166#endif
167
168#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
169
170
171#include <time.h> 4#include <time.h>
172#include <unistd.h>
173#include <sys/types.h>
174#include <sys/syscall.h>
175
176#include <linux/perf_event.h>
177#include "util/types.h"
178#include <stdbool.h> 5#include <stdbool.h>
6#include <linux/types.h>
7#include <linux/perf_event.h>
179 8
180/* 9extern bool test_attr__enabled;
181 * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all 10void test_attr__init(void);
182 * counters in the current task. 11void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
183 */ 12 int fd, int group_fd, unsigned long flags);
184#define PR_TASK_PERF_EVENTS_DISABLE 31 13
185#define PR_TASK_PERF_EVENTS_ENABLE 32 14#define HAVE_ATTR_TEST
15#include "perf-sys.h"
186 16
187#ifndef NSEC_PER_SEC 17#ifndef NSEC_PER_SEC
188# define NSEC_PER_SEC 1000000000ULL 18# define NSEC_PER_SEC 1000000000ULL
@@ -199,67 +29,8 @@ static inline unsigned long long rdclock(void)
199 return ts.tv_sec * 1000000000ULL + ts.tv_nsec; 29 return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
200} 30}
201 31
202/*
203 * Pick up some kernel type conventions:
204 */
205#define __user
206#define asmlinkage
207
208#define unlikely(x) __builtin_expect(!!(x), 0)
209#define min(x, y) ({ \
210 typeof(x) _min1 = (x); \
211 typeof(y) _min2 = (y); \
212 (void) (&_min1 == &_min2); \
213 _min1 < _min2 ? _min1 : _min2; })
214
215extern bool test_attr__enabled;
216void test_attr__init(void);
217void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
218 int fd, int group_fd, unsigned long flags);
219
220static inline int
221sys_perf_event_open(struct perf_event_attr *attr,
222 pid_t pid, int cpu, int group_fd,
223 unsigned long flags)
224{
225 int fd;
226
227 fd = syscall(__NR_perf_event_open, attr, pid, cpu,
228 group_fd, flags);
229
230 if (unlikely(test_attr__enabled))
231 test_attr__open(attr, pid, cpu, fd, group_fd, flags);
232
233 return fd;
234}
235
236#define MAX_COUNTERS 256
237#define MAX_NR_CPUS 256 32#define MAX_NR_CPUS 256
238 33
239struct ip_callchain {
240 u64 nr;
241 u64 ips[0];
242};
243
244struct branch_flags {
245 u64 mispred:1;
246 u64 predicted:1;
247 u64 in_tx:1;
248 u64 abort:1;
249 u64 reserved:60;
250};
251
252struct branch_entry {
253 u64 from;
254 u64 to;
255 struct branch_flags flags;
256};
257
258struct branch_stack {
259 u64 nr;
260 struct branch_entry entries[0];
261};
262
263extern const char *input_name; 34extern const char *input_name;
264extern bool perf_host, perf_guest; 35extern bool perf_host, perf_guest;
265extern const char perf_version_string[]; 36extern const char perf_version_string[];
@@ -268,13 +39,6 @@ void pthread__unblock_sigwinch(void);
268 39
269#include "util/target.h" 40#include "util/target.h"
270 41
271enum perf_call_graph_mode {
272 CALLCHAIN_NONE,
273 CALLCHAIN_FP,
274 CALLCHAIN_DWARF,
275 CALLCHAIN_MAX
276};
277
278struct record_opts { 42struct record_opts {
279 struct target target; 43 struct target target;
280 int call_graph; 44 int call_graph;
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index 00218f503b2e..2dfc9ad0e6f2 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 * The struct perf_event_attr test support. 2 * The struct perf_event_attr test support.
4 * 3 *
@@ -19,14 +18,8 @@
19 * permissions. All the event text files are stored there. 18 * permissions. All the event text files are stored there.
20 */ 19 */
21 20
22/*
23 * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
24 * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
25 */
26#define __SANE_USERSPACE_TYPES__
27#include <stdlib.h> 21#include <stdlib.h>
28#include <stdio.h> 22#include <stdio.h>
29#include <inttypes.h>
30#include <linux/types.h> 23#include <linux/types.h>
31#include <linux/kernel.h> 24#include <linux/kernel.h>
32#include "../perf.h" 25#include "../perf.h"
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index bfb186900ac0..adf3de3e38d6 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -1,8 +1,7 @@
1#include <sys/types.h> 1#include <linux/types.h>
2#include <stdlib.h> 2#include <stdlib.h>
3#include <unistd.h> 3#include <unistd.h>
4#include <stdio.h> 4#include <stdio.h>
5#include <inttypes.h>
6#include <ctype.h> 5#include <ctype.h>
7#include <string.h> 6#include <string.h>
8 7
diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c
index 9cc81a3eb9b4..3e6cb171e3d3 100644
--- a/tools/perf/tests/dso-data.c
+++ b/tools/perf/tests/dso-data.c
@@ -1,7 +1,7 @@
1#include "util.h" 1#include "util.h"
2 2
3#include <stdlib.h> 3#include <stdlib.h>
4#include <sys/types.h> 4#include <linux/types.h>
5#include <sys/stat.h> 5#include <sys/stat.h>
6#include <fcntl.h> 6#include <fcntl.h>
7#include <string.h> 7#include <string.h>
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index c059ee81c038..108f0cd49f4e 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -1,5 +1,5 @@
1#include <linux/compiler.h> 1#include <linux/compiler.h>
2#include <sys/types.h> 2#include <linux/types.h>
3#include <unistd.h> 3#include <unistd.h>
4#include "tests.h" 4#include "tests.h"
5#include "debug.h" 5#include "debug.h"
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 497957f269d8..7a5ab7b0b8f6 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -1,4 +1,4 @@
1#include <sys/types.h> 1#include <linux/types.h>
2#include <unistd.h> 2#include <unistd.h>
3#include <sys/prctl.h> 3#include <sys/prctl.h>
4 4
diff --git a/tools/perf/tests/parse-no-sample-id-all.c b/tools/perf/tests/parse-no-sample-id-all.c
index e117b6c6a248..905019f9b740 100644
--- a/tools/perf/tests/parse-no-sample-id-all.c
+++ b/tools/perf/tests/parse-no-sample-id-all.c
@@ -1,4 +1,4 @@
1#include <sys/types.h> 1#include <linux/types.h>
2#include <stddef.h> 2#include <stddef.h>
3 3
4#include "tests.h" 4#include "tests.h"
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c
index 47146d388dbf..3b7cd4d32dcb 100644
--- a/tools/perf/tests/perf-time-to-tsc.c
+++ b/tools/perf/tests/perf-time-to-tsc.c
@@ -1,7 +1,6 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <sys/types.h>
3#include <unistd.h> 2#include <unistd.h>
4#include <inttypes.h> 3#include <linux/types.h>
5#include <sys/prctl.h> 4#include <sys/prctl.h>
6 5
7#include "parse-events.h" 6#include "parse-events.h"
diff --git a/tools/perf/tests/rdpmc.c b/tools/perf/tests/rdpmc.c
index 46649c25fa5e..e59143fd9e71 100644
--- a/tools/perf/tests/rdpmc.c
+++ b/tools/perf/tests/rdpmc.c
@@ -2,7 +2,7 @@
2#include <stdlib.h> 2#include <stdlib.h>
3#include <signal.h> 3#include <signal.h>
4#include <sys/mman.h> 4#include <sys/mman.h>
5#include "types.h" 5#include <linux/types.h>
6#include "perf.h" 6#include "perf.h"
7#include "debug.h" 7#include "debug.h"
8#include "tests.h" 8#include "tests.h"
diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
index 0014d3c8c21c..7ae8d17db3d9 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -1,5 +1,5 @@
1#include <stdbool.h> 1#include <stdbool.h>
2#include <inttypes.h> 2#include <linux/types.h>
3 3
4#include "util.h" 4#include "util.h"
5#include "event.h" 5#include "event.h"
diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h
index 118cca29dd26..03d4d6295f10 100644
--- a/tools/perf/ui/browser.h
+++ b/tools/perf/ui/browser.h
@@ -1,9 +1,7 @@
1#ifndef _PERF_UI_BROWSER_H_ 1#ifndef _PERF_UI_BROWSER_H_
2#define _PERF_UI_BROWSER_H_ 1 2#define _PERF_UI_BROWSER_H_ 1
3 3
4#include <stdbool.h> 4#include <linux/types.h>
5#include <sys/types.h>
6#include "../types.h"
7 5
8#define HE_COLORSET_TOP 50 6#define HE_COLORSET_TOP 50
9#define HE_COLORSET_MEDIUM 51 7#define HE_COLORSET_MEDIUM 51
diff --git a/tools/perf/ui/progress.h b/tools/perf/ui/progress.h
index 29ec8efffefb..f34f89eb607c 100644
--- a/tools/perf/ui/progress.h
+++ b/tools/perf/ui/progress.h
@@ -1,7 +1,7 @@
1#ifndef _PERF_UI_PROGRESS_H_ 1#ifndef _PERF_UI_PROGRESS_H_
2#define _PERF_UI_PROGRESS_H_ 1 2#define _PERF_UI_PROGRESS_H_ 1
3 3
4#include <../types.h> 4#include <linux/types.h>
5 5
6void ui_progress__finish(void); 6void ui_progress__finish(void);
7 7
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 56ad4f5287de..112d6e268150 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -3,7 +3,7 @@
3 3
4#include <stdbool.h> 4#include <stdbool.h>
5#include <stdint.h> 5#include <stdint.h>
6#include "types.h" 6#include <linux/types.h>
7#include "symbol.h" 7#include "symbol.h"
8#include "hist.h" 8#include "hist.h"
9#include "sort.h" 9#include "sort.h"
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index 845ef865eced..ae392561470b 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -4,7 +4,7 @@
4#define BUILD_ID_SIZE 20 4#define BUILD_ID_SIZE 20
5 5
6#include "tool.h" 6#include "tool.h"
7#include "types.h" 7#include <linux/types.h>
8 8
9extern struct perf_tool build_id__mark_dso_hit_ops; 9extern struct perf_tool build_id__mark_dso_hit_ops;
10struct dso; 10struct dso;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index dda4cf8b534c..bde2b0cc24cf 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -7,6 +7,13 @@
7#include "event.h" 7#include "event.h"
8#include "symbol.h" 8#include "symbol.h"
9 9
10enum perf_call_graph_mode {
11 CALLCHAIN_NONE,
12 CALLCHAIN_FP,
13 CALLCHAIN_DWARF,
14 CALLCHAIN_MAX
15};
16
10enum chain_mode { 17enum chain_mode {
11 CHAIN_NONE, 18 CHAIN_NONE,
12 CHAIN_FLAT, 19 CHAIN_FLAT,
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index ab06f1c03655..38efe95a7fdd 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -4,7 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/rbtree.h> 5#include <linux/rbtree.h>
6#include <stdbool.h> 6#include <stdbool.h>
7#include "types.h" 7#include <linux/types.h>
8#include "map.h" 8#include "map.h"
9#include "build-id.h" 9#include "build-id.h"
10 10
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 38457d447a13..d970232cb270 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -112,6 +112,30 @@ struct sample_read {
112 }; 112 };
113}; 113};
114 114
115struct ip_callchain {
116 u64 nr;
117 u64 ips[0];
118};
119
120struct branch_flags {
121 u64 mispred:1;
122 u64 predicted:1;
123 u64 in_tx:1;
124 u64 abort:1;
125 u64 reserved:60;
126};
127
128struct branch_entry {
129 u64 from;
130 u64 to;
131 struct branch_flags flags;
132};
133
134struct branch_stack {
135 u64 nr;
136 struct branch_entry entries[0];
137};
138
115struct perf_sample { 139struct perf_sample {
116 u64 ip; 140 u64 ip;
117 u32 pid, tid; 141 u32 pid, tid;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 0c581d0d5eb6..a52e9a5bb2d0 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -5,12 +5,12 @@
5#include <stdbool.h> 5#include <stdbool.h>
6#include <stddef.h> 6#include <stddef.h>
7#include <linux/perf_event.h> 7#include <linux/perf_event.h>
8#include "types.h" 8#include <linux/types.h>
9#include "xyarray.h" 9#include "xyarray.h"
10#include "cgroup.h" 10#include "cgroup.h"
11#include "hist.h" 11#include "hist.h"
12#include "symbol.h" 12#include "symbol.h"
13 13
14struct perf_counts_values { 14struct perf_counts_values {
15 union { 15 union {
16 struct { 16 struct {
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index a2d047bdf4ef..d08cfe499404 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -4,10 +4,10 @@
4#include <linux/perf_event.h> 4#include <linux/perf_event.h>
5#include <sys/types.h> 5#include <sys/types.h>
6#include <stdbool.h> 6#include <stdbool.h>
7#include "types.h" 7#include <linux/bitmap.h>
8#include <linux/types.h>
8#include "event.h" 9#include "event.h"
9 10
10#include <linux/bitmap.h>
11 11
12enum { 12enum {
13 HEADER_RESERVED = 0, /* always cleared */ 13 HEADER_RESERVED = 0, /* always cleared */
diff --git a/tools/perf/util/include/linux/bitmap.h b/tools/perf/util/include/linux/bitmap.h
index bb162e40c76c..01ffd12dc791 100644
--- a/tools/perf/util/include/linux/bitmap.h
+++ b/tools/perf/util/include/linux/bitmap.h
@@ -4,6 +4,9 @@
4#include <string.h> 4#include <string.h>
5#include <linux/bitops.h> 5#include <linux/bitops.h>
6 6
7#define DECLARE_BITMAP(name,bits) \
8 unsigned long name[BITS_TO_LONGS(bits)]
9
7int __bitmap_weight(const unsigned long *bitmap, int bits); 10int __bitmap_weight(const unsigned long *bitmap, int bits);
8void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 11void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
9 const unsigned long *bitmap2, int bits); 12 const unsigned long *bitmap2, int bits);
diff --git a/tools/perf/util/include/linux/export.h b/tools/perf/util/include/linux/export.h
deleted file mode 100644
index b43e2dc21e04..000000000000
--- a/tools/perf/util/include/linux/export.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef PERF_LINUX_MODULE_H
2#define PERF_LINUX_MODULE_H
3
4#define EXPORT_SYMBOL(name)
5
6#endif
diff --git a/tools/perf/util/include/linux/list.h b/tools/perf/util/include/linux/list.h
index bfe0a2afd0d2..76ddbc726343 100644
--- a/tools/perf/util/include/linux/list.h
+++ b/tools/perf/util/include/linux/list.h
@@ -1,4 +1,5 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/types.h>
2 3
3#include "../../../../include/linux/list.h" 4#include "../../../../include/linux/list.h"
4 5
diff --git a/tools/perf/util/include/linux/types.h b/tools/perf/util/include/linux/types.h
deleted file mode 100644
index eb464786c084..000000000000
--- a/tools/perf/util/include/linux/types.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _PERF_LINUX_TYPES_H_
2#define _PERF_LINUX_TYPES_H_
3
4#include <asm/types.h>
5
6#ifndef __bitwise
7#define __bitwise
8#endif
9
10#ifndef __le32
11typedef __u32 __bitwise __le32;
12#endif
13
14#define DECLARE_BITMAP(name,bits) \
15 unsigned long name[BITS_TO_LONGS(bits)]
16
17struct list_head {
18 struct list_head *next, *prev;
19};
20
21struct hlist_head {
22 struct hlist_node *first;
23};
24
25struct hlist_node {
26 struct hlist_node *next, **pprev;
27};
28
29#endif
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index d6445b27d672..ae2d45110588 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -6,7 +6,7 @@
6#include <linux/rbtree.h> 6#include <linux/rbtree.h>
7#include <stdio.h> 7#include <stdio.h>
8#include <stdbool.h> 8#include <stdbool.h>
9#include "types.h" 9#include <linux/types.h>
10 10
11enum map_type { 11enum map_type {
12 MAP__FUNCTION = 0, 12 MAP__FUNCTION = 0,
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index f1cb4c4b3c70..df094b4ed5ed 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -6,9 +6,8 @@
6 6
7#include <linux/list.h> 7#include <linux/list.h>
8#include <stdbool.h> 8#include <stdbool.h>
9#include "types.h" 9#include <linux/types.h>
10#include <linux/perf_event.h> 10#include <linux/perf_event.h>
11#include "types.h"
12 11
13struct list_head; 12struct list_head;
14struct perf_evsel; 13struct perf_evsel;
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index ac9db9f699f3..0bc87ba46bf3 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -9,7 +9,7 @@
9 9
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include "types.h" 12#include <linux/types.h>
13#include "util.h" 13#include "util.h"
14#include "parse-events.h" 14#include "parse-events.h"
15#include "parse-events-bison.h" 15#include "parse-events-bison.h"
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index d6e8b6a8d7f3..79c78f74e0cf 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -1,7 +1,7 @@
1#ifndef __PERF_REGS_H 1#ifndef __PERF_REGS_H
2#define __PERF_REGS_H 2#define __PERF_REGS_H
3 3
4#include "types.h" 4#include <linux/types.h>
5#include "event.h" 5#include "event.h"
6 6
7#ifdef HAVE_PERF_REGS_SUPPORT 7#ifdef HAVE_PERF_REGS_SUPPORT
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 8b64125a9281..c14a543ce1f3 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -1,7 +1,7 @@
1#ifndef __PMU_H 1#ifndef __PMU_H
2#define __PMU_H 2#define __PMU_H
3 3
4#include <linux/bitops.h> 4#include <linux/bitmap.h>
5#include <linux/perf_event.h> 5#include <linux/perf_event.h>
6#include <stdbool.h> 6#include <stdbool.h>
7 7
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index ae8ccd7227cf..5667fc3e39cf 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -1,7 +1,7 @@
1#ifndef __PERF_STATS_H 1#ifndef __PERF_STATS_H
2#define __PERF_STATS_H 2#define __PERF_STATS_H
3 3
4#include "types.h" 4#include <linux/types.h>
5 5
6struct stats 6struct stats
7{ 7{
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 43262b83c541..6a0a13d07a28 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -17,7 +17,7 @@
17#include <stdlib.h> 17#include <stdlib.h>
18#include <unistd.h> 18#include <unistd.h>
19#include <string.h> 19#include <string.h>
20#include <linux/bitops.h> 20#include <linux/bitmap.h>
21 21
22#include "perf.h" 22#include "perf.h"
23#include "svghelper.h" 23#include "svghelper.h"
diff --git a/tools/perf/util/svghelper.h b/tools/perf/util/svghelper.h
index f7b4d6e699ea..e3aff5332e30 100644
--- a/tools/perf/util/svghelper.h
+++ b/tools/perf/util/svghelper.h
@@ -1,7 +1,7 @@
1#ifndef __PERF_SVGHELPER_H 1#ifndef __PERF_SVGHELPER_H
2#define __PERF_SVGHELPER_H 2#define __PERF_SVGHELPER_H
3 3
4#include "types.h" 4#include <linux/types.h>
5 5
6extern void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end); 6extern void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end);
7extern void svg_box(int Yslot, u64 start, u64 end, const char *type); 7extern void svg_box(int Yslot, u64 start, u64 end, const char *type);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index ae94e006a52d..33ede53fa6b9 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -12,6 +12,7 @@
12#include <byteswap.h> 12#include <byteswap.h>
13#include <libgen.h> 13#include <libgen.h>
14#include "build-id.h" 14#include "build-id.h"
15#include "event.h"
15 16
16#ifdef HAVE_LIBELF_SUPPORT 17#ifdef HAVE_LIBELF_SUPPORT
17#include <libelf.h> 18#include <libelf.h>
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index dab14d0ad3d0..f92c37abb0a8 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -2,7 +2,7 @@
2#define __PERF_TOP_H 1 2#define __PERF_TOP_H 1
3 3
4#include "tool.h" 4#include "tool.h"
5#include "types.h" 5#include <linux/types.h>
6#include <stddef.h> 6#include <stddef.h>
7#include <stdbool.h> 7#include <stdbool.h>
8#include <termios.h> 8#include <termios.h>
diff --git a/tools/perf/util/types.h b/tools/perf/util/types.h
deleted file mode 100644
index 5f3689a3d085..000000000000
--- a/tools/perf/util/types.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef __PERF_TYPES_H
2#define __PERF_TYPES_H
3
4#include <stdint.h>
5
6/*
7 * We define u64 as uint64_t for every architecture
8 * so that we can print it with "%"PRIx64 without getting warnings.
9 */
10typedef uint64_t u64;
11typedef int64_t s64;
12typedef unsigned int u32;
13typedef signed int s32;
14typedef unsigned short u16;
15typedef signed short s16;
16typedef unsigned char u8;
17typedef signed char s8;
18
19#endif /* __PERF_TYPES_H */
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index 67db73ec3dab..5ec80a575b50 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -7,7 +7,7 @@
7#include "unwind-libdw.h" 7#include "unwind-libdw.h"
8#include "machine.h" 8#include "machine.h"
9#include "thread.h" 9#include "thread.h"
10#include "types.h" 10#include <linux/types.h>
11#include "event.h" 11#include "event.h"
12#include "perf_regs.h" 12#include "perf_regs.h"
13 13
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index b031316f221a..f03061260b4e 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -1,7 +1,7 @@
1#ifndef __UNWIND_H 1#ifndef __UNWIND_H
2#define __UNWIND_H 2#define __UNWIND_H
3 3
4#include "types.h" 4#include <linux/types.h>
5#include "event.h" 5#include "event.h"
6#include "symbol.h" 6#include "symbol.h"
7 7
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 6995d66f225c..b03da44e94e4 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -69,7 +69,7 @@
69#include <sys/ioctl.h> 69#include <sys/ioctl.h>
70#include <inttypes.h> 70#include <inttypes.h>
71#include <linux/magic.h> 71#include <linux/magic.h>
72#include "types.h" 72#include <linux/types.h>
73#include <sys/ttydefaults.h> 73#include <sys/ttydefaults.h>
74#include <api/fs/debugfs.h> 74#include <api/fs/debugfs.h>
75#include <termios.h> 75#include <termios.h>
diff --git a/tools/perf/util/values.h b/tools/perf/util/values.h
index 2fa967e1a88a..b21a80c6cf8d 100644
--- a/tools/perf/util/values.h
+++ b/tools/perf/util/values.h
@@ -1,7 +1,7 @@
1#ifndef __PERF_VALUES_H 1#ifndef __PERF_VALUES_H
2#define __PERF_VALUES_H 2#define __PERF_VALUES_H
3 3
4#include "types.h" 4#include <linux/types.h>
5 5
6struct perf_read_values { 6struct perf_read_values {
7 int threads; 7 int threads;
diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile
index 3187c62d9814..9325f4693821 100644
--- a/tools/virtio/Makefile
+++ b/tools/virtio/Makefile
@@ -3,7 +3,7 @@ test: virtio_test vringh_test
3virtio_test: virtio_ring.o virtio_test.o 3virtio_test: virtio_ring.o virtio_test.o
4vringh_test: vringh_test.o vringh.o virtio_ring.o 4vringh_test: vringh_test.o vringh.o virtio_ring.o
5 5
6CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE 6CFLAGS += -g -O2 -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
7vpath %.c ../../drivers/virtio ../../drivers/vhost 7vpath %.c ../../drivers/virtio ../../drivers/vhost
8mod: 8mod:
9 ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test 9 ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test
diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/linux/kernel.h
index fba705963968..1e8ce6979c1e 100644
--- a/tools/virtio/linux/kernel.h
+++ b/tools/virtio/linux/kernel.h
@@ -38,13 +38,6 @@ struct page {
38 38
39#define __printf(a,b) __attribute__((format(printf,a,b))) 39#define __printf(a,b) __attribute__((format(printf,a,b)))
40 40
41typedef enum {
42 GFP_KERNEL,
43 GFP_ATOMIC,
44 __GFP_HIGHMEM,
45 __GFP_HIGH
46} gfp_t;
47
48#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 41#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
49 42
50extern void *__kmalloc_fake, *__kfree_ignore_start, *__kfree_ignore_end; 43extern void *__kmalloc_fake, *__kfree_ignore_start, *__kfree_ignore_end;
diff --git a/tools/virtio/linux/types.h b/tools/virtio/linux/types.h
deleted file mode 100644
index f8ebb9a2b3d6..000000000000
--- a/tools/virtio/linux/types.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef TYPES_H
2#define TYPES_H
3#include <stdint.h>
4
5#define __force
6#define __user
7#define __must_check
8#define __cold
9
10typedef uint64_t u64;
11typedef int64_t s64;
12typedef uint32_t u32;
13typedef int32_t s32;
14typedef uint16_t u16;
15typedef int16_t s16;
16typedef uint8_t u8;
17typedef int8_t s8;
18
19typedef uint64_t __u64;
20typedef int64_t __s64;
21typedef uint32_t __u32;
22typedef int32_t __s32;
23typedef uint16_t __u16;
24typedef int16_t __s16;
25typedef uint8_t __u8;
26typedef int8_t __s8;
27
28#endif /* TYPES_H */