mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: linux-kernel@vger.kernel.org
Cc: Jason Baron <jbaron@akamai.com>, Jonathan Corbet <corbet@lwn.net>,
	Peter Zijlstra <peterz@infradead.org>,
	Christoffer Dall <christoffer.dall@linaro.org>,
	Vladimir Murzin <vladimir.murzin@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>
Subject: [PATCH 2/2] dynamic_debug: Use updated jump label API
Date: Mon, 19 Sep 2016 18:21:28 +0100	[thread overview]
Message-ID: <1474305688-22553-3-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1474305688-22553-1-git-send-email-marc.zyngier@arm.com>

Now that we have brand new DECLARE_STATIC_KEY_TRUE/FALSE and
INIT_STATIC_KEY_TRUE/FALSE as first class APIs, convert the
dynamic_debug infrastructure to use it.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 include/linux/dynamic_debug.h | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 546d680..a180dd1 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -39,8 +39,8 @@ struct _ddebug {
 	unsigned int flags:8;
 #ifdef HAVE_JUMP_LABEL
 	union {
-		struct static_key_true dd_key_true;
-		struct static_key_false dd_key_false;
+		DECLARE_STATIC_KEY_TRUE(dd_key_true);
+		DECLARE_STATIC_KEY_FALSE(dd_key_false);
 	} key;
 #endif
 } __attribute__((aligned(8)));
@@ -70,7 +70,7 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
 			  const struct net_device *dev,
 			  const char *fmt, ...);
 
-#define DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, key, init)	\
+#define DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, dd_key_init)	\
 	static struct _ddebug  __aligned(8)			\
 	__attribute__((section("__verbose"))) name = {		\
 		.modname = KBUILD_MODNAME,			\
@@ -79,24 +79,22 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
 		.format = (fmt),				\
 		.lineno = __LINE__,				\
 		.flags = _DPRINTK_FLAGS_DEFAULT,		\
-		dd_key_init(key, init)				\
+		dd_key_init					\
 	}
 
 #ifdef HAVE_JUMP_LABEL
 
-#define dd_key_init(key, init) key = (init)
-
 #ifdef DEBUG
 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
-	DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, .key.dd_key_true, \
-					  (STATIC_KEY_TRUE_INIT))
+	DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt,			\
+					  INIT_STATIC_KEY_TRUE(.key.dd_key_true))
 
 #define DYNAMIC_DEBUG_BRANCH(descriptor) \
 	static_branch_likely(&descriptor.key.dd_key_true)
 #else
 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
-	DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, .key.dd_key_false, \
-					  (STATIC_KEY_FALSE_INIT))
+	DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt,			\
+					  INIT_STATIC_KEY_FALSE(.key.dd_key_false))
 
 #define DYNAMIC_DEBUG_BRANCH(descriptor) \
 	static_branch_unlikely(&descriptor.key.dd_key_false)
@@ -104,10 +102,10 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
 
 #else
 
-#define dd_key_init(key, init)
+#define dd_key_do_nothing
 
 #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
-	DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0)
+	DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, dd_key_do_nothing)
 
 #ifdef DEBUG
 #define DYNAMIC_DEBUG_BRANCH(descriptor) \
-- 
2.1.4

      parent reply	other threads:[~2016-09-19 17:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 17:21 [PATCH 0/2] jump_labels: Embedding static keys inside structures Marc Zyngier
2016-09-19 17:21 ` [PATCH 1/2] jump_labels: Add API to deal with keys embedded in structures Marc Zyngier
2016-09-20  9:42   ` Peter Zijlstra
2016-09-20  9:46     ` Marc Zyngier
2016-09-20 12:25     ` Christoffer Dall
2016-09-20 12:42       ` Peter Zijlstra
2016-09-20 12:54         ` Christoffer Dall
2016-09-22  7:47           ` Peter Zijlstra
2016-09-19 17:21 ` Marc Zyngier [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=1474305688-22553-3-git-send-email-marc.zyngier@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=corbet@lwn.net \
    --cc=jbaron@akamai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=vladimir.murzin@arm.com \
    /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

all inboxes | Powered by JetHome®