public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mark.rutland@arm.com,
	tglx@linutronix.de, bigeasy@linutronix.de, hpa@zytor.com,
	mingo@kernel.org
Subject: [tip:smp/hotplug] jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked()
Date: Sun, 30 Apr 2017 02:44:55 -0700	[thread overview]
Message-ID: <tip-2006cddf3c2fd6b4114c704229552a903f180c71@git.kernel.org> (raw)
In-Reply-To: <1493377266-2205-2-git-send-email-mark.rutland@arm.com>

Commit-ID:  2006cddf3c2fd6b4114c704229552a903f180c71
Gitweb:     http://git.kernel.org/tip/2006cddf3c2fd6b4114c704229552a903f180c71
Author:     Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Fri, 28 Apr 2017 12:01:05 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 30 Apr 2017 11:19:01 +0200

jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked()

Provide static_key_[enable|slow_inc]_cpuslocked() variant that
don't take cpu_hotplug_lock().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: suzuki.poulose@arm.com
Cc: peterz@infradead.org
Cc: catalin.marinas@arm.com
Cc: will.deacon@arm.com
Cc: rostedt@goodmis.org
Cc: jbaron@akamai.com
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1493377266-2205-2-git-send-email-mark.rutland@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 include/linux/jump_label.h |  7 +++++++
 kernel/jump_label.c        | 10 ++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index d7b17d1..c80d8b1 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -164,6 +164,7 @@ extern void static_key_slow_dec_cpuslocked(struct static_key *key);
 extern void jump_label_apply_nops(struct module *mod);
 extern int static_key_count(struct static_key *key);
 extern void static_key_enable(struct static_key *key);
+extern void static_key_enable_cpuslocked(struct static_key *key);
 extern void static_key_disable(struct static_key *key);
 extern void static_key_disable_cpuslocked(struct static_key *key);
 
@@ -252,6 +253,11 @@ static inline void static_key_enable(struct static_key *key)
 		static_key_slow_inc(key);
 }
 
+static inline void static_key_enable_cpuslocked(struct static_key *key)
+{
+	static_key_enable(key);
+}
+
 static inline void static_key_disable(struct static_key *key)
 {
 	int count = static_key_count(key);
@@ -429,6 +435,7 @@ extern bool ____wrong_branch_error(void);
  */
 
 #define static_branch_enable(x)			static_key_enable(&(x)->key)
+#define static_branch_enable_cpuslocked(x)	static_key_enable_cpuslocked(&(x)->key)
 #define static_branch_disable(x)		static_key_disable(&(x)->key)
 #define static_branch_disable_cpuslocked(x)	static_key_disable_cpuslocked(&(x)->key)
 
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index d71124e..6343f4c 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -90,6 +90,16 @@ void static_key_enable(struct static_key *key)
 }
 EXPORT_SYMBOL_GPL(static_key_enable);
 
+void static_key_enable_cpuslocked(struct static_key *key)
+{
+	int count = static_key_count(key);
+
+	WARN_ON_ONCE(count < 0 || count > 1);
+
+	if (!count)
+		static_key_slow_inc_cpuslocked(key);
+}
+
 void static_key_disable(struct static_key *key)
 {
 	int count = static_key_count(key);

  reply	other threads:[~2017-04-30  9:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28 11:01 [PATCHv3 0/2] arm64: fix hotplug rwsem boot fallout Mark Rutland
2017-04-28 11:01 ` [PATCHv3 1/2] jump_label: Provide static_key_[enable|/slow_inc]_cpuslocked() Mark Rutland
2017-04-30  9:44   ` tip-bot for Sebastian Andrzej Siewior [this message]
2017-04-28 11:01 ` [PATCHv3 2/2] arm64: cpufeature: use static_branch_enable_cpuslocked() Mark Rutland
2017-04-30  9:45   ` [tip:smp/hotplug] arm64/cpufeature: Use static_branch_enable_cpuslocked() tip-bot for Mark Rutland
2017-05-10 18:10 ` [PATCHv3 0/2] arm64: fix hotplug rwsem boot fallout Mark Rutland
2017-05-10 20:09   ` Thomas Gleixner
2017-05-11  8:30     ` Thomas Gleixner
2017-05-11  9:37       ` Mark Rutland
2017-05-11 10:01         ` Thomas Gleixner
2017-05-11 12:54           ` Mark Rutland

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-2006cddf3c2fd6b4114c704229552a903f180c71@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=mark.rutland@arm.com \
    --cc=mingo@kernel.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