[tip:smp/hotplug] perf: Avoid cpu_hotplug_lock r-r recursion
From: tip-bot for Peter Zijlstra (Intel)
Date: Thu Apr 20 2017 - 07:33:39 EST
Commit-ID: 641693094ee1568502280f95900f374b2226b51d
Gitweb: http://git.kernel.org/tip/641693094ee1568502280f95900f374b2226b51d
Author: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
AuthorDate: Tue, 18 Apr 2017 19:05:05 +0200
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitDate: Thu, 20 Apr 2017 13:08:57 +0200
perf: Avoid cpu_hotplug_lock r-r recursion
There are two call-sites where using static_key results in recursing on the
cpu_hotplug_lock.
Use the hotplug locked version of static_key_slow_inc().
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Sebastian Siewior <bigeasy@xxxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: jbaron@xxxxxxxxxx
Link: http://lkml.kernel.org/r/20170418103422.687248115@xxxxxxxxxxxxx
---
kernel/events/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 634dd95..8aa3063 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7653,7 +7653,7 @@ static int perf_swevent_init(struct perf_event *event)
if (err)
return err;
- static_key_slow_inc(&perf_swevent_enabled[event_id]);
+ static_key_slow_inc_cpuslocked(&perf_swevent_enabled[event_id]);
event->destroy = sw_perf_event_destroy;
}
@@ -9160,7 +9160,7 @@ static void account_event(struct perf_event *event)
mutex_lock(&perf_sched_mutex);
if (!atomic_read(&perf_sched_count)) {
- static_branch_enable(&perf_sched_events);
+ static_key_slow_inc_cpuslocked(&perf_sched_events.key);
/*
* Guarantee that all CPUs observe they key change and
* call the perf scheduling hooks before proceeding to