linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
To: Anton Blanchard <anton@ozlabs.org>,
	benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
	mikey@neuling.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/perf: Fix POWER9 branch event
Date: Mon, 19 Jun 2017 19:35:27 +0530	[thread overview]
Message-ID: <adadaf41-5a8b-0632-beff-c942081dbfe6@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170619035526.7070-1-anton@ozlabs.org>



On Monday 19 June 2017 09:25 AM, Anton Blanchard wrote:
> From: Anton Blanchard <anton@samba.org>
>
> The POWER9 branch event is wrong, and we always get a count of zero:
>
> ...
>                   0      branches
>                3844      branch-misses             #    0.00% of all branches
>
> Replace it with the correct event.
Anton,

How about this patch,  this will force DD1 to use 0x10012 for
branch and later to use 0x4d05e ?

diff --git a/arch/powerpc/perf/power9-events-list.h 
b/arch/powerpc/perf/power9-events-list.h
index 71a6bfee5c02..13bd159db300 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_BR_CMPL,                0x4d05e)
  EVENT(PM_BR_MPRED_CMPL,                0x400f6)

  /* All L1 D cache load references counted at finish, gated by reject */
@@ -56,3 +56,4 @@ EVENT(PM_RUN_CYC,                0x600f4)
  /* Instruction Dispatched */
  EVENT(PM_INST_DISP,                0x200f2)
  EVENT(PM_INST_DISP_ALT,                0x300f2)
+EVENT(PM_BR_CMPL_ALT,                0x10012)
diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
index bb28e1a41257..485dacf30152 100644
--- a/arch/powerpc/perf/power9-pmu.c
+++ b/arch/powerpc/perf/power9-pmu.c
@@ -123,7 +123,7 @@ GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC);
  GENERIC_EVENT_ATTR(stalled-cycles-frontend,    PM_ICT_NOSLOT_CYC);
  GENERIC_EVENT_ATTR(stalled-cycles-backend,    PM_CMPLU_STALL);
  GENERIC_EVENT_ATTR(instructions,        PM_INST_CMPL);
-GENERIC_EVENT_ATTR(branch-instructions,        PM_BRU_CMPL);
+GENERIC_EVENT_ATTR(branch-instructions,        PM_BR_CMPL);
  GENERIC_EVENT_ATTR(branch-misses,        PM_BR_MPRED_CMPL);
  GENERIC_EVENT_ATTR(cache-references,        PM_LD_REF_L1);
  GENERIC_EVENT_ATTR(cache-misses,        PM_LD_MISS_L1_FIN);
@@ -141,7 +141,7 @@ CACHE_EVENT_ATTR(LLC-prefetches, PM_L3_PREF_ALL);
  CACHE_EVENT_ATTR(LLC-store-misses,        PM_L2_ST_MISS);
  CACHE_EVENT_ATTR(LLC-stores,            PM_L2_ST);
  CACHE_EVENT_ATTR(branch-load-misses,        PM_BR_MPRED_CMPL);
-CACHE_EVENT_ATTR(branch-loads,            PM_BRU_CMPL);
+CACHE_EVENT_ATTR(branch-loads,            PM_BR_CMPL);
  CACHE_EVENT_ATTR(dTLB-load-misses,        PM_DTLB_MISS);
  CACHE_EVENT_ATTR(iTLB-load-misses,        PM_ITLB_MISS);

@@ -150,7 +150,7 @@ static struct attribute *power9_events_attr[] = {
      GENERIC_EVENT_PTR(PM_ICT_NOSLOT_CYC),
      GENERIC_EVENT_PTR(PM_CMPLU_STALL),
      GENERIC_EVENT_PTR(PM_INST_CMPL),
-    GENERIC_EVENT_PTR(PM_BRU_CMPL),
+    GENERIC_EVENT_PTR(PM_BR_CMPL),
      GENERIC_EVENT_PTR(PM_BR_MPRED_CMPL),
      GENERIC_EVENT_PTR(PM_LD_REF_L1),
      GENERIC_EVENT_PTR(PM_LD_MISS_L1_FIN),
@@ -167,7 +167,7 @@ static struct attribute *power9_events_attr[] = {
      CACHE_EVENT_PTR(PM_L2_ST_MISS),
      CACHE_EVENT_PTR(PM_L2_ST),
      CACHE_EVENT_PTR(PM_BR_MPRED_CMPL),
-    CACHE_EVENT_PTR(PM_BRU_CMPL),
+    CACHE_EVENT_PTR(PM_BR_CMPL),
      CACHE_EVENT_PTR(PM_DTLB_MISS),
      CACHE_EVENT_PTR(PM_ITLB_MISS),
      NULL
@@ -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,
@@ -242,7 +242,7 @@ static int power9_generic_events[] = {
      [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_CMPL,
-    [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] =        PM_BRU_CMPL,
+    [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] =        PM_BR_CMPL,
      [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,
@@ -368,7 +368,7 @@ static int 
power9_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
      },
      [ C(BPU) ] = {
          [ C(OP_READ) ] = {
-            [ C(RESULT_ACCESS) ] = PM_BRU_CMPL,
+            [ C(RESULT_ACCESS) ] = PM_BR_CMPL,
              [ C(RESULT_MISS)   ] = PM_BR_MPRED_CMPL,
          },
          [ C(OP_WRITE) ] = {
@@ -453,6 +453,10 @@ 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;
+        /*
+         * This is a hack, but then this is only for DD1
+         */
+        EVENT_VAR(PM_BR_CMPL, _g).id = PM_BR_CMPL_ALT;
          rc = register_power_pmu(&power9_isa207_pmu);
      } else {
          rc = register_power_pmu(&power9_pmu);

      reply	other threads:[~2017-06-19 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19  3:55 [PATCH] powerpc/perf: Fix POWER9 branch event Anton Blanchard
2017-06-19 14:05 ` Madhavan Srinivasan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adadaf41-5a8b-0632-beff-c942081dbfe6@linux.vnet.ibm.com \
    --to=maddy@linux.vnet.ibm.com \
    --cc=anton@ozlabs.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).