Skip to contentSkip to conversation

perf, x86: Fix :pp without LBR

PATCH In review Andi Kleen 3 participants 3 messages Aug 8, 2014 – Aug 13, 2014

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 perf, x86: Fix :pp without LBR

From: Andi Kleen <[email protected]>

This fixes a side effect of Kan's earlier patch to probe the LBRs at boot time. Normally when the LBRs are disabled cycles:pp is disabled too. So for example cycles:pp doesn't work.

However this is not needed with PEBSv2 and later (Haswell) because it does not need LBRs to correct the IP-off-by-one.

So add an extra check for PEBSv2 that also allows :pp

---
 arch/x86/kernel/cpu/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event.c +1 -1
index 2879ecd..0646d3b 100644
@@ -387,7 +387,7 @@ int x86_pmu_hw_config(struct perf_event *event)
 			precise++;
 
 			/* Support for IP fixup */
-			if (x86_pmu.lbr_nr)
+			if (x86_pmu.lbr_nr || x86_pmu.intel_cap.pebs_format >= 2)
 				precise++;
 		}
 
Signature · 1 line
1.9.3
maintainer
#1 lore raw
Quoted 21 lines · Andi Kleen

From: Andi Kleen <[email protected]>

This fixes a side effect of Kan's earlier patch to probe the LBRs at boot time. Normally when the LBRs are disabled cycles:pp is disabled too. So for example cycles:pp doesn't work.

However this is not needed with PEBSv2 and later (Haswell) because it does not need LBRs to correct the IP-off-by-one.

So add an extra check for PEBSv2 that also allows :pp

---
 arch/x86/kernel/cpu/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event.c +0 -0
index 2879ecd..0646d3b 100644

arch/x86/kernel/cpu/perf_event.c int x86_pmu_hw_config(struct perf_event *event) · line 391

Quoted 6 lines
arch/x86/kernel/cpu/perf_event.c +1 -1
@@ -387,7 +387,7 @@ int x86_pmu_hw_config(struct perf_event *event)
 			precise++;
 
 			/* Support for IP fixup */
-			if (x86_pmu.lbr_nr)
+			if (x86_pmu.lbr_nr || x86_pmu.intel_cap.pebs_format >= 2)
 				precise++;

Thanks

#2 lore raw

[tip:perf/core] perf/x86: Fix :pp without LBR

In reply to Andi Kleen
perf/x86: Fix :pp without LBR
Commit-ID:  03de874aa76ac0adcf6f56ebf3de623d09a5dde3
Gitweb:     http://git.kernel.org/tip/03de874aa76ac0adcf6f56ebf3de623d09a5dde3
Author:     Andi Kleen <[email protected]>
AuthorDate: Thu, 7 Aug 2014 17:08:54 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 13 Aug 2014 07:51:12 +0200

perf/x86: Fix :pp without LBR

This fixes a side effect of Kan's earlier patch to probe the LBRs at boot time. Normally when the LBRs are disabled cycles:pp is disabled too. So for example cycles:pp doesn't work.

However this is not needed with PEBSv2 and later (Haswell) because it does not need LBRs to correct the IP-off-by-one.

So add an extra check for PEBSv2 that also allows :pp

---
 arch/x86/kernel/cpu/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/perf_event.c +1 -1
index 2879ecd..0646d3b 100644
@@ -387,7 +387,7 @@ int x86_pmu_hw_config(struct perf_event *event)
 			precise++;
 
 			/* Support for IP fixup */
-			if (x86_pmu.lbr_nr)
+			if (x86_pmu.lbr_nr || x86_pmu.intel_cap.pebs_format >= 2)
 				precise++;
 		}