diff options
author | Paul Mackerras <paulus@samba.org> | 2009-06-03 05:38:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-03 05:49:52 -0400 |
commit | 6984efb692e97ce5f75f26e595685c04c2061bac (patch) | |
tree | d7093e4fe93fbec7a244ed9b85aadcacf9c25de8 | |
parent | ed966aac335a63083d3125198479447248637d9e (diff) |
perf_counter: powerpc: Fix event alternative code generation on POWER5/5+
Commit ef923214 ("perf_counter: powerpc: use u64 for event
codes internally") introduced a bug where the return value from
function find_alternative_bdecode gets put into a u64 variable
and later tested to see if it is < 0. The effect is that we
get extra, bogus event code alternatives on POWER5 and POWER5+,
leading to error messages such as "oops compute_mmcr failed"
being printed and counters not counting properly.
This fixes it by using s64 for the return type of
find_alternative_bdecode and for the local variable that the
caller puts the value in. It also makes the event argument a
u64 on POWER5+ for consistency.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <18982.17586.666132.90983@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/powerpc/kernel/power5+-pmu.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/power5-pmu.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/power5+-pmu.c b/arch/powerpc/kernel/power5+-pmu.c index c6cdfc165d6e..8471e3c2e465 100644 --- a/arch/powerpc/kernel/power5+-pmu.c +++ b/arch/powerpc/kernel/power5+-pmu.c | |||
@@ -242,7 +242,7 @@ static const unsigned char bytedecode_alternatives[4][4] = { | |||
242 | * event code for those that do, or -1 otherwise. This also handles | 242 | * event code for those that do, or -1 otherwise. This also handles |
243 | * alternative PCMSEL values for add events. | 243 | * alternative PCMSEL values for add events. |
244 | */ | 244 | */ |
245 | static int find_alternative_bdecode(unsigned int event) | 245 | static s64 find_alternative_bdecode(u64 event) |
246 | { | 246 | { |
247 | int pmc, altpmc, pp, j; | 247 | int pmc, altpmc, pp, j; |
248 | 248 | ||
@@ -277,7 +277,7 @@ static int power5p_get_alternatives(u64 event, unsigned int flags, u64 alt[]) | |||
277 | { | 277 | { |
278 | int i, j, nalt = 1; | 278 | int i, j, nalt = 1; |
279 | int nlim; | 279 | int nlim; |
280 | u64 ae; | 280 | s64 ae; |
281 | 281 | ||
282 | alt[0] = event; | 282 | alt[0] = event; |
283 | nalt = 1; | 283 | nalt = 1; |
diff --git a/arch/powerpc/kernel/power5-pmu.c b/arch/powerpc/kernel/power5-pmu.c index d5344968ee9c..1b44c5fca189 100644 --- a/arch/powerpc/kernel/power5-pmu.c +++ b/arch/powerpc/kernel/power5-pmu.c | |||
@@ -250,7 +250,7 @@ static const unsigned char bytedecode_alternatives[4][4] = { | |||
250 | * PMCSEL values on other counters. This returns the alternative | 250 | * PMCSEL values on other counters. This returns the alternative |
251 | * event code for those that do, or -1 otherwise. | 251 | * event code for those that do, or -1 otherwise. |
252 | */ | 252 | */ |
253 | static u64 find_alternative_bdecode(u64 event) | 253 | static s64 find_alternative_bdecode(u64 event) |
254 | { | 254 | { |
255 | int pmc, altpmc, pp, j; | 255 | int pmc, altpmc, pp, j; |
256 | 256 | ||
@@ -272,7 +272,7 @@ static u64 find_alternative_bdecode(u64 event) | |||
272 | static int power5_get_alternatives(u64 event, unsigned int flags, u64 alt[]) | 272 | static int power5_get_alternatives(u64 event, unsigned int flags, u64 alt[]) |
273 | { | 273 | { |
274 | int i, j, nalt = 1; | 274 | int i, j, nalt = 1; |
275 | u64 ae; | 275 | s64 ae; |
276 | 276 | ||
277 | alt[0] = event; | 277 | alt[0] = event; |
278 | nalt = 1; | 278 | nalt = 1; |