[tip:smp/hotplug] perf: Cure hotplug lock ordering issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  924726b2b5e5000dfb8eb6032651baed1b1bdc6c
Gitweb:     http://git.kernel.org/tip/924726b2b5e5000dfb8eb6032651baed1b1bdc6c
Author:     Thomas Gleixner <tglx@xxxxxxxxxxxxx>
AuthorDate: Sun, 23 Apr 2017 12:13:09 +0200
Committer:  Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitDate: Sun, 23 Apr 2017 13:24:34 +0200

perf: Cure hotplug lock ordering issues

The get_online_cpus() rework unearthed lock ordering issues.

Reorder hotpluglock and perf_sched_mutex() to avoid circular locking
dependencies and convert static_branch_disable() to the cpuslocked version
to avoid hotplug lock recursion.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
---
 kernel/events/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 8aa3063..b5b4f52f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4016,10 +4016,12 @@ static void unaccount_event(struct perf_event *event)
 
 static void perf_sched_delayed(struct work_struct *work)
 {
+	get_online_cpus();
 	mutex_lock(&perf_sched_mutex);
 	if (atomic_dec_and_test(&perf_sched_count))
-		static_branch_disable(&perf_sched_events);
+		static_branch_disable_cpuslocked(&perf_sched_events);
 	mutex_unlock(&perf_sched_mutex);
+	put_online_cpus();
 }
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux