Skip to contentSkip to conversation

powerpc/perf: Update perf_regs structure to include SIER

PATCH RESEND Superseded Madhavan Srinivasan 4 participants 7 messages Nov 26, 2018 – Nov 28, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 powerpc/perf: Update perf_regs structure to include SIER

On each sample, Sample Instruction Event Register (SIER) content is saved in pt_regs. SIER does not have a entry as-is in the pt_regs but instead, SIER content is saved in the "dar" register of pt_regs.

Patch adds another entry to the perf_regs structure to include the "SIER" printing which internally maps to the "dar" of pt_regs.

Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Anju T Sudhakar <[email protected]>
Cc Ravi Bangoria <[email protected]>
---
 arch/powerpc/include/uapi/asm/perf_regs.h       | 1 +
 arch/powerpc/perf/perf_regs.c                   | 1 +
 tools/arch/powerpc/include/uapi/asm/perf_regs.h | 1 +
 tools/perf/arch/powerpc/include/perf_regs.h     | 3 ++-
 tools/perf/arch/powerpc/util/perf_regs.c        | 1 +
 5 files changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_TRAP,
 	PERF_REG_POWERPC_DAR,
 	PERF_REG_POWERPC_DSISR,
+	PERF_REG_POWERPC_SIER,
 	PERF_REG_POWERPC_MAX,
 };
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
arch/powerpc/perf/perf_regs.c +1 -0
index 09ceea6175ba..c262aea22ad9 100644
@@ -69,6 +69,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
 	PT_REGS_OFFSET(PERF_REG_POWERPC_TRAP, trap),
 	PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar),
 	PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr),
+	PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar),
 };
 
 u64 perf_reg_value(struct pt_regs *regs, int idx)
tools/arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_TRAP,
 	PERF_REG_POWERPC_DAR,
 	PERF_REG_POWERPC_DSISR,
+	PERF_REG_POWERPC_SIER,
 	PERF_REG_POWERPC_MAX,
 };
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
tools/perf/arch/powerpc/include/perf_regs.h +2 -1
index 00e37b106913..1076393e6f43 100644
@@ -62,7 +62,8 @@ static const char *reg_names[] = {
 	[PERF_REG_POWERPC_SOFTE] = "softe",
 	[PERF_REG_POWERPC_TRAP] = "trap",
 	[PERF_REG_POWERPC_DAR] = "dar",
-	[PERF_REG_POWERPC_DSISR] = "dsisr"
+	[PERF_REG_POWERPC_DSISR] = "dsisr",
+	[PERF_REG_POWERPC_SIER] = "sier"
 };
 
 static inline const char *perf_reg_name(int id)
tools/perf/arch/powerpc/util/perf_regs.c +1 -0
index ec50939b0418..07fcd977d93e 100644
@@ -52,6 +52,7 @@ const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG(trap, PERF_REG_POWERPC_TRAP),
 	SMPL_REG(dar, PERF_REG_POWERPC_DAR),
 	SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR),
+	SMPL_REG(sier, PERF_REG_POWERPC_SIER),
 	SMPL_REG_END
 };
 
Signature · 1 line
2.7.4
#1 lore raw

Le 26/11/2018 à 19:04, Madhavan Srinivasan a écrit :

Quoted 7 lines

On each sample, Sample Instruction Event Register (SIER) content is saved in pt_regs. SIER does not have a entry as-is in the pt_regs but instead, SIER content is saved in the "dar" register of pt_regs.

Patch adds another entry to the perf_regs structure to include the "SIER" printing which internally maps to the "dar" of pt_regs.

Quoted 8 lines
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Anju T Sudhakar <[email protected]>
Cc Ravi Bangoria <[email protected]>

---

I see this patch is already in patchwork https://patchwork.ozlabs.org/patch/941908/ and I can't spot any difference between the two. Please say here (under the ---) the reason for resending.

Christophe

