From: pawel.moll@arm.com (Pawel Moll)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] bus: arm-ccn: Do not group CCN events with other PMUs
Date: Fri, 1 May 2015 18:36:29 +0100 [thread overview]
Message-ID: <1430501790-26918-5-git-send-email-pawel.moll@arm.com> (raw)
In-Reply-To: <1430501790-26918-1-git-send-email-pawel.moll@arm.com>
Groups must not mix events from different PMUs (software events are
allowed). Unfortunately the core does not ensures that, so it is
necessary to validate the group at the PMU driver level.
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
drivers/bus/arm-ccn.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
index 572360f..fb589d4 100644
--- a/drivers/bus/arm-ccn.c
+++ b/drivers/bus/arm-ccn.c
@@ -660,6 +660,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event)
int valid, bit;
struct arm_ccn_component *source;
int i;
+ struct perf_event *sibling;
if (event->attr.type != event->pmu->type)
return -ENOENT;
@@ -762,6 +763,21 @@ static int arm_ccn_pmu_event_init(struct perf_event *event)
node_xp, type, port);
}
+ /*
+ * We must NOT create groups containing mixed PMUs, although software
+ * events are acceptable (for example to create a CCN group
+ * periodically read when a hrtimer aka cpu-clock leader triggers).
+ */
+ if (event->group_leader->pmu != event->pmu &&
+ !is_software_event(event->group_leader))
+ return -EINVAL;
+
+ list_for_each_entry(sibling, &event->group_leader->sibling_list,
+ group_entry)
+ if (sibling->pmu != event->pmu &&
+ !is_software_event(sibling))
+ return -EINVAL;
+
/* Allocate the cycle counter */
if (type == CCN_TYPE_CYCLES) {
if (test_and_set_bit(CCN_IDX_PMU_CYCLE_COUNTER,
--
2.1.0
next prev parent reply other threads:[~2015-05-01 17:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 17:36 [PATCH 0/5] ARM CCN driver updates Pawel Moll
2015-05-01 17:36 ` [PATCH 1/5] bus: arm-ccn: Fix node->XP config conversion Pawel Moll
2015-05-01 17:36 ` [PATCH 2/5] bus: arm-ccn: cpumask attribute Pawel Moll
2015-05-01 17:36 ` [PATCH 3/5] bus: arm-ccn: Provide required event arguments Pawel Moll
2015-05-01 17:36 ` Pawel Moll [this message]
2015-05-01 17:36 ` [PATCH 5/5] bus: arm-ccn: Allocate event when it is being added, not initialised Pawel Moll
2015-05-12 14:48 ` [PATCH 0/5] ARM CCN driver updates Arnd Bergmann
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=1430501790-26918-5-git-send-email-pawel.moll@arm.com \
--to=pawel.moll@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).