Skip to contentSkip to conversation

powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints

PATCH Superseded Athira Rajeev 2 participants 3 messages Sep 16, 2020 – Sep 17, 2020 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints

PMU counter support functions enforces event constraints for group of events to check if all events in a group can be monitored. Incase of event codes using PMC5 and PMC6 ( 500fa and 600f4 respectively ), not all constraints are applicable, say the threshold or sample bits. But current code includes pmc5 and pmc6 in some group constraints (like IC_DC Qualifier bits) which is actually not applicable and hence results in those events not getting counted when scheduled along with group of other events. Patch fixes this by excluding PMC5/6 from constraints which are not relevant for it.

Fixes 7ffd948 ('powerpc/perf: factor out power8 pmu functions')
---
 arch/powerpc/perf/isa207-common.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/perf/isa207-common.c +4 -0
index 964437a..186fad8 100644
@@ -288,6 +288,9 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)
 
 		mask  |= CNST_PMC_MASK(pmc);
 		value |= CNST_PMC_VAL(pmc);
+
+		if (pmc >= 5)
+			goto ebb_bhrb;
 	}
 
 	if (pmc <= 4) {
@@ -357,6 +360,7 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)
 		}
 	}
 
+ebb_bhrb:
 	if (!pmc && ebb)
 		/* EBB events must specify the PMC */
 		return -1;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 21 lines · Athira Rajeev

PMU counter support functions enforces event constraints for group of events to check if all events in a group can be monitored. Incase of event codes using PMC5 and PMC6 ( 500fa and 600f4 respectively ), not all constraints are applicable, say the threshold or sample bits. But current code includes pmc5 and pmc6 in some group constraints (like IC_DC Qualifier bits) which is actually not applicable and hence results in those events not getting counted when scheduled along with group of other events. Patch fixes this by excluding PMC5/6 from constraints which are not relevant for it.

Fixes 7ffd948 ('powerpc/perf: factor out power8 pmu functions')
---
 arch/powerpc/perf/isa207-common.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/perf/isa207-common.c +0 -0
index 964437a..186fad8 100644

arch/powerpc/perf/isa207-common.c int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) · line 293

Quoted 6 lines
arch/powerpc/perf/isa207-common.c +3 -0
@@ -288,6 +288,9 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)
 
 		mask  |= CNST_PMC_MASK(pmc);
 		value |= CNST_PMC_VAL(pmc);
+
+		if (pmc >= 5)
+			goto ebb_bhrb;

This is fairly subtle. Can you please put a block comment above the if explaining in a few lines what's going on.

cheers

#2 lore raw
Quoted 27 lines · Michael Ellerman
Quoted 22 lines · Athira Rajeev

PMU counter support functions enforces event constraints for group of events to check if all events in a group can be monitored. Incase of event codes using PMC5 and PMC6 ( 500fa and 600f4 respectively ), not all constraints are applicable, say the threshold or sample bits. But current code includes pmc5 and pmc6 in some group constraints (like IC_DC Qualifier bits) which is actually not applicable and hence results in those events not getting counted when scheduled along with group of other events. Patch fixes this by excluding PMC5/6 from constraints which are not relevant for it.

Fixes 7ffd948 ('powerpc/perf: factor out power8 pmu functions')

---
arch/powerpc/perf/isa207-common.c | 4 ++++

1 file changed, 4 insertions(+)
arch/powerpc/perf/isa207-common.c +0 -0
index 964437a..186fad8 100644
@@ -288,6 +288,9 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)
 
Quoted 8 lines

arch/powerpc/perf/isa207-common.c int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) · line 293

Quoted 5 lines
arch/powerpc/perf/isa207-common.c +3 -0
 		mask  |= CNST_PMC_MASK(pmc);
 		value |= CNST_PMC_VAL(pmc);
+
+		if (pmc >= 5)
+			goto ebb_bhrb;

This is fairly subtle. Can you please put a block comment above the if explaining in a few lines what's going on.

Hi Michael,

Sure, I will include a comment explaining the change in V2.

Thanks
Athira

Quoted 2 lines

cheers