linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot for Peter Zijlstra (Intel)" <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	tglx@linutronix.de, hpa@zytor.com, bigeasy@linutronix.de
Subject: [tip:smp/hotplug] perf: Avoid cpu_hotplug_lock r-r recursion
Date: Thu, 20 Apr 2017 04:30:06 -0700	[thread overview]
Message-ID: <tip-641693094ee1568502280f95900f374b2226b51d@git.kernel.org> (raw)
In-Reply-To: <20170418103422.687248115@infradead.org>

Commit-ID:  641693094ee1568502280f95900f374b2226b51d
Gitweb:     http://git.kernel.org/tip/641693094ee1568502280f95900f374b2226b51d
Author:     Peter Zijlstra (Intel) <peterz@infradead.org>
AuthorDate: Tue, 18 Apr 2017 19:05:05 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
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@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: jbaron@akamai.com
Link: http://lkml.kernel.org/r/20170418103422.687248115@infradead.org

---
 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

      reply	other threads:[~2017-04-20 11:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 10:32 [PATCH 0/3] more cpu hotplug fail Peter Zijlstra
2017-04-18 10:32 ` [PATCH 1/3] jump_label: Pull get_online_cpus() into generic code Peter Zijlstra
2017-04-20 11:29   ` [tip:smp/hotplug] " tip-bot for Peter Zijlstra (Intel)
2017-04-21 16:08   ` [PATCH 1/3] " Jason Baron
2017-04-21 16:20     ` Peter Zijlstra
2017-04-18 10:32 ` [PATCH 2/3] jump_label: Provide static_key_slow_inc_nohp() Peter Zijlstra
2017-04-18 13:03   ` Peter Zijlstra
2017-04-18 16:46     ` Steven Rostedt
2017-04-18 20:27       ` Peter Zijlstra
2017-04-18 20:50         ` Thomas Gleixner
2017-04-19  6:39           ` Peter Zijlstra
2017-04-19  9:08             ` Thomas Gleixner
2017-04-19 12:49               ` Steven Rostedt
2017-04-19 14:08                 ` Peter Zijlstra
2017-04-19 14:21                   ` Steven Rostedt
2017-04-20 11:29   ` [tip:smp/hotplug] jump_label: Provide static_key_slow_inc_cpuslocked() tip-bot for Peter Zijlstra (Intel)
2017-04-18 10:32 ` [PATCH 3/3] perf: Avoid cpu_hotplug_lock r-r recursion Peter Zijlstra
2017-04-20 11:30   ` tip-bot for Peter Zijlstra (Intel) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-641693094ee1568502280f95900f374b2226b51d@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bigeasy@linutronix.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).