Adds oprofile support for ppc750. ppc750 performance counters
interface is similar with G4, but it only has 4 performance counters
instead of 6.
I tested this on a PPC750GX and it seems to work fine.
tavi
For ppc750 processors which use 4 performance counters instead of the
6 G4 uses but otherwise is compatible with G4.
Signed-off-by: Octavian Purdila <redacted>
---
arch/powerpc/oprofile/op_model_7450.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
@@ -88,13 +88,12 @@ static int fsl7450_cpu_setup(struct op_counter_config *ctr)mtspr(SPRN_MMCR0,mmcr0_val);mtspr(SPRN_MMCR1,mmcr1_val);-mtspr(SPRN_MMCR2,mmcr2_val);+if(ctrs>4)+mtspr(SPRN_MMCR2,mmcr2_val);return0;}-#define NUM_CTRS 6-/* Configures the global settings for the countes on all CPUs. */staticintfsl7450_reg_setup(structop_counter_config*ctr,structop_system_config*sys,
@@ -102,12 +101,13 @@ static int fsl7450_reg_setup(struct op_counter_config *ctr,{inti;+ctrs=num_ctrs;/* Our counters count up, and "count" refers to*howmuchbeforethenextinterrupt,andweinterrupt*onoverflow.Sowecalculatethestartingvalue*whichwillgiveus"count"untiloverflow.*Thenwesettheeventsontheenabledcounters*/-for(i=0;i<NUM_CTRS;++i)+for(i=0;i<num_ctrs;++i)reset_value[i]=0x80000000UL-ctr[i].count;/* Set events for Counters 1 & 2 */
@@ -123,9 +123,10 @@ static int fsl7450_reg_setup(struct op_counter_config *ctr,/* Set events for Counters 3-6 */mmcr1_val=mmcr1_event3(ctr[2].event)-|mmcr1_event4(ctr[3].event)-|mmcr1_event5(ctr[4].event)-|mmcr1_event6(ctr[5].event);+|mmcr1_event4(ctr[3].event);+if(num_ctrs>4)+mmcr1_val|=mmcr1_event5(ctr[4].event)+|mmcr1_event6(ctr[5].event);mmcr2_val=0;
@@ -139,7 +140,7 @@ static int fsl7450_start(struct op_counter_config *ctr)mtmsr(mfmsr()|MSR_PMM);-for(i=0;i<NUM_CTRS;++i){+for(i=0;i<ctrs;++i){if(ctr[i].enabled)classic_ctr_write(i,reset_value[i]);else
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2009-01-07 02:52:42
On Tue, 2009-01-06 at 14:55 +0200, Octavian Purdila wrote:
Adds oprofile support for ppc750. ppc750 performance counters
interface is similar with G4, but it only has 4 performance counters
instead of 6.
I tested this on a PPC750GX and it seems to work fine.
I'm not too sure about using the same model as 74xx... I have some
patches that haven't been released yet from Jack Miller to implement the
full OP support for 750 but they appear to cause crashes.
There is a known HW bug in various 750's that basically make the
performance interrupt unuseable. I -think- it may have been fixed in the
very latest revision of the 750CL though but I'm not sure.
Cheers,
Ben.
On Tue, 2009-01-06 at 14:55 +0200, Octavian Purdila wrote:
quoted
Adds oprofile support for ppc750. ppc750 performance counters
interface is similar with G4, but it only has 4 performance counters
instead of 6.
I tested this on a PPC750GX and it seems to work fine.
I'm not too sure about using the same model as 74xx...=20
I've double checked the bits, and it looks to me that what is implemented i=
n=20
op_model_7450.c maps with my User=E2=80=99s Manual IBM PowerPC 750GX and 75=
0GL RISC=20
Microprocessor copy :)
I have some
patches that haven't been released yet from Jack Miller to implement the
full OP support for 750 but they appear to cause crashes.
Were they posted somewhere?
There is a known HW bug in various 750's that basically make the
performance interrupt unuseable. I -think- it may have been fixed in the
very latest revision of the 750CL though but I'm not sure.
Yeah, I've read that somewhere, but I did not notice any issues with 750GX =
I=20
am using - so far.
Thanks,
tavi
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2009-02-04 05:22:22
On Tue, 2009-01-06 at 14:55 +0200, Octavian Purdila wrote:
quoted hunk
For ppc750 processors which use 4 performance counters instead of the
6 G4 uses but otherwise is compatible with G4.
Signed-off-by: Octavian Purdila <redacted>
---
arch/powerpc/oprofile/op_model_7450.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
This may be static but it's still a global scope as far as kernel
symbols are concerned. Care to give it a slightly better name ? num_pmcs
would probably be already more telling.
Cheers,
Ben.
For ppc750 processors which use 4 performance counters instead of the
6 G4 uses but otherwise is compatible with G4.
Signed-off-by: Octavian Purdila <redacted>
---
arch/powerpc/oprofile/op_model_7450.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
@@ -88,13 +88,12 @@ static int fsl7450_cpu_setup(struct op_counter_config *ctr)mtspr(SPRN_MMCR0,mmcr0_val);mtspr(SPRN_MMCR1,mmcr1_val);-mtspr(SPRN_MMCR2,mmcr2_val);+if(num_pmcs>4)+mtspr(SPRN_MMCR2,mmcr2_val);return0;}-#define NUM_CTRS 6-/* Configures the global settings for the countes on all CPUs. */staticintfsl7450_reg_setup(structop_counter_config*ctr,structop_system_config*sys,
@@ -102,12 +101,13 @@ static int fsl7450_reg_setup(struct op_counter_config *ctr,{inti;+num_pmcs=num_ctrs;/* Our counters count up, and "count" refers to*howmuchbeforethenextinterrupt,andweinterrupt*onoverflow.Sowecalculatethestartingvalue*whichwillgiveus"count"untiloverflow.*Thenwesettheeventsontheenabledcounters*/-for(i=0;i<NUM_CTRS;++i)+for(i=0;i<num_ctrs;++i)reset_value[i]=0x80000000UL-ctr[i].count;/* Set events for Counters 1 & 2 */
@@ -123,9 +123,10 @@ static int fsl7450_reg_setup(struct op_counter_config *ctr,/* Set events for Counters 3-6 */mmcr1_val=mmcr1_event3(ctr[2].event)-|mmcr1_event4(ctr[3].event)-|mmcr1_event5(ctr[4].event)-|mmcr1_event6(ctr[5].event);+|mmcr1_event4(ctr[3].event);+if(num_ctrs>4)+mmcr1_val|=mmcr1_event5(ctr[4].event)+|mmcr1_event6(ctr[5].event);mmcr2_val=0;
@@ -139,7 +140,7 @@ static int fsl7450_start(struct op_counter_config *ctr)mtmsr(mfmsr()|MSR_PMM);-for(i=0;i<NUM_CTRS;++i){+for(i=0;i<num_pmcs;++i){if(ctr[i].enabled)classic_ctr_write(i,reset_value[i]);else
This may be static but it's still a global scope as far as kernel
symbols are concerned. Care to give it a slightly better name ? num_pmcs
would probably be already more telling.
Sure. v2 will follow, with s/ctrs/num_pmcs/.
Thanks,
tavi
I know this saves you some code, but it seems hacky. It would be
better to modify oprofile to detect the proper cpu type. Also, this
will screw things up if you try to use the different event set that
the 750 has.
Also, one more concern is the long-standing errata which makes this
quite dangerous. All of the versions of the 750 I'm aware of have a
bug where if a Performance Monitor exception occurs within one cycle
of the Decrementer exception, the cpu will lose the ability to return
from the interrupt (SRR0/SRR1 become corrupted). It's possible the
750s you have modified to support oprofile don't have this errata.
Alternatively, we can decide we don't care, as you have to be root to
use oprofile. But this is why I didn't add support for anything
before the 7450.
Andy
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2009-02-26 23:14:07
On Thu, 2009-02-26 at 16:30 -0600, Andy Fleming wrote:
I know this saves you some code, but it seems hacky. It would be
better to modify oprofile to detect the proper cpu type. Also, this
will screw things up if you try to use the different event set that
the 750 has.
Agreed. Note that Jack Miller (CC) has some patches for the oprofile
side.
Also, one more concern is the long-standing errata which makes this
quite dangerous. All of the versions of the 750 I'm aware of have a
bug where if a Performance Monitor exception occurs within one cycle
of the Decrementer exception, the cpu will lose the ability to return
from the interrupt (SRR0/SRR1 become corrupted). It's possible the
750s you have modified to support oprofile don't have this errata.
Alternatively, we can decide we don't care, as you have to be root to
use oprofile. But this is why I didn't add support for anything
before the 7450.
I think we need to advertise it as broken in some way... I -think- the
latest batch of IBM 750CL have that bug fixed but I'm not 100% certain.
Cheers,
Ben.
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
On Thu, 2009-02-26 at 16:30 -0600, Andy Fleming wrote:
quoted
I know this saves you some code, but it seems hacky. It would be
better to modify oprofile to detect the proper cpu type. Also, this
will screw things up if you try to use the different event set that
the 750 has.
Agreed. Note that Jack Miller (CC) has some patches for the oprofile
side.
Not sure I understand, but the oprofile userspace tool sees it as new
processor (ppc750). I had to patch it to add the events for the new processor.
quoted
Also, one more concern is the long-standing errata which makes this
quite dangerous. All of the versions of the 750 I'm aware of have a
bug where if a Performance Monitor exception occurs within one cycle
of the Decrementer exception, the cpu will lose the ability to return
from the interrupt (SRR0/SRR1 become corrupted). It's possible the
750s you have modified to support oprofile don't have this errata.
Alternatively, we can decide we don't care, as you have to be root to
use oprofile. But this is why I didn't add support for anything
before the 7450.
Yes, I understand. We knew about the errata and we used the timer interrupt
for profiling for some time, but then we run into some issue were we had to use
advanced counters as L1 cache misses / TLB misses to diagnose some issues and
we decided to give it a try. And _seems_ to work fine. Although we didn't
stress it too hard (around 10-20 minutes of continuous run).
So maybe it would be useful for other people in the same situation as ours.
BTW, this is the out of cat /proc/cpuinfo on our hw:
processor : 0
cpu : 750GX
temperature : 10-12 C (uncalibrated)
revision : 1.2 (pvr 7002 0102)
bogomips : 1597.44
vendor : Ixia
machine : TCPX [0x6b]
I think we need to advertise it as broken in some way...
Perhaps set it to use the timer by default, and allow the user to switch to
the hardware performance counter + printing a message that this mode is
dangerous?
Thanks,
tavi
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
On Tue, 2009-01-06 at 14:55 +0200, Octavian Purdila wrote:
quoted
Signed-off-by: Octavian Purdila <redacted>
So I'm going to merge 1/2 but this one should really be changed to
advertise ppc/750 in oprofile_cpu_type (ie. to userspace).
Sure. Here is the new patch which uses ppc/750. It enables oprofile for all 3 FX variants and GX as well.
Thanks!
tavi
commit 70f4865a614e9b0ff4594ebd52b95f78e998b79f
Author: Octavian Purdila [off-list ref]
Date: Tue Jan 6 12:51:43 2009 +0200
powerpc: oprofile: enable support for ppc750 processors
Signed-off-by: Octavian Purdila [off-list ref]