* [PATCH] powerpc/oprofile: Fix error in oprofile power7_marked_instr_event() function
@ 2012-11-29 16:42 Carl E. Love
2013-01-04 4:37 ` Benjamin Herrenschmidt
2013-01-05 0:55 ` Paul Mackerras
0 siblings, 2 replies; 3+ messages in thread
From: Carl E. Love @ 2012-11-29 16:42 UTC (permalink / raw)
To: bherren, linuxppc-dev
Ben:
Please review the following patch. If it is acceptable, will you please
commit it to the mainline tree. Thanks.
Carl Love
P.S. Looks like I sent it to the wrong mailing list the first time to
get it into the patch queue.
--------------------------------------------------------------------------
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;
unit = mmcr1 & (OPROFILE_PM_UNIT_MSK
--
1.7.12.rc1.22.gbfbf4d4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/oprofile: Fix error in oprofile power7_marked_instr_event() function
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
1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2013-01-04 4:37 UTC (permalink / raw)
To: Carl E. Love; +Cc: linuxppc-dev, Paul Mackerras, Anton Blanchard
On Thu, 2012-11-29 at 08:42 -0800, Carl E. Love wrote:
> Ben:
>
> Please review the following patch. If it is acceptable, will you please
> commit it to the mainline tree. Thanks.
>
> Carl Love
>
> P.S. Looks like I sent it to the wrong mailing list the first time to
> get it into the patch queue.
Also avoid my Notes address for patches please...
> --------------------------------------------------------------------------
> 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.
Paul, Anton, can of you ack this ?
Cheers,
Ben.
> 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;
> unit = mmcr1 & (OPROFILE_PM_UNIT_MSK
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/oprofile: Fix error in oprofile power7_marked_instr_event() function
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
1 sibling, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2013-01-05 0:55 UTC (permalink / raw)
To: Carl E. Love; +Cc: linuxppc-dev, bherren
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-05 0:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).