提交 6984efb6 编写于 作者: P Paul Mackerras 提交者: Ingo Molnar

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: NPaul 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: NIngo Molnar <mingo@elte.hu>
上级 ed966aac
......@@ -242,7 +242,7 @@ static const unsigned char bytedecode_alternatives[4][4] = {
* event code for those that do, or -1 otherwise. This also handles
* alternative PCMSEL values for add events.
*/
static int find_alternative_bdecode(unsigned int event)
static s64 find_alternative_bdecode(u64 event)
{
int pmc, altpmc, pp, j;
......@@ -277,7 +277,7 @@ static int power5p_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
int nlim;
u64 ae;
s64 ae;
alt[0] = event;
nalt = 1;
......
......@@ -250,7 +250,7 @@ static const unsigned char bytedecode_alternatives[4][4] = {
* PMCSEL values on other counters. This returns the alternative
* event code for those that do, or -1 otherwise.
*/
static u64 find_alternative_bdecode(u64 event)
static s64 find_alternative_bdecode(u64 event)
{
int pmc, altpmc, pp, j;
......@@ -272,7 +272,7 @@ static u64 find_alternative_bdecode(u64 event)
static int power5_get_alternatives(u64 event, unsigned int flags, u64 alt[])
{
int i, j, nalt = 1;
u64 ae;
s64 ae;
alt[0] = event;
nalt = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册