Quoted 70 lines
  arch/powerpc/include/uapi/asm/perf_regs.h       | 1 +
  arch/powerpc/perf/perf_regs.c                   | 1 +
  tools/arch/powerpc/include/uapi/asm/perf_regs.h | 1 +
  tools/perf/arch/powerpc/include/perf_regs.h     | 3 ++-
  tools/perf/arch/powerpc/util/perf_regs.c        | 1 +
  5 files changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
  	PERF_REG_POWERPC_TRAP,
  	PERF_REG_POWERPC_DAR,
  	PERF_REG_POWERPC_DSISR,
+	PERF_REG_POWERPC_SIER,
  	PERF_REG_POWERPC_MAX,
  };
  #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
arch/powerpc/perf/perf_regs.c +1 -0
index 09ceea6175ba..c262aea22ad9 100644
@@ -69,6 +69,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
  	PT_REGS_OFFSET(PERF_REG_POWERPC_TRAP, trap),
  	PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar),
  	PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr),
+	PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar),
  };
 
  u64 perf_reg_value(struct pt_regs *regs, int idx)
tools/arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
  	PERF_REG_POWERPC_TRAP,
  	PERF_REG_POWERPC_DAR,
  	PERF_REG_POWERPC_DSISR,
+	PERF_REG_POWERPC_SIER,
  	PERF_REG_POWERPC_MAX,
  };
  #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
tools/perf/arch/powerpc/include/perf_regs.h +2 -1
index 00e37b106913..1076393e6f43 100644
@@ -62,7 +62,8 @@ static const char *reg_names[] = {
  	[PERF_REG_POWERPC_SOFTE] = "softe",
  	[PERF_REG_POWERPC_TRAP] = "trap",
  	[PERF_REG_POWERPC_DAR] = "dar",
-	[PERF_REG_POWERPC_DSISR] = "dsisr"
+	[PERF_REG_POWERPC_DSISR] = "dsisr",
+	[PERF_REG_POWERPC_SIER] = "sier"
  };
 
  static inline const char *perf_reg_name(int id)
tools/perf/arch/powerpc/util/perf_regs.c +1 -0
index ec50939b0418..07fcd977d93e 100644
@@ -52,6 +52,7 @@ const struct sample_reg sample_reg_masks[] = {
  	SMPL_REG(trap, PERF_REG_POWERPC_TRAP),
  	SMPL_REG(dar, PERF_REG_POWERPC_DAR),
  	SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR),
+	SMPL_REG(sier, PERF_REG_POWERPC_SIER),
  	SMPL_REG_END
  };
 
#2 lore raw
Quoted 19 lines · Christophe LEROY

Le 26/11/2018 à 19:04, Madhavan Srinivasan a écrit :

Quoted 7 lines

On each sample, Sample Instruction Event Register (SIER) content is saved in pt_regs. SIER does not have a entry as-is in the pt_regs but instead, SIER content is saved in the "dar" register of pt_regs.

Patch adds another entry to the perf_regs structure to include the "SIER" printing which internally maps to the "dar" of pt_regs.

Quoted 8 lines
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Anju T Sudhakar <[email protected]>
Cc Ravi Bangoria <[email protected]>

---

Quoted 1 line

I see this patch is already in patchwork https://patchwork.ozlabs.org/patch/941908/ and I can't spot any difference between the two. Please say here (under the ---) the reason for resending.

Yes there is no change, justed added the Tested-by tag and resent it for arnaldo's review/ack.
May be should have avoided resend tag. My bad.

Maddy

Quoted 73 lines

Christophe

Quoted 68 lines

arch/powerpc/include/uapi/asm/perf_regs.h       | 1 + arch/powerpc/perf/perf_regs.c                   | 1 + tools/arch/powerpc/include/uapi/asm/perf_regs.h | 1 + tools/perf/arch/powerpc/include/perf_regs.h     | 3 ++- tools/perf/arch/powerpc/util/perf_regs.c        | 1 +

  5 files changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
       PERF_REG_POWERPC_TRAP,
       PERF_REG_POWERPC_DAR,
       PERF_REG_POWERPC_DSISR,
