[rfc 3/3] perf, x86: P4 PMU -- export ABI part of event config to userspace
From: Cyrill Gorcunov
Date: Tue Nov 23 2010 - 17:48:40 EST
Due to tight 64 bit size of event config field (where we have to track
pretty lot of info during event lifetime) some bits are to be exported
via header into userspace.
Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
CC: Lin Ming <ming.m.lin@xxxxxxxxx>
CC: Stephane Eranian <eranian@xxxxxxxxxx>
CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
---
Note that I don't like much the idea to export anything into userspace
but it seems there is no other choise. So there is a minimum which should
be exported.
arch/x86/include/asm/Kbuild | 1 +
arch/x86/include/asm/perf_event_p4.h | 8 ++++++++
2 files changed, 9 insertions(+)
Index: linux-2.6.git/arch/x86/include/asm/Kbuild
=====================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/Kbuild
+++ linux-2.6.git/arch/x86/include/asm/Kbuild
@@ -23,3 +23,4 @@ header-y += unistd_32.h
header-y += unistd_64.h
header-y += vm86.h
header-y += vsyscall.h
+header-y += perf_event_p4.h
Index: linux-2.6.git/arch/x86/include/asm/perf_event_p4.h
=====================================================================
--- linux-2.6.git.orig/arch/x86/include/asm/perf_event_p4.h
+++ linux-2.6.git/arch/x86/include/asm/perf_event_p4.h
@@ -5,6 +5,8 @@
#ifndef PERF_EVENT_P4_H
#define PERF_EVENT_P4_H
+#ifdef __KERNEL__
+
#include <linux/cpu.h>
#include <linux/bitops.h>
@@ -201,6 +203,8 @@ static inline u32 p4_default_escr_conf(i
return escr;
}
+#endif /* __KERNEL__ */
+
/*
* This are the events which should be used in "Event Select"
* field of ESCR register, they are like unique keys which allow
@@ -256,6 +260,8 @@ enum P4_EVENTS {
P4_EVENT_INSTR_COMPLETED,
};
+#ifdef __KERNEL__
+
#define P4_OPCODE(event) event##_OPCODE
#define P4_OPCODE_ESEL(opcode) ((opcode & 0x00ff) >> 0)
#define P4_OPCODE_EVNT(opcode) ((opcode & 0xff00) >> 8)
@@ -767,6 +773,8 @@ enum P4_ESCR_EMASKS {
#define p4_config_pebs_has(v, mask) (p4_config_unpack_pebs(v) & (mask))
+#endif /* __KERNEL__ */
+
enum P4_PEBS_METRIC {
P4_PEBS_METRIC__none,
--
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/