aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <[email protected]>2019-11-06 12:51:04 +0100
committerIngo Molnar <[email protected]>2019-11-13 08:16:39 +0100
commit09f4e8f05d85bfc98fe9227e988a7c1b3ec416ec (patch)
treea95408ac5163a56c4a1db970968d3ea3b77db7f5 /kernel
parent485c05351312131f1c7486c623087e66bcacfbc0 (diff)
perf/core: Disallow uncore-cgroup events
While discussing uncore event scheduling, I noticed we do not in fact seem to dis-allow making uncore-cgroup events. Such events make no sense what so ever because the cgroup is a CPU local state where uncore counts across a number of CPUs. Disallow them. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/events/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index aec8dba2bea4..022a34b66e60 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10535,6 +10535,15 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
goto err_ns;
}
+ /*
+ * Disallow uncore-cgroup events, they don't make sense as the cgroup will
+ * be different on other CPUs in the uncore mask.
+ */
+ if (pmu->task_ctx_nr == perf_invalid_context && cgroup_fd != -1) {
+ err = -EINVAL;
+ goto err_pmu;
+ }
+
if (event->attr.aux_output &&
!(pmu->capabilities & PERF_PMU_CAP_AUX_OUTPUT)) {
err = -EOPNOTSUPP;