aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-11-19 17:21:03 -0500
committerDavid Howells <dhowells@redhat.com>2012-11-19 17:21:03 -0500
commitd2709c7ce4c513ab7f4ca9a106a930621811f2d3 (patch)
treeda6e14e27b02b2d234aad0eb1ccf5bbfa06d0cb8 /tools
parentf2d9cae9ea9e0228f6eb4d4c5ab4f548d0270d1a (diff)
perf: Make perf build for x86 with UAPI disintegration applied
Make perf build for x86 once the UAPI disintegration patches for that arch have been applied by adding the appropriate -I flags - in the right order - and then converting some #includes that use ../.. notation to find main kernel headerfiles to use <asm/foo.h> and <linux/foo.h> instead. Note that -Iarch/foo/include/uapi is present _before_ -Iarch/foo/include. This makes sure we get the userspace version of the pt_regs struct. Ideally, we wouldn't have the latter -I flag at all, but unfortunately we want asm/svm.h and asm/vmx.h in builtin-kvm.c and these aren't part of the UAPI - at least not for x86. I wonder if the bits outside of the __KERNEL__ guards *should* be transferred there. I note also that perf seems to do its dependency handling manually by listing all the header files it might want to use in LIB_H in the Makefile. Can this be changed to use -MD? Note that to do make this work, we need to export and UAPI disintegrate linux/hw_breakpoint.h, which I think should've been exported previously so that perf can access the bits. We have to do this in the same patch to maintain bisectability. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile29
-rw-r--r--tools/perf/arch/x86/include/perf_regs.h2
-rw-r--r--tools/perf/builtin-kvm.c6
-rw-r--r--tools/perf/builtin-test.c2
-rw-r--r--tools/perf/perf.h16
-rw-r--r--tools/perf/util/evsel.c4
-rw-r--r--tools/perf/util/evsel.h3
-rw-r--r--tools/perf/util/header.h2
-rw-r--r--tools/perf/util/parse-events-test.c2
-rw-r--r--tools/perf/util/parse-events.c2
-rw-r--r--tools/perf/util/parse-events.h2
-rw-r--r--tools/perf/util/pmu.h2
-rw-r--r--tools/perf/util/session.h2
13 files changed, 46 insertions, 28 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 00deed4d6159..0a619af5be43 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -169,7 +169,34 @@ endif
169 169
170### --- END CONFIGURATION SECTION --- 170### --- END CONFIGURATION SECTION ---
171 171
172BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE 172ifeq ($(srctree),)
173srctree := $(patsubst %/,%,$(dir $(shell pwd)))
174srctree := $(patsubst %/,%,$(dir $(srctree)))
175#$(info Determined 'srctree' to be $(srctree))
176endif
177
178ifneq ($(objtree),)
179#$(info Determined 'objtree' to be $(objtree))
180endif
181
182ifneq ($(OUTPUT),)
183#$(info Determined 'OUTPUT' to be $(OUTPUT))
184endif
185
186BASIC_CFLAGS = \
187 -Iutil/include \
188 -Iarch/$(ARCH)/include \
189 $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
190 -I$(srctree)/arch/$(ARCH)/include/uapi \
191 -I$(srctree)/arch/$(ARCH)/include \
192 $(if $(objtree),-I$(objtree)/include/generated/uapi) \
193 -I$(srctree)/include/uapi \
194 -I$(srctree)/include \
195 -I$(OUTPUT)util \
196 -Iutil \
197 -I. \
198 -I$(TRACE_EVENT_DIR) \
199 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
173BASIC_LDFLAGS = 200BASIC_LDFLAGS =
174 201
175# Guard against environment variables 202# Guard against environment variables
diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h
index 46fc9f15c6b3..7fcdcdbee917 100644
--- a/tools/perf/arch/x86/include/perf_regs.h
+++ b/tools/perf/arch/x86/include/perf_regs.h
@@ -3,7 +3,7 @@
3 3
4#include <stdlib.h> 4#include <stdlib.h>
5#include "../../util/types.h" 5#include "../../util/types.h"
6#include "../../../../../arch/x86/include/asm/perf_regs.h" 6#include <asm/perf_regs.h>
7 7
8#ifndef ARCH_X86_64 8#ifndef ARCH_X86_64
9#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1) 9#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 260abc535b5b..e013bdb5e24a 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -22,9 +22,9 @@
22#include <pthread.h> 22#include <pthread.h>
23#include <math.h> 23#include <math.h>
24 24
25#include "../../arch/x86/include/asm/svm.h" 25#include <asm/svm.h>
26#include "../../arch/x86/include/asm/vmx.h" 26#include <asm/vmx.h>
27#include "../../arch/x86/include/asm/kvm.h" 27#include <asm/kvm.h>
28 28
29struct event_key { 29struct event_key {
30 #define INVALID_KEY (~0ULL) 30 #define INVALID_KEY (~0ULL)
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 484f26cc0c00..5acd6e8e658b 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -15,7 +15,7 @@
15#include "util/thread_map.h" 15#include "util/thread_map.h"
16#include "util/pmu.h" 16#include "util/pmu.h"
17#include "event-parse.h" 17#include "event-parse.h"
18#include "../../include/linux/hw_breakpoint.h" 18#include <linux/hw_breakpoint.h>
19 19
20#include <sys/mman.h> 20#include <sys/mman.h>
21 21
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index e2ba8f004d32..238f923f2218 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -5,8 +5,9 @@ struct winsize;
5 5
6void get_term_dimensions(struct winsize *ws); 6void get_term_dimensions(struct winsize *ws);
7 7
8#include <asm/unistd.h>
9
8#if defined(__i386__) 10#if defined(__i386__)
9#include "../../arch/x86/include/asm/unistd.h"
10#define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") 11#define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
11#define cpu_relax() asm volatile("rep; nop" ::: "memory"); 12#define cpu_relax() asm volatile("rep; nop" ::: "memory");
12#define CPUINFO_PROC "model name" 13#define CPUINFO_PROC "model name"
@@ -16,7 +17,6 @@ void get_term_dimensions(struct winsize *ws);
16#endif 17#endif
17 18
18#if defined(__x86_64__) 19#if defined(__x86_64__)
19#include "../../arch/x86/include/asm/unistd.h"
20#define rmb() asm volatile("lfence" ::: "memory") 20#define rmb() asm volatile("lfence" ::: "memory")
21#define cpu_relax() asm volatile("rep; nop" ::: "memory"); 21#define cpu_relax() asm volatile("rep; nop" ::: "memory");
22#define CPUINFO_PROC "model name" 22#define CPUINFO_PROC "model name"
@@ -26,20 +26,17 @@ void get_term_dimensions(struct winsize *ws);
26#endif 26#endif
27 27
28#ifdef __powerpc__ 28#ifdef __powerpc__
29#include "../../arch/powerpc/include/uapi/asm/unistd.h"
30#define rmb() asm volatile ("sync" ::: "memory") 29#define rmb() asm volatile ("sync" ::: "memory")
31#define cpu_relax() asm volatile ("" ::: "memory"); 30#define cpu_relax() asm volatile ("" ::: "memory");
32#define CPUINFO_PROC "cpu" 31#define CPUINFO_PROC "cpu"
33#endif 32#endif
34 33
35#ifdef __s390__ 34#ifdef __s390__
36#include "../../arch/s390/include/asm/unistd.h"
37#define rmb() asm volatile("bcr 15,0" ::: "memory") 35#define rmb() asm volatile("bcr 15,0" ::: "memory")
38#define cpu_relax() asm volatile("" ::: "memory"); 36#define cpu_relax() asm volatile("" ::: "memory");
39#endif 37#endif
40 38
41#ifdef __sh__ 39#ifdef __sh__
42#include "../../arch/sh/include/asm/unistd.h"
43#if defined(__SH4A__) || defined(__SH5__) 40#if defined(__SH4A__) || defined(__SH5__)
44# define rmb() asm volatile("synco" ::: "memory") 41# define rmb() asm volatile("synco" ::: "memory")
45#else 42#else
@@ -50,35 +47,30 @@ void get_term_dimensions(struct winsize *ws);
50#endif 47#endif
51 48
52#ifdef __hppa__ 49#ifdef __hppa__
53#include "../../arch/parisc/include/asm/unistd.h"
54#define rmb() asm volatile("" ::: "memory") 50#define rmb() asm volatile("" ::: "memory")
55#define cpu_relax() asm volatile("" ::: "memory"); 51#define cpu_relax() asm volatile("" ::: "memory");
56#define CPUINFO_PROC "cpu" 52#define CPUINFO_PROC "cpu"
57#endif 53#endif
58 54
59#ifdef __sparc__ 55#ifdef __sparc__
60#include "../../arch/sparc/include/uapi/asm/unistd.h"
61#define rmb() asm volatile("":::"memory") 56#define rmb() asm volatile("":::"memory")
62#define cpu_relax() asm volatile("":::"memory") 57#define cpu_relax() asm volatile("":::"memory")
63#define CPUINFO_PROC "cpu" 58#define CPUINFO_PROC "cpu"
64#endif 59#endif
65 60
66#ifdef __alpha__ 61#ifdef __alpha__
67#include "../../arch/alpha/include/asm/unistd.h"
68#define rmb() asm volatile("mb" ::: "memory") 62#define rmb() asm volatile("mb" ::: "memory")
69#define cpu_relax() asm volatile("" ::: "memory") 63#define cpu_relax() asm volatile("" ::: "memory")
70#define CPUINFO_PROC "cpu model" 64#define CPUINFO_PROC "cpu model"
71#endif 65#endif
72 66
73#ifdef __ia64__ 67#ifdef __ia64__
74#include "../../arch/ia64/include/asm/unistd.h"
75#define rmb() asm volatile ("mf" ::: "memory") 68#define rmb() asm volatile ("mf" ::: "memory")
76#define cpu_relax() asm volatile ("hint @pause" ::: "memory") 69#define cpu_relax() asm volatile ("hint @pause" ::: "memory")
77#define CPUINFO_PROC "model name" 70#define CPUINFO_PROC "model name"
78#endif 71#endif
79 72
80#ifdef __arm__ 73#ifdef __arm__
81#include "../../arch/arm/include/asm/unistd.h"
82/* 74/*
83 * Use the __kuser_memory_barrier helper in the CPU helper page. See 75 * Use the __kuser_memory_barrier helper in the CPU helper page. See
84 * arch/arm/kernel/entry-armv.S in the kernel source for details. 76 * arch/arm/kernel/entry-armv.S in the kernel source for details.
@@ -89,13 +81,11 @@ void get_term_dimensions(struct winsize *ws);
89#endif 81#endif
90 82
91#ifdef __aarch64__ 83#ifdef __aarch64__
92#include "../../arch/arm64/include/asm/unistd.h"
93#define rmb() asm volatile("dmb ld" ::: "memory") 84#define rmb() asm volatile("dmb ld" ::: "memory")
94#define cpu_relax() asm volatile("yield" ::: "memory") 85#define cpu_relax() asm volatile("yield" ::: "memory")
95#endif 86#endif
96 87
97#ifdef __mips__ 88#ifdef __mips__
98#include "../../arch/mips/include/asm/unistd.h"
99#define rmb() asm volatile( \ 89#define rmb() asm volatile( \
100 ".set mips2\n\t" \ 90 ".set mips2\n\t" \
101 "sync\n\t" \ 91 "sync\n\t" \
@@ -112,7 +102,7 @@ void get_term_dimensions(struct winsize *ws);
112#include <sys/types.h> 102#include <sys/types.h>
113#include <sys/syscall.h> 103#include <sys/syscall.h>
114 104
115#include "../../include/uapi/linux/perf_event.h" 105#include <linux/perf_event.h>
116#include "util/types.h" 106#include "util/types.h"
117#include <stdbool.h> 107#include <stdbool.h>
118 108
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 618d41140abd..d144d464ce39 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -18,8 +18,8 @@
18#include "cpumap.h" 18#include "cpumap.h"
19#include "thread_map.h" 19#include "thread_map.h"
20#include "target.h" 20#include "target.h"
21#include "../../../include/linux/hw_breakpoint.h" 21#include <linux/hw_breakpoint.h>
22#include "../../../include/uapi/linux/perf_event.h" 22#include <linux/perf_event.h>
23#include "perf_regs.h" 23#include "perf_regs.h"
24 24
25#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) 25#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 6f94d6dea00f..d99b476ef37c 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -3,7 +3,8 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <stdbool.h> 5#include <stdbool.h>
6#include "../../../include/uapi/linux/perf_event.h" 6#include <stddef.h>
7#include <linux/perf_event.h>
7#include "types.h" 8#include "types.h"
8#include "xyarray.h" 9#include "xyarray.h"
9#include "cgroup.h" 10#include "cgroup.h"
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 879d215cdac9..9bc00783f24f 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -1,7 +1,7 @@
1#ifndef __PERF_HEADER_H 1#ifndef __PERF_HEADER_H
2#define __PERF_HEADER_H 2#define __PERF_HEADER_H
3 3
4#include "../../../include/uapi/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 "types.h"
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/util/parse-events-test.c
index 516ecd9ddd6e..6ef213b35ecd 100644
--- a/tools/perf/util/parse-events-test.c
+++ b/tools/perf/util/parse-events-test.c
@@ -3,7 +3,7 @@
3#include "evsel.h" 3#include "evsel.h"
4#include "evlist.h" 4#include "evlist.h"
5#include "sysfs.h" 5#include "sysfs.h"
6#include "../../../include/linux/hw_breakpoint.h" 6#include <linux/hw_breakpoint.h>
7 7
8#define TEST_ASSERT_VAL(text, cond) \ 8#define TEST_ASSERT_VAL(text, cond) \
9do { \ 9do { \
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 75c7b0fca6d9..6b6d03e93c3d 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1,4 +1,4 @@
1#include "../../../include/linux/hw_breakpoint.h" 1#include <linux/hw_breakpoint.h>
2#include "util.h" 2#include "util.h"
3#include "../perf.h" 3#include "../perf.h"
4#include "evlist.h" 4#include "evlist.h"
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 839230ceb18b..2820c407adb2 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -7,7 +7,7 @@
7#include <linux/list.h> 7#include <linux/list.h>
8#include <stdbool.h> 8#include <stdbool.h>
9#include "types.h" 9#include "types.h"
10#include "../../../include/uapi/linux/perf_event.h" 10#include <linux/perf_event.h>
11#include "types.h" 11#include "types.h"
12 12
13struct list_head; 13struct list_head;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 39f3abac7744..fdeb8ac7c5d2 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -2,7 +2,7 @@
2#define __PMU_H 2#define __PMU_H
3 3
4#include <linux/bitops.h> 4#include <linux/bitops.h>
5#include "../../../include/uapi/linux/perf_event.h" 5#include <linux/perf_event.h>
6 6
7enum { 7enum {
8 PERF_PMU_FORMAT_VALUE_CONFIG, 8 PERF_PMU_FORMAT_VALUE_CONFIG,
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index dd6426163ba6..0eae00ad5fe7 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -7,7 +7,7 @@
7#include "symbol.h" 7#include "symbol.h"
8#include "thread.h" 8#include "thread.h"
9#include <linux/rbtree.h> 9#include <linux/rbtree.h>
10#include "../../../include/uapi/linux/perf_event.h" 10#include <linux/perf_event.h>
11 11
12struct sample_queue; 12struct sample_queue;
13struct ip_callchain; 13struct ip_callchain;