+    PERF_REG_POWERPC_SIER,
       PERF_REG_POWERPC_MAX,
   };
   #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
arch/powerpc/perf/perf_regs.c +1 -0
index 09ceea6175ba..c262aea22ad9 100644
@@ -69,6 +69,7 @@ static unsigned int 
 pt_regs_offset[PERF_REG_POWERPC_MAX] = {
       PT_REGS_OFFSET(PERF_REG_POWERPC_TRAP, trap),
       PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar),
       PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr),
+    PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar),
   };
     u64 perf_reg_value(struct pt_regs *regs, int idx)
tools/arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
       PERF_REG_POWERPC_TRAP,
       PERF_REG_POWERPC_DAR,
       PERF_REG_POWERPC_DSISR,
+    PERF_REG_POWERPC_SIER,
       PERF_REG_POWERPC_MAX,
   };
   #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
tools/perf/arch/powerpc/include/perf_regs.h +2 -1
index 00e37b106913..1076393e6f43 100644
@@ -62,7 +62,8 @@ static const char *reg_names[] = {
       [PERF_REG_POWERPC_SOFTE] = "softe",
       [PERF_REG_POWERPC_TRAP] = "trap",
       [PERF_REG_POWERPC_DAR] = "dar",
-    [PERF_REG_POWERPC_DSISR] = "dsisr"
+    [PERF_REG_POWERPC_DSISR] = "dsisr",
+    [PERF_REG_POWERPC_SIER] = "sier"
   };
     static inline const char *perf_reg_name(int id)
tools/perf/arch/powerpc/util/perf_regs.c +1 -0
index ec50939b0418..07fcd977d93e 100644
@@ -52,6 +52,7 @@ const struct sample_reg sample_reg_masks[] = {
       SMPL_REG(trap, PERF_REG_POWERPC_TRAP),
       SMPL_REG(dar, PERF_REG_POWERPC_DAR),
       SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR),
+    SMPL_REG(sier, PERF_REG_POWERPC_SIER),

      SMPL_REG_END
  };

#3 lore raw
In reply to Madhavan Srinivasan

Em Mon, Nov 26, 2018 at 11:34:08PM +0530, Madhavan Srinivasan escreveu:

Quoted 6 lines

On each sample, Sample Instruction Event Register (SIER) content is saved in pt_regs. SIER does not have a entry as-is in the pt_regs but instead, SIER content is saved in the "dar" register of pt_regs.

Patch adds another entry to the perf_regs structure to include the "SIER" printing which internally maps to the "dar" of pt_regs.

I think the patch is ok, when we talked in Vancouver I thought I saw something like this before, i.e. adding more registers to a perf_regs.h file, this was the cset:

commit 0da0017f72554c005c1a04c3adc5da9eb64fa7e5
Author: Hendrik Brueckner <[email protected]>
Date: Wed Nov 8 07:30:15 2017 +0100

s390/perf: extend perf_regs support to include floating-point registers

That I came across because it broke the perf build, making me add this cset:

commit 10b9baa701d5023897f70a4acb3bf0235da3dc4f
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue Nov 28 11:08:41 2017 -0300

tools arch s390: Do not include header files from the kernel sources

:-)

Michael? What about the ppc specific details?

- Arnaldo

Quoted 79 lines
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Anju T Sudhakar <[email protected]>
Cc Ravi Bangoria <[email protected]>
---
 arch/powerpc/include/uapi/asm/perf_regs.h       | 1 +
 arch/powerpc/perf/perf_regs.c                   | 1 +
 tools/arch/powerpc/include/uapi/asm/perf_regs.h | 1 +
 tools/perf/arch/powerpc/include/perf_regs.h     | 3 ++-
 tools/perf/arch/powerpc/util/perf_regs.c        | 1 +
 5 files changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_TRAP,
 	PERF_REG_POWERPC_DAR,
 	PERF_REG_POWERPC_DSISR,
