Re: [RFC][PATCH 0/5] tools, perf: Fix up for x86 UAPI disintegration

From: Namhyung Kim
Date: Fri Oct 26 2012 - 02:04:32 EST


This time, I tried on tip/master since it seemed that it contains
related patches already.

At first I got a conflict with davem's change:

--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@@ -57,7 -53,6 +53,10 @@@ void get_term_dimensions(struct winsiz
#endif

#ifdef __sparc__
++<<<<<<< HEAD
+#include "../../arch/sparc/include/uapi/asm/unistd.h"
++=======
++>>>>>>> perf: Make perf build for x86 with UAPI disintegration applied
#define rmb() asm volatile("":::"memory")
#define cpu_relax() asm volatile("":::"memory")
#define CPUINFO_PROC "cpu"


After resolving it, I got a tons of error mostly about redeclaration of
enum contants. I managed to build perf with below patch:


------------ 8< ------------------- 8< -----------------
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index da040ff69b2b..7a73f37696b7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -170,7 +170,11 @@ endif
### --- END CONFIGURATION SECTION ---

ifeq ($(srctree),)
-srctree := $(shell pwd)
+srctree := $(shell cd ../../; pwd)
+endif
+
+ifeq ($(objtree),)
+objtree := $(shell cd ../../; pwd)
endif

BASIC_CFLAGS = \
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 618d41140abd..de882d5a4ab3 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -19,7 +19,6 @@
#include "thread_map.h"
#include "target.h"
#include "../../../include/linux/hw_breakpoint.h"
-#include "../../../include/uapi/linux/perf_event.h"
#include "perf_regs.h"

#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..9ac02f655124 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -3,7 +3,7 @@

#include <linux/list.h>
#include <stdbool.h>
-#include "../../../include/uapi/linux/perf_event.h"
+#include <linux/perf_event.h>
#include "types.h"
#include "xyarray.h"
#include "cgroup.h"
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 879d215cdac9..3c24404c8523 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -1,7 +1,7 @@
#ifndef __PERF_HEADER_H
#define __PERF_HEADER_H

-#include "../../../include/uapi/linux/perf_event.h"
+#include <linux/perf_event.h>
#include <sys/types.h>
#include <stdbool.h>
#include "types.h"
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index ac9a6aacf2f5..146684787adb 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -7,7 +7,7 @@
#include <linux/list.h>
#include <stdbool.h>
#include "types.h"
-#include "../../../include/uapi/linux/perf_event.h"
+#include <linux/perf_event.h>
#include "types.h"

struct list_head;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 39f3abac7744..8410897cc856 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -2,7 +2,7 @@
#define __PMU_H

#include <linux/bitops.h>
-#include "../../../include/uapi/linux/perf_event.h"
+#include <linux/perf_event.h>

enum {
PERF_PMU_FORMAT_VALUE_CONFIG,
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index dd6426163ba6..1768581bb4a6 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -7,7 +7,7 @@
#include "symbol.h"
#include "thread.h"
#include <linux/rbtree.h>
-#include "../../../include/uapi/linux/perf_event.h"
+#include <linux/perf_event.h>

struct sample_queue;
struct ip_callchain;
------------ 8< ------------------- 8< -----------------

But it also failed to build like this:

CC builtin-kvm.o
builtin-kvm.c:146:2: error: âDB_VECTORâ undeclared here (not in a function)
builtin-kvm.c:146:2: error: âBP_VECTORâ undeclared here (not in a function)
builtin-kvm.c:146:2: error: âUD_VECTORâ undeclared here (not in a function)
builtin-kvm.c:146:2: error: âPF_VECTORâ undeclared here (not in a function)
builtin-kvm.c:146:2: error: âNM_VECTORâ undeclared here (not in a function)
builtin-kvm.c:146:2: error: âMC_VECTORâ undeclared here (not in a function)
make: *** [builtin-kvm.o] Error 1


I can see that those are defined in arch/x86/include/asm/kvm.h.


Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/