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]
Message-ID: <20170216145354.unz44uocud4ybrfq@linutronix.de>
Date:   Thu, 16 Feb 2017 15:53:55 +0100
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     Mike Galbraith <efault@....de>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        RT <linux-rt-users@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RT] lockdep munching nr_list_entries like popcorn

On 2017-02-16 15:42:59 [+0100], Mike Galbraith wrote:
> 
> Weeell, I'm trying to cobble something kinda like that together using
> __RT_SPIN_INITIALIZER() instead, but seems mean ole Mr. Compiler NAKs
> the PER_CPU_DEP_MAP_INIT() thingy.
> 
>   CC      mm/swap.o
> mm/swap.c:54:689: error: braced-group within expression allowed only
> inside a function

so this is what I have now. I need to get the `static' symbol working
again and PER_CPU_DEP_MAP_INIT but aside from that it seems to do its
job.

diff --git a/include/linux/locallock.h b/include/linux/locallock.h
index 845c77f1a5ca..36201b37012d 100644
--- a/include/linux/locallock.h
+++ b/include/linux/locallock.h
@@ -22,9 +22,27 @@ struct local_irq_lock {
 	unsigned long		flags;
 };
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#define PER_CPU_DEP_MAP_INIT(lockname)					\
+	.dep_map = {							\
+		.key = ({ static struct lock_class_key __key; &__key }),\
+		.name = #lockname,					\
+	}
+#else
+#define PER_CPU_DEP_MAP_INIT(lockname)
+#endif
+
 #define DEFINE_LOCAL_IRQ_LOCK(lvar)					\
+	struct lock_class_key lvar##__key;			\
 	DEFINE_PER_CPU(struct local_irq_lock, lvar) = {			\
-		.lock = __SPIN_LOCK_UNLOCKED((lvar).lock) }
+		.lock = {	\
+			.lock = __RT_SPIN_INITIALIZER(lvar.lock),	\
+			.dep_map = {				\
+				.key = &lvar##__key,		\
+				.name = #lvar,			\
+			}					\
+		}							\
+	}
 
 #define DECLARE_LOCAL_IRQ_LOCK(lvar)					\
 	DECLARE_PER_CPU(struct local_irq_lock, lvar)

> 	-Mike

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