+	PERF_REG_POWERPC_SIER,
 	PERF_REG_POWERPC_MAX,
 };
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
arch/powerpc/perf/perf_regs.c +1 -0
index 09ceea6175ba..c262aea22ad9 100644
@@ -69,6 +69,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
 	PT_REGS_OFFSET(PERF_REG_POWERPC_TRAP, trap),
 	PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar),
 	PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr),
+	PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar),
 };
 
 u64 perf_reg_value(struct pt_regs *regs, int idx)
tools/arch/powerpc/include/uapi/asm/perf_regs.h +1 -0
index 9e52c86ccbd3..ff91192407d1 100644
@@ -46,6 +46,7 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_TRAP,
 	PERF_REG_POWERPC_DAR,
 	PERF_REG_POWERPC_DSISR,
+	PERF_REG_POWERPC_SIER,
 	PERF_REG_POWERPC_MAX,
 };
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
tools/perf/arch/powerpc/include/perf_regs.h +2 -1
index 00e37b106913..1076393e6f43 100644
@@ -62,7 +62,8 @@ static const char *reg_names[] = {
 	[PERF_REG_POWERPC_SOFTE] = "softe",
 	[PERF_REG_POWERPC_TRAP] = "trap",
 	[PERF_REG_POWERPC_DAR] = "dar",
-	[PERF_REG_POWERPC_DSISR] = "dsisr"
+	[PERF_REG_POWERPC_DSISR] = "dsisr",
+	[PERF_REG_POWERPC_SIER] = "sier"
 };
 
 static inline const char *perf_reg_name(int id)
tools/perf/arch/powerpc/util/perf_regs.c +1 -0
index ec50939b0418..07fcd977d93e 100644
@@ -52,6 +52,7 @@ const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG(trap, PERF_REG_POWERPC_TRAP),
 	SMPL_REG(dar, PERF_REG_POWERPC_DAR),
 	SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR),
+	SMPL_REG(sier, PERF_REG_POWERPC_SIER),
 	SMPL_REG_END
 };
 
Signature · 1 line
2.7.4
Signature · 1 line
- Arnaldo
#4 lore raw
Quoted 25 lines · Arnaldo Carvalho de Melo

Em Mon, Nov 26, 2018 at 11:34:08PM +0530, Madhavan Srinivasan escreveu:

Quoted 6 lines

On each sample, Sample Instruction Event Register (SIER) content is saved in pt_regs. SIER does not have a entry as-is in the pt_regs but instead, SIER content is saved in the "dar" register of pt_regs.

Patch adds another entry to the perf_regs structure to include the "SIER" printing which internally maps to the "dar" of pt_regs.

I think the patch is ok, when we talked in Vancouver I thought I saw something like this before, i.e. adding more registers to a perf_regs.h file, this was the cset:

commit 0da0017f72554c005c1a04c3adc5da9eb64fa7e5
Author: Hendrik Brueckner <[email protected]>
Date: Wed Nov 8 07:30:15 2017 +0100

s390/perf: extend perf_regs support to include floating-point registers

That I came across because it broke the perf build, making me add this cset:

commit 10b9baa701d5023897f70a4acb3bf0235da3dc4f
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue Nov 28 11:08:41 2017 -0300

Quoted 5 lines

tools arch s390: Do not include header files from the kernel sources

:-)

Michael? What about the ppc specific details?

The only possible objection is that not all CPUs have an SIER register, so on CPUs without it you'll get the content of the DAR register rather than the SIER (because we (ab)use the DAR slot of pt_regs for the SIER).

Perhaps we should make sure that we return 0 on CPUs that don't have the register?

cheers

