summaryrefslogtreecommitdiff
path: root/drivers/bus/arm-ccn.c
diff options
context:
space:
mode:
authorPawel Moll <pawel.moll@arm.com>2015-04-17 14:15:56 +0300
committerPawel Moll <pawel.moll@arm.com>2015-05-01 19:51:04 +0300
commit9ce1aa869e69cff8db1369e6849af9bd555b4f1d (patch)
tree0c2b3ecbe479439da264f5106ce28ba2f20dd0f2 /drivers/bus/arm-ccn.c
parent8f06c51fac1ca4104b8b64872f310e28186aea42 (diff)
downloadlinux-9ce1aa869e69cff8db1369e6849af9bd555b4f1d.tar.xz
bus: arm-ccn: Do not group CCN events with other PMUs
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>
Diffstat (limited to 'drivers/bus/arm-ccn.c')
-rw-r--r--drivers/bus/arm-ccn.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c
index 572360f1f493..fb589d4dbaf6 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,