All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lijun Pan <Lijun.Pan@freescale.com>
To: <linuxppc-dev@ozlabs.org>
Cc: Lijun.Pan@freescale.com, Catalin Udma <catalin.udma@freescale.com>
Subject: [PATCH 2/4] powerpc/perf: increase the perf HW events to 6
Date: Wed, 5 Jun 2013 11:17:18 -0500	[thread overview]
Message-ID: <1370449040-12970-2-git-send-email-Lijun.Pan@freescale.com> (raw)
In-Reply-To: <1370449040-12970-1-git-send-email-Lijun.Pan@freescale.com>

From: Catalin Udma <catalin.udma@freescale.com>

This change is required after the e6500 perf support has been added.
There are 6 counters in e6500 core instead of 4 in e500 core and
the MAX_HWEVENTS counter should be changed accordingly from 4 to 6.
Added also runtime check for counters overflow.

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
---
 arch/powerpc/include/asm/perf_event_fsl_emb.h |    2 +-
 arch/powerpc/perf/core-fsl-emb.c              |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/perf_event_fsl_emb.h b/arch/powerpc/include/asm/perf_event_fsl_emb.h
index 718a9fa..a581654 100644
--- a/arch/powerpc/include/asm/perf_event_fsl_emb.h
+++ b/arch/powerpc/include/asm/perf_event_fsl_emb.h
@@ -13,7 +13,7 @@
 #include <linux/types.h>
 #include <asm/hw_irq.h>
 
-#define MAX_HWEVENTS 4
+#define MAX_HWEVENTS 6
 
 /* event flags */
 #define FSL_EMB_EVENT_VALID      1
diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c
index 106c533..0b13f74 100644
--- a/arch/powerpc/perf/core-fsl-emb.c
+++ b/arch/powerpc/perf/core-fsl-emb.c
@@ -462,6 +462,12 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
 	int num_restricted;
 	int i;
 
+	if (ppmu->n_counter > MAX_HWEVENTS) {
+		WARN(1, "No. of perf counters (%d) is higher than max array size(%d)\n",
+			ppmu->n_counter, MAX_HWEVENTS);
+		ppmu->n_counter = MAX_HWEVENTS;
+	}
+
 	switch (event->attr.type) {
 	case PERF_TYPE_HARDWARE:
 		ev = event->attr.config;
-- 
1.7.9.7

  reply	other threads:[~2013-06-05 16:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 16:17 [PATCH 1/4] powerpc/perf: correct typos in counter enumeration Lijun Pan
2013-06-05 16:17 ` Lijun Pan [this message]
2013-06-05 16:17 ` [PATCH 3/4] powerpc/perf: add 2 additional performance monitor counters for e6500 core Lijun Pan
2013-06-05 16:17 ` [PATCH 4/4] powerpc/perf: Add e6500 PMU driver Lijun Pan
2013-06-05 20:01 [PATCH 1/4] powerpc/perf: correct typos in counter enumeration Lijun Pan
2013-06-05 20:01 ` [PATCH 2/4] powerpc/perf: increase the perf HW events to 6 Lijun Pan
2013-06-05 20:22 [PATCH 1/4] powerpc/perf: correct typos in counter enumeration Lijun Pan
2013-06-05 20:22 ` [PATCH 2/4] powerpc/perf: increase the perf HW events to 6 Lijun Pan

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=1370449040-12970-2-git-send-email-Lijun.Pan@freescale.com \
    --to=lijun.pan@freescale.com \
    --cc=catalin.udma@freescale.com \
    --cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.