Skip to contentSkip to conversation

perf: Fix hypervisor sample reporting

PATCH In review Anton Blanchard 1 participant 2 messages Feb 9, 2010 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Fix hypervisor sample reporting

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.

---

tools/perf/util/event.c +2 -2
index c3831f6..5a99e61 100644
@@ -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';
#1 lore raw
Commit-ID:  7fbfc683f1cc4051aa095ebe48d9d1e8b015682d
Gitweb:     http://git.kernel.org/tip/7fbfc683f1cc4051aa095ebe48d9d1e8b015682d
Author:     Anton Blanchard <[email protected]>
AuthorDate: Tue, 9 Feb 2010 14:43:05 +1100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 9 Feb 2010 10:52:40 +0100

perf: Fix hypervisor sample reporting

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.

Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>

LKML-Reference: <20100209034304.GA3702@kryten>

---
 tools/perf/util/event.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/event.c +2 -2
index bb0fd6d..8a9e6ba 100644
@@ -295,10 +295,10 @@ void thread__find_addr_location(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';