#5 lore raw
Quoted 30 lines · Michael Ellerman
Quoted 28 lines · Arnaldo Carvalho de Melo

Em Mon, Nov 26, 2018 at 11:34:08PM +0530, Madhavan Srinivasan escreveu:

Quoted 6 lines

On each sample, Sample Instruction Event Register (SIER) content is saved in pt_regs. SIER does not have a entry as-is in the pt_regs but instead, SIER content is saved in the "dar" register of pt_regs.

Patch adds another entry to the perf_regs structure to include the "SIER" printing which internally maps to the "dar" of pt_regs.

I think the patch is ok, when we talked in Vancouver I thought I saw something like this before, i.e. adding more registers to a perf_regs.h file, this was the cset:

commit 0da0017f72554c005c1a04c3adc5da9eb64fa7e5
Author: Hendrik Brueckner <[email protected]>
Date: Wed Nov 8 07:30:15 2017 +0100

s390/perf: extend perf_regs support to include floating-point registers

That I came across because it broke the perf build, making me add this cset:

commit 10b9baa701d5023897f70a4acb3bf0235da3dc4f
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue Nov 28 11:08:41 2017 -0300

tools arch s390: Do not include header files from the kernel sources

:-)

Quoted 7 lines
Quoted 1 line

Michael? What about the ppc specific details?

The only possible objection is that not all CPUs have an SIER register, so on CPUs without it you'll get the content of the DAR register rather than the SIER (because we (ab)use the DAR slot of pt_regs for the SIER).

Perhaps we should make sure that we return 0 on CPUs that don't have the register?

Yes this make sense. We should make it zero instead of having the DAR value. I will respin the patch with that change.

Thanks for the review comments.

Maddy

Quoted 3 lines

cheers

#6 lore raw
Quoted 36 lines · Madhavan Srinivasan
Quoted 35 lines · Michael Ellerman
Quoted 24 lines · Arnaldo Carvalho de Melo

Em Mon, Nov 26, 2018 at 11:34:08PM +0530, Madhavan Srinivasan escreveu:

Quoted 6 lines

On each sample, Sample Instruction Event Register (SIER) content is saved in pt_regs. SIER does not have a entry as-is in the pt_regs but instead, SIER content is saved in the "dar" register of pt_regs.

Patch adds another entry to the perf_regs structure to include the "SIER" printing which internally maps to the "dar" of pt_regs.

I think the patch is ok, when we talked in Vancouver I thought I saw something like this before, i.e. adding more registers to a perf_regs.h file, this was the cset:

commit 0da0017f72554c005c1a04c3adc5da9eb64fa7e5
Author: Hendrik Brueckner <[email protected]>
Date: Wed Nov 8 07:30:15 2017 +0100

s390/perf: extend perf_regs support to include floating-point registers

That I came across because it broke the perf build, making me add this cset:

commit 10b9baa701d5023897f70a4acb3bf0235da3dc4f
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue Nov 28 11:08:41 2017 -0300

Quoted 5 lines

tools arch s390: Do not include header files from the kernel sources

:-)

Michael? What about the ppc specific details?

The only possible objection is that not all CPUs have an SIER register, so on CPUs without it you'll get the content of the DAR register rather than the SIER (because we (ab)use the DAR slot of pt_regs for the SIER).

Quoted 6 lines
Quoted 2 lines

Perhaps we should make sure that we return 0 on CPUs that don't have the register?

Yes this make sense. We should make it zero instead of having the DAR value. I will respin the patch with that change.

Thanks.

There's three cases we need to cover.

The first is when we're not using core-book3s.c at all, ie. when we're using the Freescale PMU code. You can probably handle that at build time using CONFIG_FSL_EMB_PERF_EVENT?

Then there's the 32-bit case in core-book3s.c, currently that version of perf_read_regs() never sets a value in dar.

And then there's the 64-bit case but PPMU_HAS_SIER is not set.

cheers