From: Paul Mackerras <paulus@samba.org>
To: "Carl E. Love" <cel@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, bherren@au1.ibm.com
Subject: Re: [PATCH] powerpc/oprofile: Fix error in oprofile power7_marked_instr_event() function
Date: Sat, 5 Jan 2013 11:55:50 +1100 [thread overview]
Message-ID: <20130105005550.GH20724@iris.ozlabs.ibm.com> (raw)
In-Reply-To: <1354207323.5963.49.camel@oc5587145178.ibm.com>
On Thu, Nov 29, 2012 at 08:42:03AM -0800, Carl E. Love wrote:
> powerpc/oprofile: Fix error in oprofile power7_marked_instr_event() function
>
> The calculation for the left shift of the mask OPROFILE_PM_PMCSEL_MSK has an
> error. The calculation is should be to shift left by (max_cntrs - cntr) times
> the width of the pmsel field width. However, the #define OPROFILE_MAX_PMC_NUM
> was used instead of OPROFILE_PMSEL_FIELD_WIDTH. This patch fixes the
> calculation.
>
> Signed-off-by: Carl Love <cel@us.ibm.com>
> ---
> arch/powerpc/oprofile/op_model_power4.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
> index 315f949..f444b94 100644
> --- a/arch/powerpc/oprofile/op_model_power4.c
> +++ b/arch/powerpc/oprofile/op_model_power4.c
> @@ -52,7 +52,7 @@ static int power7_marked_instr_event(u64 mmcr1)
> for (pmc = 0; pmc < 4; pmc++) {
> psel = mmcr1 & (OPROFILE_PM_PMCSEL_MSK
> << (OPROFILE_MAX_PMC_NUM - pmc)
> - * OPROFILE_MAX_PMC_NUM);
> + * OPROFILE_PMSEL_FIELD_WIDTH);
> psel = (psel >> ((OPROFILE_MAX_PMC_NUM - pmc)
> * OPROFILE_PMSEL_FIELD_WIDTH)) & ~1ULL;
Apart from the fact that those two statements would be simpler and
better as:
psel = mmcr1 >> ((OPROFILE_MAX_PMC_NUM - pmc)
* OPROFILE_PMSEL_FIELD_WIDTH);
psel &= OPROFILE_PM_PMCSEL_MSK & ~1ULL;
the change looks correct, so:
Acked-by: Paul Mackerras <paulus@samba.org>
prev parent reply other threads:[~2013-01-05 0:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 16:42 [PATCH] powerpc/oprofile: Fix error in oprofile power7_marked_instr_event() function Carl E. Love
2013-01-04 4:37 ` Benjamin Herrenschmidt
2013-01-05 0:55 ` Paul Mackerras [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130105005550.GH20724@iris.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=bherren@au1.ibm.com \
--cc=cel@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).