lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 19 Sep 2016 18:21:28 +0100
From:   Marc Zyngier <marc.zyngier@....com>
To:     linux-kernel@...r.kernel.org
Cc:     Jason Baron <jbaron@...mai.com>, Jonathan Corbet <corbet@....net>,
        Peter Zijlstra <peterz@...radead.org>,
        Christoffer Dall <christoffer.dall@...aro.org>,
        Vladimir Murzin <vladimir.murzin@....com>,
        Catalin Marinas <catalin.marinas@....com>
Subject: [PATCH 2/2] dynamic_debug: Use updated jump label API

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