[PATCH] perf: Fix hypervisor sample reporting

From: Anton Blanchard
Date: Mon Feb 08 2010 - 22:45:44 EST



cpumode bits are defined as such:

#define PERF_RECORD_MISC_KERNEL (1 << 0)
#define PERF_RECORD_MISC_USER (2 << 0)
#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)

We need to compare against the complete value of cpumode, otherwise hypervisor
samples get incorrectly attributed as userspace.

Signed-off-by: Anton Blanchard <anton@xxxxxxxxx>
---

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index c3831f6..5a99e61 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -436,10 +436,10 @@ void thread__find_addr_map(struct thread *self,
al->thread = self;
al->addr = addr;

- if (cpumode & PERF_RECORD_MISC_KERNEL) {
+ if (cpumode == PERF_RECORD_MISC_KERNEL) {
al->level = 'k';
mg = &session->kmaps;
- } else if (cpumode & PERF_RECORD_MISC_USER)
+ } else if (cpumode == PERF_RECORD_MISC_USER)
al->level = '.';
else {
al->level = 'H';
--
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/