summaryrefslogtreecommitdiffstats
path: root/kernel/events
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/events')
-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 52bedc5a5aaa..525d11c59287 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;