aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/perf_counter.h11
-rw-r--r--kernel/perf_counter.c5
2 files changed, 12 insertions, 4 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 004b6e162b96..c8c1dfc22c93 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -215,8 +215,11 @@ struct perf_counter_mmap_page {
215 __u32 data_head; /* head in the data section */ 215 __u32 data_head; /* head in the data section */
216}; 216};
217 217
218#define PERF_EVENT_MISC_CPUMODE_MASK (3 << 0)
219#define PERF_EVENT_MISC_CPUMODE_UNKNOWN (0 << 0)
218#define PERF_EVENT_MISC_KERNEL (1 << 0) 220#define PERF_EVENT_MISC_KERNEL (1 << 0)
219#define PERF_EVENT_MISC_USER (1 << 1) 221#define PERF_EVENT_MISC_USER (2 << 0)
222#define PERF_EVENT_MISC_HYPERVISOR (3 << 0)
220#define PERF_EVENT_MISC_OVERFLOW (1 << 2) 223#define PERF_EVENT_MISC_OVERFLOW (1 << 2)
221 224
222struct perf_event_header { 225struct perf_event_header {
@@ -596,6 +599,12 @@ extern int sysctl_perf_counter_mlock;
596 599
597extern void perf_counter_init(void); 600extern void perf_counter_init(void);
598 601
602#ifndef perf_misc_flags
603#define perf_misc_flags(regs) (user_mode(regs) ? PERF_EVENT_MISC_USER : \
604 PERF_EVENT_MISC_KERNEL)
605#define perf_instruction_pointer(regs) instruction_pointer(regs)
606#endif
607
599#else 608#else
600static inline void 609static inline void
601perf_counter_task_sched_in(struct task_struct *task, int cpu) { } 610perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 728a595399b0..57840a94b163 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2042,11 +2042,10 @@ static void perf_counter_output(struct perf_counter *counter,
2042 header.size = sizeof(header); 2042 header.size = sizeof(header);
2043 2043
2044 header.misc = PERF_EVENT_MISC_OVERFLOW; 2044 header.misc = PERF_EVENT_MISC_OVERFLOW;
2045 header.misc |= user_mode(regs) ? 2045 header.misc |= perf_misc_flags(regs);
2046 PERF_EVENT_MISC_USER : PERF_EVENT_MISC_KERNEL;
2047 2046
2048 if (record_type & PERF_RECORD_IP) { 2047 if (record_type & PERF_RECORD_IP) {
2049 ip = instruction_pointer(regs); 2048 ip = perf_instruction_pointer(regs);
2050 header.type |= PERF_RECORD_IP; 2049 header.type |= PERF_RECORD_IP;
2051 header.size += sizeof(ip); 2050 header.size += sizeof(ip);
2052 } 2051 }