Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2017-07-04 17:33:13 +0200
committerMichal Suchanek <msuchanek@suse.de>2017-07-04 17:33:39 +0200
commitb7ce4e444e92dd3c83f7be3f7881bcc3ddb06d79 (patch)
tree1b61764cbaa9d09589d374b4eb1dd6deab0bc93f
parent16ed942f26a5fe97fd9b16d77aa767c522a2afad (diff)
powerpc/perf: Fix branch event code for power9 (fate#321438,rpm-4.4.73-5
bsc#1047238).
-rw-r--r--patches.arch/powerpc-perf-0026-Fix-branch-event-code-for-power9.patch72
-rw-r--r--series.conf1
2 files changed, 73 insertions, 0 deletions
diff --git a/patches.arch/powerpc-perf-0026-Fix-branch-event-code-for-power9.patch b/patches.arch/powerpc-perf-0026-Fix-branch-event-code-for-power9.patch
new file mode 100644
index 0000000000..de0cd2792a
--- /dev/null
+++ b/patches.arch/powerpc-perf-0026-Fix-branch-event-code-for-power9.patch
@@ -0,0 +1,72 @@
+From 24bedcb7c811375a962a621613ad152d95bc28ba Mon Sep 17 00:00:00 2001
+From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
+Date: Sun, 25 Jun 2017 21:04:46 +0530
+Subject: [PATCH] powerpc/perf: Fix branch event code for power9
+
+References: fate#321438, bsc#1047238
+Patch-mainline: queued
+Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
+Git-commit: 24bedcb7c811375a962a621613ad152d95bc28ba
+
+Correct "branch" event code of Power9 is "r4d05e". Replace the current
+"branch" event code with "r4d05e" and add a hack to use "r10012" as
+event code for Power9 DD1.
+
+Fixes: d89f473ff6f8 ("powerpc/perf: Fix PM_BRU_CMPL event code for power9")
+Reported-by: Anton Blanchard <anton@samba.org>
+Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/perf/power9-events-list.h | 4 +++-
+ arch/powerpc/perf/power9-pmu.c | 8 +++++++-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/arch/powerpc/perf/power9-events-list.h b/arch/powerpc/perf/power9-events-list.h
+index 71a6bfee5c02..80204e064362 100644
+--- a/arch/powerpc/perf/power9-events-list.h
++++ b/arch/powerpc/perf/power9-events-list.h
+@@ -16,7 +16,7 @@ EVENT(PM_CYC, 0x0001e)
+ EVENT(PM_ICT_NOSLOT_CYC, 0x100f8)
+ EVENT(PM_CMPLU_STALL, 0x1e054)
+ EVENT(PM_INST_CMPL, 0x00002)
+-EVENT(PM_BRU_CMPL, 0x10012)
++EVENT(PM_BRU_CMPL, 0x4d05e)
+ EVENT(PM_BR_MPRED_CMPL, 0x400f6)
+
+ /* All L1 D cache load references counted at finish, gated by reject */
+@@ -56,3 +56,5 @@ EVENT(PM_RUN_CYC, 0x600f4)
+ /* Instruction Dispatched */
+ EVENT(PM_INST_DISP, 0x200f2)
+ EVENT(PM_INST_DISP_ALT, 0x300f2)
++/* Alternate Branch event code */
++EVENT(PM_BR_CMPL_ALT, 0x10012)
+diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
+index 018f8e90ac35..ab4765547f20 100644
+--- a/arch/powerpc/perf/power9-pmu.c
++++ b/arch/powerpc/perf/power9-pmu.c
+@@ -231,7 +231,7 @@ static int power9_generic_events_dd1[] = {
+ [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = PM_ICT_NOSLOT_CYC,
+ [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = PM_CMPLU_STALL,
+ [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_DISP,
+- [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BRU_CMPL,
++ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BR_CMPL_ALT,
+ [PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL,
+ [PERF_COUNT_HW_CACHE_REFERENCES] = PM_LD_REF_L1,
+ [PERF_COUNT_HW_CACHE_MISSES] = PM_LD_MISS_L1_FIN,
+@@ -453,6 +453,12 @@ static int __init init_power9_pmu(void)
+ * sampling scenarios in power9 DD1, instead use PM_INST_DISP.
+ */
+ EVENT_VAR(PM_INST_CMPL, _g).id = PM_INST_DISP;
++ /*
++ * Power9 DD1 should use PM_BR_CMPL_ALT event code for
++ * "branches" to provide correct counter value.
++ */
++ EVENT_VAR(PM_BRU_CMPL, _g).id = PM_BR_CMPL_ALT;
++ EVENT_VAR(PM_BRU_CMPL, _c).id = PM_BR_CMPL_ALT;
+ rc = register_power_pmu(&power9_isa207_pmu);
+ } else {
+ rc = register_power_pmu(&power9_pmu);
+--
+2.10.2
+
diff --git a/series.conf b/series.conf
index 773603074e..e90ad9f88d 100644
--- a/series.conf
+++ b/series.conf
@@ -14924,6 +14924,7 @@
patches.arch/powerpc-perf-0023-Fix-perf_get_data_addr-for-power9-DD1.patch
patches.arch/powerpc-perf-0024-Use-Instruction-Counter-value.patch
patches.arch/powerpc-perf-0025-Fix-Power9-test_adder-fields.patch
+ patches.arch/powerpc-perf-0026-Fix-branch-event-code-for-power9.patch
# PERF SP3 fate#31993
patches.suse/0001-perf-build-add-extra_ldflags-option-to-makefile