[tip:perf/urgent] perf tools: Fix sample type size calculation in 32 bits archs

From: tip-bot for Frederic Weisbecker
Date: Mon May 23 2011 - 22:52:34 EST


Commit-ID: 0f61f3e4db71946292ef8d6d6df74b8fcf001646
Gitweb: http://git.kernel.org/tip/0f61f3e4db71946292ef8d6d6df74b8fcf001646
Author: Frederic Weisbecker <fweisbec@xxxxxxxxx>
AuthorDate: Tue, 24 May 2011 03:31:26 +0200
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Tue, 24 May 2011 04:33:24 +0200

perf tools: Fix sample type size calculation in 32 bits archs

The shift used here to count the number of bits set in
the mask doesn't work above the low part for archs that
are not 64 bits.

Fix the constant used for the shift.

This fixes a 32-bit perf top failure reported by Eric Dumazet:

Can't parse sample, err = -14
Can't parse sample, err = -14
...

Reported-and-tested-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx
Link: http://lkml.kernel.org/r/1306200686-17317-1-git-send-email-fweisbec@xxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
tools/perf/util/event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 252b72a..6635fcd 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -42,7 +42,7 @@ int perf_sample_size(u64 sample_type)
int i;

for (i = 0; i < 64; i++) {
- if (mask & (1UL << i))
+ if (mask & (1ULL << i))
size++;
}

--
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/