diff options
author | Peter Zijlstra <peterz@infradead.org> | 2016-03-22 22:09:18 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-03-31 10:30:41 +0200 |
commit | 26657848502b78474a5f17f9ce2ae6dc8d8d6262 (patch) | |
tree | 8fe05c327ca5f72701709dd25ff4f90bdce43d03 /kernel/events | |
parent | 07dc900e17a94681877b5797ce62ba97fa170400 (diff) | |
download | op-kernel-dev-26657848502b78474a5f17f9ce2ae6dc8d8d6262.zip op-kernel-dev-26657848502b78474a5f17f9ce2ae6dc8d8d6262.tar.gz |
perf/core: Verify we have a single perf_hw_context PMU
There should (and can) only be a single PMU for perf_hw_context
events.
This is because of how we schedule events: once a hardware event fails to
schedule (the PMU is 'full') we stop trying to add more. The trivial
'fix' would break the Round-Robin scheduling we do.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/events')
-rw-r--r-- | kernel/events/core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index 52bedc5..525d11c 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -7693,6 +7693,15 @@ int perf_pmu_register(struct pmu *pmu, const char *name, int type) } skip_type: + if (pmu->task_ctx_nr == perf_hw_context) { + static int hw_context_taken = 0; + + if (WARN_ON_ONCE(hw_context_taken)) + pmu->task_ctx_nr = perf_invalid_context; + + hw_context_taken = 1; + } + pmu->pmu_cpu_context = find_pmu_context(pmu->task_ctx_nr); if (pmu->pmu_cpu_context) goto got_cpu_context; |