linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] printk: Make linux/printk.h self-contained
@ 2020-06-11 12:51 Herbert Xu
  2020-06-11 15:53 ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Herbert Xu @ 2020-06-11 12:51 UTC (permalink / raw)
  To: Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List

As it stands if you include printk.h it will fail to compile
because it requires definitions from ratelimit.h.  However, simply
including ratelimit.h from printk.h does not work due to inclusion
loops involving sched.h and kernel.h.

This patch solves this by moving bits from ratelimit.h into a new
header file which can then be included by printk.h without any
worries about header loops.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h
new file mode 100644
index 000000000000..b676aa419eef
--- /dev/null
+++ b/include/linux/ratelimit_types.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_RATELIMIT_TYPES_H
+#define _LINUX_RATELIMIT_TYPES_H
+
+#include <linux/bits.h>
+#include <linux/param.h>
+#include <linux/spinlock_types.h>
+
+#define DEFAULT_RATELIMIT_INTERVAL	(5 * HZ)
+#define DEFAULT_RATELIMIT_BURST		10
+
+/* issue num suppressed message on exit */
+#define RATELIMIT_MSG_ON_RELEASE	BIT(0)
+
+struct ratelimit_state {
+	raw_spinlock_t	lock;		/* protect the state */
+
+	int		interval;
+	int		burst;
+	int		printed;
+	int		missed;
+	unsigned long	begin;
+	unsigned long	flags;
+};
+
+#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) {		\
+		.lock		= __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
+		.interval	= interval_init,			\
+		.burst		= burst_init,				\
+	}
+
+#define RATELIMIT_STATE_INIT_DISABLED					\
+	RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
+
+#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
+									\
+	struct ratelimit_state name =					\
+		RATELIMIT_STATE_INIT(name, interval_init, burst_init)	\
+
+extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
+#define __ratelimit(state) ___ratelimit(state, __func__)
+
+#endif /* _LINUX_RATELIMIT_TYPES_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index e061635e0409..1cd862cfd2f4 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -7,6 +7,7 @@
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>
 #include <linux/cache.h>
+#include <linux/ratelimit_types.h>
 
 extern const char linux_banner[];
 extern const char linux_proc_banner[];
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 8ddf79e9207a..b17e0cd0a30c 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -2,41 +2,10 @@
 #ifndef _LINUX_RATELIMIT_H
 #define _LINUX_RATELIMIT_H
 
-#include <linux/param.h>
+#include <linux/ratelimit_types.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
 
-#define DEFAULT_RATELIMIT_INTERVAL	(5 * HZ)
-#define DEFAULT_RATELIMIT_BURST		10
-
-/* issue num suppressed message on exit */
-#define RATELIMIT_MSG_ON_RELEASE	BIT(0)
-
-struct ratelimit_state {
-	raw_spinlock_t	lock;		/* protect the state */
-
-	int		interval;
-	int		burst;
-	int		printed;
-	int		missed;
-	unsigned long	begin;
-	unsigned long	flags;
-};
-
-#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) {		\
-		.lock		= __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
-		.interval	= interval_init,			\
-		.burst		= burst_init,				\
-	}
-
-#define RATELIMIT_STATE_INIT_DISABLED					\
-	RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
-
-#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
-									\
-	struct ratelimit_state name =					\
-		RATELIMIT_STATE_INIT(name, interval_init, burst_init)	\
-
 static inline void ratelimit_state_init(struct ratelimit_state *rs,
 					int interval, int burst)
 {
@@ -73,9 +42,6 @@ ratelimit_set_flags(struct ratelimit_state *rs, unsigned long flags)
 
 extern struct ratelimit_state printk_ratelimit_state;
 
-extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
-#define __ratelimit(state) ___ratelimit(state, __func__)
-
 #ifdef CONFIG_PRINTK
 
 #define WARN_ON_RATELIMIT(condition, state)	({		\
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] printk: Make linux/printk.h self-contained
  2020-06-11 12:51 [PATCH] printk: Make linux/printk.h self-contained Herbert Xu
@ 2020-06-11 15:53 ` kernel test robot
  2020-06-11 16:31 ` kernel test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2020-06-11 15:53 UTC (permalink / raw)
  To: Herbert Xu, Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List
  Cc: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5351 bytes --]

Hi Herbert,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on pmladek/for-next linux/master v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Herbert-Xu/printk-Make-linux-printk-h-self-contained/20200611-205340
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from drivers/block/drbd/drbd_interval.c:2:
>> arch/s390/include/asm/bug.h:43: warning: "BUG" redefined
43 | #define BUG() do {              |
In file included from include/linux/bug.h:32,
from include/linux/mmdebug.h:5,
from arch/s390/include/asm/cmpxchg.h:11,
from arch/s390/include/asm/atomic.h:16,
from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:44,
from include/linux/spinlock_types.h:18,
from include/linux/ratelimit_types.h:7,
from include/linux/printk.h:10,
from include/linux/kernel.h:15,
from arch/s390/include/asm/bug.h:5,
from drivers/block/drbd/drbd_interval.c:2:
include/asm-generic/bug.h:54: note: this is the location of the previous definition
54 | #define BUG() do {          |
In file included from drivers/block/drbd/drbd_interval.c:2:
>> arch/s390/include/asm/bug.h:52: warning: "WARN_ON" redefined
52 | #define WARN_ON(x) ({              |
In file included from include/linux/bug.h:32,
from include/linux/mmdebug.h:5,
from arch/s390/include/asm/cmpxchg.h:11,
from arch/s390/include/asm/atomic.h:16,
from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:44,
from include/linux/spinlock_types.h:18,
from include/linux/ratelimit_types.h:7,
from include/linux/printk.h:10,
from include/linux/kernel.h:15,
from arch/s390/include/asm/bug.h:5,
from drivers/block/drbd/drbd_interval.c:2:
include/asm-generic/bug.h:112: note: this is the location of the previous definition
112 | #define WARN_ON(condition) ({               |

vim +/BUG +43 arch/s390/include/asm/bug.h

c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  42  
2d6cd2a5908ade arch/s390/include/asm/bug.h Martin Schwidefsky 2008-12-25 @43  #define BUG() do {					\
2d6cd2a5908ade arch/s390/include/asm/bug.h Martin Schwidefsky 2008-12-25  44  	__EMIT_BUG(0);					\
5506e68975c346 arch/s390/include/asm/bug.h David Daney        2009-12-04  45  	unreachable();					\
2d6cd2a5908ade arch/s390/include/asm/bug.h Martin Schwidefsky 2008-12-25  46  } while (0)
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  47  
19d436268dde95 arch/s390/include/asm/bug.h Peter Zijlstra     2017-02-25  48  #define __WARN_FLAGS(flags) do {			\
19d436268dde95 arch/s390/include/asm/bug.h Peter Zijlstra     2017-02-25  49  	__EMIT_BUG(BUGFLAG_WARNING|(flags));		\
a9df8e325d0de5 arch/s390/include/asm/bug.h Heiko Carstens     2010-01-13  50  } while (0)
a9df8e325d0de5 arch/s390/include/asm/bug.h Heiko Carstens     2010-01-13  51  
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27 @52  #define WARN_ON(x) ({					\
fd0cbdd378258f include/asm-s390/bug.h      Heiko Carstens     2007-08-02  53  	int __ret_warn_on = !!(x);			\
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  54  	if (__builtin_constant_p(__ret_warn_on)) {	\
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  55  		if (__ret_warn_on)			\
b2be05273a1744 arch/s390/include/asm/bug.h Ben Hutchings      2010-04-03  56  			__WARN();			\
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  57  	} else {					\
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  58  		if (unlikely(__ret_warn_on))		\
b2be05273a1744 arch/s390/include/asm/bug.h Ben Hutchings      2010-04-03  59  			__WARN();			\
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  60  	}						\
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  61  	unlikely(__ret_warn_on);			\
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  62  })
c0007f1a65762e include/asm-s390/bug.h      Heiko Carstens     2007-04-27  63  

:::::: The code at line 43 was first introduced by commit
:::::: 2d6cd2a5908adecd06c8cee2a73814463ed71493 [S390] remove warnings with functions ending in BUG

:::::: TO: Martin Schwidefsky <schwidefsky@de.ibm.com>
:::::: CC: Martin Schwidefsky <schwidefsky@de.ibm.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 62307 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] printk: Make linux/printk.h self-contained
  2020-06-11 12:51 [PATCH] printk: Make linux/printk.h self-contained Herbert Xu
  2020-06-11 15:53 ` kernel test robot
@ 2020-06-11 16:31 ` kernel test robot
  2020-06-12  4:36 ` [v2 PATCH] " Herbert Xu
  2020-06-13 12:28 ` [PATCH] " kernel test robot
  3 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2020-06-11 16:31 UTC (permalink / raw)
  To: Herbert Xu, Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List
  Cc: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 11436 bytes --]

Hi Herbert,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on pmladek/for-next linux/master v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Herbert-Xu/printk-Make-linux-printk-h-self-contained/20200611-205340
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
config: powerpc64-randconfig-r013-20200611 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>, old ones prefixed by <<):

WARNING: unmet direct dependencies detected for HOTPLUG_CPU
Depends on SMP && (PPC_PSERIES || PPC_PMAC || PPC_POWERNV || FSL_SOC_BOOKE
Selected by
- PM_SLEEP_SMP && SMP && (ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE && PM_SLEEP
In file included from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
arch/powerpc/include/asm/page_32.h: In function 'clear_page':
<<                  from arch/powerpc/include/asm/bug.h:109,
>> arch/powerpc/include/asm/bug.h:87:4: error: implicit declaration of function '__WARN'
87 | __WARN(); | ^~~~~~
>> arch/powerpc/include/asm/page_32.h:54:2: note: in expansion of macro 'WARN_ON'
54 | WARN_ON((unsigned long)addr & (L1_CACHE_BYTES - 1));
| ^~~~~~~
<<                  from arch/powerpc/include/asm/bug.h:109,
>> arch/powerpc/include/asm/bug.h:90:38: error: 'TAINT_WARN' undeclared (first use in this function)
90 | BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), | ^~~~~~~~~~
arch/powerpc/include/asm/bug.h:57:10: note: in definition of macro 'BUG_ENTRY'
57 | "i" (flags), | ^~~~~
<<                  from arch/powerpc/include/asm/bug.h:109,
>> arch/powerpc/include/asm/bug.h:90:24: note: in expansion of macro 'BUGFLAG_TAINT'
90 | BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), | ^~~~~~~~~~~~~
>> arch/powerpc/include/asm/page_32.h:54:2: note: in expansion of macro 'WARN_ON'
54 | WARN_ON((unsigned long)addr & (L1_CACHE_BYTES - 1));
| ^~~~~~~
arch/powerpc/include/asm/bug.h:90:38: note: each undeclared identifier is reported only once for each function it appears in
90 | BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), | ^~~~~~~~~~
arch/powerpc/include/asm/bug.h:57:10: note: in definition of macro 'BUG_ENTRY'
57 | "i" (flags), | ^~~~~
<<                  from arch/powerpc/include/asm/bug.h:109,
>> arch/powerpc/include/asm/bug.h:90:24: note: in expansion of macro 'BUGFLAG_TAINT'
90 | BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), | ^~~~~~~~~~~~~
>> arch/powerpc/include/asm/page_32.h:54:2: note: in expansion of macro 'WARN_ON'
54 | WARN_ON((unsigned long)addr & (L1_CACHE_BYTES - 1));
| ^~~~~~~
<<                  from arch/powerpc/include/asm/bug.h:109,
>> arch/powerpc/include/asm/bug.h:58:17: error: invalid application of 'sizeof' to incomplete type 'struct bug_entry'
58 | "i" (sizeof(struct bug_entry)), | ^~~~~~
<<                  from arch/powerpc/include/asm/bug.h:109,
>> arch/powerpc/include/asm/bug.h:89:3: note: in expansion of macro 'BUG_ENTRY'
89 | BUG_ENTRY(PPC_TLNEI " %4, 0", | ^~~~~~~~~
>> arch/powerpc/include/asm/page_32.h:54:2: note: in expansion of macro 'WARN_ON'
54 | WARN_ON((unsigned long)addr & (L1_CACHE_BYTES - 1));
| ^~~~~~~
In file included from arch/powerpc/include/asm/ptrace.h:253,
from arch/powerpc/include/asm/hw_irq.h:12,
from arch/powerpc/include/asm/irqflags.h:12,
from include/linux/irqflags.h:16,
from include/asm-generic/cmpxchg-local.h:6,
from arch/powerpc/include/asm/cmpxchg.h:526,
from arch/powerpc/include/asm/atomic.h:11,
from include/linux/atomic.h:7,
from include/linux/debug_locks.h:6,
from include/linux/lockdep.h:44,
from include/linux/spinlock_types.h:18,
from include/linux/ratelimit_types.h:7,
from include/linux/printk.h:10,
from include/linux/kernel.h:15,
from include/asm-generic/bug.h:19,
from arch/powerpc/include/asm/bug.h:109,
from include/linux/bug.h:5,
from include/linux/page-flags.h:10,
from kernel/bounds.c:10:
include/linux/thread_info.h: In function 'copy_overflow':
>> include/linux/thread_info.h:134:2: error: implicit declaration of function 'WARN'
134 | WARN(1, "Buffer overflow detected (%d < %lu)!n", size, count);
| ^~~~
include/linux/thread_info.h: In function 'check_copy_size':
>> include/linux/thread_info.h:150:6: error: implicit declaration of function 'WARN_ON_ONCE'
150 | if (WARN_ON_ONCE(bytes > INT_MAX))
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
Makefile Module.symvers System.map arch block certs crypto drivers fs include init ipc kernel lib mm modules.builtin modules.builtin.modinfo modules.order net scripts security sound source usr virt vmlinux vmlinux-gdb.py vmlinux.o vmlinux.strip vmlinux.strip.gz vmlinux.symvers [scripts/Makefile.build:114: kernel/bounds.s] Error 1
Target '__build' not remade because of errors.
Makefile Module.symvers System.map arch block certs crypto drivers fs include init ipc kernel lib mm modules.builtin modules.builtin.modinfo modules.order net scripts security sound source usr virt vmlinux vmlinux-gdb.py vmlinux.o vmlinux.strip vmlinux.strip.gz vmlinux.symvers [Makefile:1188: prepare0] Error 2
Target 'prepare' not remade because of errors.
make: Makefile Module.symvers System.map arch block certs crypto drivers fs include init ipc kernel lib mm modules.builtin modules.builtin.modinfo modules.order net scripts security sound source usr virt vmlinux vmlinux-gdb.py vmlinux.o vmlinux.strip vmlinux.strip.gz vmlinux.symvers [Makefile:185: __sub-make] Error 2

vim +/__WARN +87 arch/powerpc/include/asm/bug.h

73c9ceab40b1269 include/asm-powerpc/bug.h      Jeremy Fitzhardinge 2006-12-08  51  
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  52  #define BUG_ENTRY(insn, flags, ...)			\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  53  	__asm__ __volatile__(				\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  54  		"1:	" insn "\n"			\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  55  		_EMIT_BUG_ENTRY				\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  56  		: : "i" (__FILE__), "i" (__LINE__),	\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  57  		  "i" (flags),				\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19 @58  		  "i" (sizeof(struct bug_entry)),	\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  59  		  ##__VA_ARGS__)
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  60  
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  61  /*
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  62   * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  63   * optimisations. However depending on the complexity of the condition
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  64   * some compiler versions may not produce optimal results.
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  65   */
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  66  
^1da177e4c3f415 include/asm-ppc64/bug.h        Linus Torvalds      2005-04-16  67  #define BUG() do {						\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  68  	BUG_ENTRY("twi 31, 0, 0", 0);				\
01ae45bcd48527e arch/powerpc/include/asm/bug.h David Daney         2009-12-10  69  	unreachable();						\
^1da177e4c3f415 include/asm-ppc64/bug.h        Linus Torvalds      2005-04-16  70  } while (0)
^1da177e4c3f415 include/asm-ppc64/bug.h        Linus Torvalds      2005-04-16  71  
^1da177e4c3f415 include/asm-ppc64/bug.h        Linus Torvalds      2005-04-16  72  #define BUG_ON(x) do {						\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  73  	if (__builtin_constant_p(x)) {				\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  74  		if (x)						\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  75  			BUG();					\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  76  	} else {						\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  77  		BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x)));	\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  78  	}							\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  79  } while (0)
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  80  
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19  81  #define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags))
^1da177e4c3f415 include/asm-ppc64/bug.h        Linus Torvalds      2005-04-16  82  
684f978347deb42 include/asm-powerpc/bug.h      Herbert Xu          2006-09-29  83  #define WARN_ON(x) ({						\
8d4fbcfbe0a4bfc include/asm-powerpc/bug.h      Linus Torvalds      2007-07-31  84  	int __ret_warn_on = !!(x);				\
684f978347deb42 include/asm-powerpc/bug.h      Herbert Xu          2006-09-29  85  	if (__builtin_constant_p(__ret_warn_on)) {		\
684f978347deb42 include/asm-powerpc/bug.h      Herbert Xu          2006-09-29  86  		if (__ret_warn_on)				\
872345b715ee02f include/asm-powerpc/bug.h      Andrew Morton       2006-03-27 @87  			__WARN();				\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  88  	} else {						\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19 @89  		BUG_ENTRY(PPC_TLNEI " %4, 0",			\
43f003bb74b9b27 arch/powerpc/include/asm/bug.h Christophe Leroy    2019-08-19 @90  			  BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN),	\
73c9ceab40b1269 include/asm-powerpc/bug.h      Jeremy Fitzhardinge 2006-12-08  91  			  "r" (__ret_warn_on));	\
e3f94b85f98a346 include/asm-powerpc/bug.h      Michael Ellerman    2006-03-23  92  	}							\
684f978347deb42 include/asm-powerpc/bug.h      Herbert Xu          2006-09-29  93  	unlikely(__ret_warn_on);				\
684f978347deb42 include/asm-powerpc/bug.h      Herbert Xu          2006-09-29  94  })
^1da177e4c3f415 include/asm-ppc64/bug.h        Linus Torvalds      2005-04-16  95  

:::::: The code at line 87 was first introduced by commit
:::::: 872345b715ee02f3b45528449f0d11b44ef9ebb8 [PATCH] git-powerpc: WARN was a dumb idea

:::::: TO: Andrew Morton <akpm@osdl.org>
:::::: CC: Paul Mackerras <paulus@samba.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30352 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [v2 PATCH] printk: Make linux/printk.h self-contained
  2020-06-11 12:51 [PATCH] printk: Make linux/printk.h self-contained Herbert Xu
  2020-06-11 15:53 ` kernel test robot
  2020-06-11 16:31 ` kernel test robot
@ 2020-06-12  4:36 ` Herbert Xu
  2020-06-12  9:49   ` Andy Shevchenko
                     ` (2 more replies)
  2020-06-13 12:28 ` [PATCH] " kernel test robot
  3 siblings, 3 replies; 13+ messages in thread
From: Herbert Xu @ 2020-06-12  4:36 UTC (permalink / raw)
  To: Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List
  Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, linux-s390

As it stands if you include printk.h by itself it will fail to
compile because it requires definitions from ratelimit.h.  However,
simply including ratelimit.h from printk.h does not work due to
inclusion loops involving sched.h and kernel.h.

This patch solves this by moving bits from ratelimit.h into a new
header file which can then be included by printk.h without any
worries about header loops.

The build bot then revealed some intriguing failures arising out
of this patch.  On s390 there is an inclusion loop with asm/bug.h
and linux/kernel.h that triggers a compile failure, because kernel.h
will cause asm-generic/bug.h to be included before s390's own
asm/bug.h has finished processing.  This has been fixed by not
including kernel.h in arch/s390/include/asm/bug.h.

A related failure was seen on powerpc where asm/bug.h leads to
the inclusion of linux/kernel.h via asm-generic/bug.h which then
prematurely tries to use the very macros defined in asm/bug.h.
The particular inclusion path which led to this involves lockdep.h.
I have fixed this moving the type definitions lockdep.h into the
new lockdep_types.h.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h
new file mode 100644
index 000000000000..b676aa419eef
--- /dev/null
+++ b/include/linux/ratelimit_types.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_RATELIMIT_TYPES_H
+#define _LINUX_RATELIMIT_TYPES_H
+
+#include <linux/bits.h>
+#include <linux/param.h>
+#include <linux/spinlock_types.h>
+
+#define DEFAULT_RATELIMIT_INTERVAL	(5 * HZ)
+#define DEFAULT_RATELIMIT_BURST		10
+
+/* issue num suppressed message on exit */
+#define RATELIMIT_MSG_ON_RELEASE	BIT(0)
+
+struct ratelimit_state {
+	raw_spinlock_t	lock;		/* protect the state */
+
+	int		interval;
+	int		burst;
+	int		printed;
+	int		missed;
+	unsigned long	begin;
+	unsigned long	flags;
+};
+
+#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) {		\
+		.lock		= __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
+		.interval	= interval_init,			\
+		.burst		= burst_init,				\
+	}
+
+#define RATELIMIT_STATE_INIT_DISABLED					\
+	RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
+
+#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
+									\
+	struct ratelimit_state name =					\
+		RATELIMIT_STATE_INIT(name, interval_init, burst_init)	\
+
+extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
+#define __ratelimit(state) ___ratelimit(state, __func__)
+
+#endif /* _LINUX_RATELIMIT_TYPES_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index e061635e0409..1cd862cfd2f4 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -7,6 +7,7 @@
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>
 #include <linux/cache.h>
+#include <linux/ratelimit_types.h>
 
 extern const char linux_banner[];
 extern const char linux_proc_banner[];
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 8ddf79e9207a..b17e0cd0a30c 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -2,41 +2,10 @@
 #ifndef _LINUX_RATELIMIT_H
 #define _LINUX_RATELIMIT_H
 
-#include <linux/param.h>
+#include <linux/ratelimit_types.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
 
-#define DEFAULT_RATELIMIT_INTERVAL	(5 * HZ)
-#define DEFAULT_RATELIMIT_BURST		10
-
-/* issue num suppressed message on exit */
-#define RATELIMIT_MSG_ON_RELEASE	BIT(0)
-
-struct ratelimit_state {
-	raw_spinlock_t	lock;		/* protect the state */
-
-	int		interval;
-	int		burst;
-	int		printed;
-	int		missed;
-	unsigned long	begin;
-	unsigned long	flags;
-};
-
-#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) {		\
-		.lock		= __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
-		.interval	= interval_init,			\
-		.burst		= burst_init,				\
-	}
-
-#define RATELIMIT_STATE_INIT_DISABLED					\
-	RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
-
-#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
-									\
-	struct ratelimit_state name =					\
-		RATELIMIT_STATE_INIT(name, interval_init, burst_init)	\
-
 static inline void ratelimit_state_init(struct ratelimit_state *rs,
 					int interval, int burst)
 {
@@ -73,9 +42,6 @@ ratelimit_set_flags(struct ratelimit_state *rs, unsigned long flags)
 
 extern struct ratelimit_state printk_ratelimit_state;
 
-extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
-#define __ratelimit(state) ___ratelimit(state, __func__)
-
 #ifdef CONFIG_PRINTK
 
 #define WARN_ON_RATELIMIT(condition, state)	({		\
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index 7725f8006fdf..0b25f28351ed 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -2,7 +2,7 @@
 #ifndef _ASM_S390_BUG_H
 #define _ASM_S390_BUG_H
 
-#include <linux/kernel.h>
+#include <linux/compiler.h>
 
 #ifdef CONFIG_BUG
 
diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h
new file mode 100644
index 000000000000..7b9350624577
--- /dev/null
+++ b/include/linux/lockdep_types.h
@@ -0,0 +1,196 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Runtime locking correctness validator
+ *
+ *  Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
+ *  Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
+ *
+ * see Documentation/locking/lockdep-design.rst for more details.
+ */
+#ifndef __LINUX_LOCKDEP_TYPES_H
+#define __LINUX_LOCKDEP_TYPES_H
+
+#include <linux/types.h>
+
+#define MAX_LOCKDEP_SUBCLASSES		8UL
+
+enum lockdep_wait_type {
+	LD_WAIT_INV = 0,	/* not checked, catch all */
+
+	LD_WAIT_FREE,		/* wait free, rcu etc.. */
+	LD_WAIT_SPIN,		/* spin loops, raw_spinlock_t etc.. */
+
+#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
+	LD_WAIT_CONFIG,		/* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */
+#else
+	LD_WAIT_CONFIG = LD_WAIT_SPIN,
+#endif
+	LD_WAIT_SLEEP,		/* sleeping locks, mutex_t etc.. */
+
+	LD_WAIT_MAX,		/* must be last */
+};
+
+#ifdef CONFIG_LOCKDEP
+
+#include <linux/list.h>
+
+/*
+ * We'd rather not expose kernel/lockdep_states.h this wide, but we do need
+ * the total number of states... :-(
+ */
+#define XXX_LOCK_USAGE_STATES		(1+2*4)
+
+/*
+ * NR_LOCKDEP_CACHING_CLASSES ... Number of classes
+ * cached in the instance of lockdep_map
+ *
+ * Currently main class (subclass == 0) and signle depth subclass
+ * are cached in lockdep_map. This optimization is mainly targeting
+ * on rq->lock. double_rq_lock() acquires this highly competitive with
+ * single depth.
+ */
+#define NR_LOCKDEP_CACHING_CLASSES	2
+
+/*
+ * A lockdep key is associated with each lock object. For static locks we use
+ * the lock address itself as the key. Dynamically allocated lock objects can
+ * have a statically or dynamically allocated key. Dynamically allocated lock
+ * keys must be registered before being used and must be unregistered before
+ * the key memory is freed.
+ */
+struct lockdep_subclass_key {
+	char __one_byte;
+} __attribute__ ((__packed__));
+
+/* hash_entry is used to keep track of dynamically allocated keys. */
+struct lock_class_key {
+	union {
+		struct hlist_node		hash_entry;
+		struct lockdep_subclass_key	subkeys[MAX_LOCKDEP_SUBCLASSES];
+	};
+};
+
+extern struct lock_class_key __lockdep_no_validate__;
+
+struct lock_trace;
+
+#define LOCKSTAT_POINTS		4
+
+/*
+ * The lock-class itself. The order of the structure members matters.
+ * reinit_class() zeroes the key member and all subsequent members.
+ */
+struct lock_class {
+	/*
+	 * class-hash:
+	 */
+	struct hlist_node		hash_entry;
+
+	/*
+	 * Entry in all_lock_classes when in use. Entry in free_lock_classes
+	 * when not in use. Instances that are being freed are on one of the
+	 * zapped_classes lists.
+	 */
+	struct list_head		lock_entry;
+
+	/*
+	 * These fields represent a directed graph of lock dependencies,
+	 * to every node we attach a list of "forward" and a list of
+	 * "backward" graph nodes.
+	 */
+	struct list_head		locks_after, locks_before;
+
+	const struct lockdep_subclass_key *key;
+	unsigned int			subclass;
+	unsigned int			dep_gen_id;
+
+	/*
+	 * IRQ/softirq usage tracking bits:
+	 */
+	unsigned long			usage_mask;
+	const struct lock_trace		*usage_traces[XXX_LOCK_USAGE_STATES];
+
+	/*
+	 * Generation counter, when doing certain classes of graph walking,
+	 * to ensure that we check one node only once:
+	 */
+	int				name_version;
+	const char			*name;
+
+	short				wait_type_inner;
+	short				wait_type_outer;
+
+#ifdef CONFIG_LOCK_STAT
+	unsigned long			contention_point[LOCKSTAT_POINTS];
+	unsigned long			contending_point[LOCKSTAT_POINTS];
+#endif
+} __no_randomize_layout;
+
+#ifdef CONFIG_LOCK_STAT
+struct lock_time {
+	s64				min;
+	s64				max;
+	s64				total;
+	unsigned long			nr;
+};
+
+enum bounce_type {
+	bounce_acquired_write,
+	bounce_acquired_read,
+	bounce_contended_write,
+	bounce_contended_read,
+	nr_bounce_types,
+
+	bounce_acquired = bounce_acquired_write,
+	bounce_contended = bounce_contended_write,
+};
+
+struct lock_class_stats {
+	unsigned long			contention_point[LOCKSTAT_POINTS];
+	unsigned long			contending_point[LOCKSTAT_POINTS];
+	struct lock_time		read_waittime;
+	struct lock_time		write_waittime;
+	struct lock_time		read_holdtime;
+	struct lock_time		write_holdtime;
+	unsigned long			bounces[nr_bounce_types];
+};
+
+struct lock_class_stats lock_stats(struct lock_class *class);
+void clear_lock_stats(struct lock_class *class);
+#endif
+
+/*
+ * Map the lock object (the lock instance) to the lock-class object.
+ * This is embedded into specific lock instances:
+ */
+struct lockdep_map {
+	struct lock_class_key		*key;
+	struct lock_class		*class_cache[NR_LOCKDEP_CACHING_CLASSES];
+	const char			*name;
+	short				wait_type_outer; /* can be taken in this context */
+	short				wait_type_inner; /* presents this context */
+#ifdef CONFIG_LOCK_STAT
+	int				cpu;
+	unsigned long			ip;
+#endif
+};
+
+struct pin_cookie { unsigned int val; };
+
+#else /* !CONFIG_LOCKDEP */
+
+/*
+ * The class key takes no space if lockdep is disabled:
+ */
+struct lock_class_key { };
+
+/*
+ * The lockdep_map takes no space if lockdep is disabled:
+ */
+struct lockdep_map { };
+
+struct pin_cookie { };
+
+#endif /* !LOCKDEP */
+
+#endif /* __LINUX_LOCKDEP_TYPES_H */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 206774ac6946..1655d767c2c7 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -10,181 +10,20 @@
 #ifndef __LINUX_LOCKDEP_H
 #define __LINUX_LOCKDEP_H
 
+#include <linux/lockdep_types.h>
+
 struct task_struct;
-struct lockdep_map;
 
 /* for sysctl */
 extern int prove_locking;
 extern int lock_stat;
 
-#define MAX_LOCKDEP_SUBCLASSES		8UL
-
-#include <linux/types.h>
-
-enum lockdep_wait_type {
-	LD_WAIT_INV = 0,	/* not checked, catch all */
-
-	LD_WAIT_FREE,		/* wait free, rcu etc.. */
-	LD_WAIT_SPIN,		/* spin loops, raw_spinlock_t etc.. */
-
-#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
-	LD_WAIT_CONFIG,		/* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */
-#else
-	LD_WAIT_CONFIG = LD_WAIT_SPIN,
-#endif
-	LD_WAIT_SLEEP,		/* sleeping locks, mutex_t etc.. */
-
-	LD_WAIT_MAX,		/* must be last */
-};
-
 #ifdef CONFIG_LOCKDEP
 
 #include <linux/linkage.h>
-#include <linux/list.h>
 #include <linux/debug_locks.h>
 #include <linux/stacktrace.h>
 
-/*
- * We'd rather not expose kernel/lockdep_states.h this wide, but we do need
- * the total number of states... :-(
- */
-#define XXX_LOCK_USAGE_STATES		(1+2*4)
-
-/*
- * NR_LOCKDEP_CACHING_CLASSES ... Number of classes
- * cached in the instance of lockdep_map
- *
- * Currently main class (subclass == 0) and signle depth subclass
- * are cached in lockdep_map. This optimization is mainly targeting
- * on rq->lock. double_rq_lock() acquires this highly competitive with
- * single depth.
- */
-#define NR_LOCKDEP_CACHING_CLASSES	2
-
-/*
- * A lockdep key is associated with each lock object. For static locks we use
- * the lock address itself as the key. Dynamically allocated lock objects can
- * have a statically or dynamically allocated key. Dynamically allocated lock
- * keys must be registered before being used and must be unregistered before
- * the key memory is freed.
- */
-struct lockdep_subclass_key {
-	char __one_byte;
-} __attribute__ ((__packed__));
-
-/* hash_entry is used to keep track of dynamically allocated keys. */
-struct lock_class_key {
-	union {
-		struct hlist_node		hash_entry;
-		struct lockdep_subclass_key	subkeys[MAX_LOCKDEP_SUBCLASSES];
-	};
-};
-
-extern struct lock_class_key __lockdep_no_validate__;
-
-struct lock_trace;
-
-#define LOCKSTAT_POINTS		4
-
-/*
- * The lock-class itself. The order of the structure members matters.
- * reinit_class() zeroes the key member and all subsequent members.
- */
-struct lock_class {
-	/*
-	 * class-hash:
-	 */
-	struct hlist_node		hash_entry;
-
-	/*
-	 * Entry in all_lock_classes when in use. Entry in free_lock_classes
-	 * when not in use. Instances that are being freed are on one of the
-	 * zapped_classes lists.
-	 */
-	struct list_head		lock_entry;
-
-	/*
-	 * These fields represent a directed graph of lock dependencies,
-	 * to every node we attach a list of "forward" and a list of
-	 * "backward" graph nodes.
-	 */
-	struct list_head		locks_after, locks_before;
-
-	const struct lockdep_subclass_key *key;
-	unsigned int			subclass;
-	unsigned int			dep_gen_id;
-
-	/*
-	 * IRQ/softirq usage tracking bits:
-	 */
-	unsigned long			usage_mask;
-	const struct lock_trace		*usage_traces[XXX_LOCK_USAGE_STATES];
-
-	/*
-	 * Generation counter, when doing certain classes of graph walking,
-	 * to ensure that we check one node only once:
-	 */
-	int				name_version;
-	const char			*name;
-
-	short				wait_type_inner;
-	short				wait_type_outer;
-
-#ifdef CONFIG_LOCK_STAT
-	unsigned long			contention_point[LOCKSTAT_POINTS];
-	unsigned long			contending_point[LOCKSTAT_POINTS];
-#endif
-} __no_randomize_layout;
-
-#ifdef CONFIG_LOCK_STAT
-struct lock_time {
-	s64				min;
-	s64				max;
-	s64				total;
-	unsigned long			nr;
-};
-
-enum bounce_type {
-	bounce_acquired_write,
-	bounce_acquired_read,
-	bounce_contended_write,
-	bounce_contended_read,
-	nr_bounce_types,
-
-	bounce_acquired = bounce_acquired_write,
-	bounce_contended = bounce_contended_write,
-};
-
-struct lock_class_stats {
-	unsigned long			contention_point[LOCKSTAT_POINTS];
-	unsigned long			contending_point[LOCKSTAT_POINTS];
-	struct lock_time		read_waittime;
-	struct lock_time		write_waittime;
-	struct lock_time		read_holdtime;
-	struct lock_time		write_holdtime;
-	unsigned long			bounces[nr_bounce_types];
-};
-
-struct lock_class_stats lock_stats(struct lock_class *class);
-void clear_lock_stats(struct lock_class *class);
-#endif
-
-/*
- * Map the lock object (the lock instance) to the lock-class object.
- * This is embedded into specific lock instances:
- */
-struct lockdep_map {
-	struct lock_class_key		*key;
-	struct lock_class		*class_cache[NR_LOCKDEP_CACHING_CLASSES];
-	const char			*name;
-	short				wait_type_outer; /* can be taken in this context */
-	short				wait_type_inner; /* presents this context */
-#ifdef CONFIG_LOCK_STAT
-	int				cpu;
-	unsigned long			ip;
-#endif
-};
-
 static inline void lockdep_copy_map(struct lockdep_map *to,
 				    struct lockdep_map *from)
 {
@@ -421,8 +260,6 @@ static inline void lock_set_subclass(struct lockdep_map *lock,
 
 extern void lock_downgrade(struct lockdep_map *lock, unsigned long ip);
 
-struct pin_cookie { unsigned int val; };
-
 #define NIL_COOKIE (struct pin_cookie){ .val = 0U, }
 
 extern struct pin_cookie lock_pin_lock(struct lockdep_map *lock);
@@ -501,10 +338,6 @@ static inline void lockdep_set_selftest_task(struct task_struct *task)
 # define lockdep_reset()		do { debug_locks = 1; } while (0)
 # define lockdep_free_key_range(start, size)	do { } while (0)
 # define lockdep_sys_exit() 			do { } while (0)
-/*
- * The class key takes no space if lockdep is disabled:
- */
-struct lock_class_key { };
 
 static inline void lockdep_register_key(struct lock_class_key *key)
 {
@@ -514,11 +347,6 @@ static inline void lockdep_unregister_key(struct lock_class_key *key)
 {
 }
 
-/*
- * The lockdep_map takes no space if lockdep is disabled:
- */
-struct lockdep_map { };
-
 #define lockdep_depth(tsk)	(0)
 
 #define lockdep_is_held_type(l, r)		(1)
@@ -530,8 +358,6 @@ struct lockdep_map { };
 
 #define lockdep_recursing(tsk)			(0)
 
-struct pin_cookie { };
-
 #define NIL_COOKIE (struct pin_cookie){ }
 
 #define lockdep_pin_lock(l)			({ struct pin_cookie cookie = { }; cookie; })
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [v2 PATCH] printk: Make linux/printk.h self-contained
  2020-06-12  4:36 ` [v2 PATCH] " Herbert Xu
@ 2020-06-12  9:49   ` Andy Shevchenko
  2020-06-12 11:32   ` Sergey Senozhatsky
  2020-06-12 13:14   ` Petr Mladek
  2 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2020-06-12  9:49 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List, Peter Zijlstra, Ingo Molnar,
	Will Deacon, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, linux-s390

On Fri, Jun 12, 2020 at 7:39 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> As it stands if you include printk.h by itself it will fail to
> compile because it requires definitions from ratelimit.h.  However,
> simply including ratelimit.h from printk.h does not work due to
> inclusion loops involving sched.h and kernel.h.
>
> This patch solves this by moving bits from ratelimit.h into a new
> header file which can then be included by printk.h without any
> worries about header loops.
>
> The build bot then revealed some intriguing failures arising out
> of this patch.  On s390 there is an inclusion loop with asm/bug.h
> and linux/kernel.h that triggers a compile failure, because kernel.h
> will cause asm-generic/bug.h to be included before s390's own
> asm/bug.h has finished processing.  This has been fixed by not
> including kernel.h in arch/s390/include/asm/bug.h.
>
> A related failure was seen on powerpc where asm/bug.h leads to
> the inclusion of linux/kernel.h via asm-generic/bug.h which then
> prematurely tries to use the very macros defined in asm/bug.h.
> The particular inclusion path which led to this involves lockdep.h.
> I have fixed this moving the type definitions lockdep.h into the
> new lockdep_types.h.

This change is a step to the right direction, thanks! FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

It seems you are opening a can of worms :-)
Have you a chance to look at [1]? I think it's a long road, but maybe
you are interested to help with?

[1]: https://lore.kernel.org/lkml/20200422125201.37618-1-andriy.shevchenko@linux.intel.com/


> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h
> new file mode 100644
> index 000000000000..b676aa419eef
> --- /dev/null
> +++ b/include/linux/ratelimit_types.h
> @@ -0,0 +1,43 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_RATELIMIT_TYPES_H
> +#define _LINUX_RATELIMIT_TYPES_H
> +
> +#include <linux/bits.h>
> +#include <linux/param.h>
> +#include <linux/spinlock_types.h>
> +
> +#define DEFAULT_RATELIMIT_INTERVAL     (5 * HZ)
> +#define DEFAULT_RATELIMIT_BURST                10
> +
> +/* issue num suppressed message on exit */
> +#define RATELIMIT_MSG_ON_RELEASE       BIT(0)
> +
> +struct ratelimit_state {
> +       raw_spinlock_t  lock;           /* protect the state */
> +
> +       int             interval;
> +       int             burst;
> +       int             printed;
> +       int             missed;
> +       unsigned long   begin;
> +       unsigned long   flags;
> +};
> +
> +#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) {                \
> +               .lock           = __RAW_SPIN_LOCK_UNLOCKED(name.lock),  \
> +               .interval       = interval_init,                        \
> +               .burst          = burst_init,                           \
> +       }
> +
> +#define RATELIMIT_STATE_INIT_DISABLED                                  \
> +       RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
> +
> +#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)                \
> +                                                                       \
> +       struct ratelimit_state name =                                   \
> +               RATELIMIT_STATE_INIT(name, interval_init, burst_init)   \
> +
> +extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
> +#define __ratelimit(state) ___ratelimit(state, __func__)
> +
> +#endif /* _LINUX_RATELIMIT_TYPES_H */
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index e061635e0409..1cd862cfd2f4 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -7,6 +7,7 @@
>  #include <linux/kern_levels.h>
>  #include <linux/linkage.h>
>  #include <linux/cache.h>
> +#include <linux/ratelimit_types.h>
>
>  extern const char linux_banner[];
>  extern const char linux_proc_banner[];
> diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
> index 8ddf79e9207a..b17e0cd0a30c 100644
> --- a/include/linux/ratelimit.h
> +++ b/include/linux/ratelimit.h
> @@ -2,41 +2,10 @@
>  #ifndef _LINUX_RATELIMIT_H
>  #define _LINUX_RATELIMIT_H
>
> -#include <linux/param.h>
> +#include <linux/ratelimit_types.h>
>  #include <linux/sched.h>
>  #include <linux/spinlock.h>
>
> -#define DEFAULT_RATELIMIT_INTERVAL     (5 * HZ)
> -#define DEFAULT_RATELIMIT_BURST                10
> -
> -/* issue num suppressed message on exit */
> -#define RATELIMIT_MSG_ON_RELEASE       BIT(0)
> -
> -struct ratelimit_state {
> -       raw_spinlock_t  lock;           /* protect the state */
> -
> -       int             interval;
> -       int             burst;
> -       int             printed;
> -       int             missed;
> -       unsigned long   begin;
> -       unsigned long   flags;
> -};
> -
> -#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) {                \
> -               .lock           = __RAW_SPIN_LOCK_UNLOCKED(name.lock),  \
> -               .interval       = interval_init,                        \
> -               .burst          = burst_init,                           \
> -       }
> -
> -#define RATELIMIT_STATE_INIT_DISABLED                                  \
> -       RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
> -
> -#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)                \
> -                                                                       \
> -       struct ratelimit_state name =                                   \
> -               RATELIMIT_STATE_INIT(name, interval_init, burst_init)   \
> -
>  static inline void ratelimit_state_init(struct ratelimit_state *rs,
>                                         int interval, int burst)
>  {
> @@ -73,9 +42,6 @@ ratelimit_set_flags(struct ratelimit_state *rs, unsigned long flags)
>
>  extern struct ratelimit_state printk_ratelimit_state;
>
> -extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
> -#define __ratelimit(state) ___ratelimit(state, __func__)
> -
>  #ifdef CONFIG_PRINTK
>
>  #define WARN_ON_RATELIMIT(condition, state)    ({              \
> diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
> index 7725f8006fdf..0b25f28351ed 100644
> --- a/arch/s390/include/asm/bug.h
> +++ b/arch/s390/include/asm/bug.h
> @@ -2,7 +2,7 @@
>  #ifndef _ASM_S390_BUG_H
>  #define _ASM_S390_BUG_H
>
> -#include <linux/kernel.h>
> +#include <linux/compiler.h>
>
>  #ifdef CONFIG_BUG
>
> diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h
> new file mode 100644
> index 000000000000..7b9350624577
> --- /dev/null
> +++ b/include/linux/lockdep_types.h
> @@ -0,0 +1,196 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Runtime locking correctness validator
> + *
> + *  Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
> + *  Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra
> + *
> + * see Documentation/locking/lockdep-design.rst for more details.
> + */
> +#ifndef __LINUX_LOCKDEP_TYPES_H
> +#define __LINUX_LOCKDEP_TYPES_H
> +
> +#include <linux/types.h>
> +
> +#define MAX_LOCKDEP_SUBCLASSES         8UL
> +
> +enum lockdep_wait_type {
> +       LD_WAIT_INV = 0,        /* not checked, catch all */
> +
> +       LD_WAIT_FREE,           /* wait free, rcu etc.. */
> +       LD_WAIT_SPIN,           /* spin loops, raw_spinlock_t etc.. */
> +
> +#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
> +       LD_WAIT_CONFIG,         /* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */
> +#else
> +       LD_WAIT_CONFIG = LD_WAIT_SPIN,
> +#endif
> +       LD_WAIT_SLEEP,          /* sleeping locks, mutex_t etc.. */
> +
> +       LD_WAIT_MAX,            /* must be last */
> +};
> +
> +#ifdef CONFIG_LOCKDEP
> +
> +#include <linux/list.h>
> +
> +/*
> + * We'd rather not expose kernel/lockdep_states.h this wide, but we do need
> + * the total number of states... :-(
> + */
> +#define XXX_LOCK_USAGE_STATES          (1+2*4)
> +
> +/*
> + * NR_LOCKDEP_CACHING_CLASSES ... Number of classes
> + * cached in the instance of lockdep_map
> + *
> + * Currently main class (subclass == 0) and signle depth subclass
> + * are cached in lockdep_map. This optimization is mainly targeting
> + * on rq->lock. double_rq_lock() acquires this highly competitive with
> + * single depth.
> + */
> +#define NR_LOCKDEP_CACHING_CLASSES     2
> +
> +/*
> + * A lockdep key is associated with each lock object. For static locks we use
> + * the lock address itself as the key. Dynamically allocated lock objects can
> + * have a statically or dynamically allocated key. Dynamically allocated lock
> + * keys must be registered before being used and must be unregistered before
> + * the key memory is freed.
> + */
> +struct lockdep_subclass_key {
> +       char __one_byte;
> +} __attribute__ ((__packed__));
> +
> +/* hash_entry is used to keep track of dynamically allocated keys. */
> +struct lock_class_key {
> +       union {
> +               struct hlist_node               hash_entry;
> +               struct lockdep_subclass_key     subkeys[MAX_LOCKDEP_SUBCLASSES];
> +       };
> +};
> +
> +extern struct lock_class_key __lockdep_no_validate__;
> +
> +struct lock_trace;
> +
> +#define LOCKSTAT_POINTS                4
> +
> +/*
> + * The lock-class itself. The order of the structure members matters.
> + * reinit_class() zeroes the key member and all subsequent members.
> + */
> +struct lock_class {
> +       /*
> +        * class-hash:
> +        */
> +       struct hlist_node               hash_entry;
> +
> +       /*
> +        * Entry in all_lock_classes when in use. Entry in free_lock_classes
> +        * when not in use. Instances that are being freed are on one of the
> +        * zapped_classes lists.
> +        */
> +       struct list_head                lock_entry;
> +
> +       /*
> +        * These fields represent a directed graph of lock dependencies,
> +        * to every node we attach a list of "forward" and a list of
> +        * "backward" graph nodes.
> +        */
> +       struct list_head                locks_after, locks_before;
> +
> +       const struct lockdep_subclass_key *key;
> +       unsigned int                    subclass;
> +       unsigned int                    dep_gen_id;
> +
> +       /*
> +        * IRQ/softirq usage tracking bits:
> +        */
> +       unsigned long                   usage_mask;
> +       const struct lock_trace         *usage_traces[XXX_LOCK_USAGE_STATES];
> +
> +       /*
> +        * Generation counter, when doing certain classes of graph walking,
> +        * to ensure that we check one node only once:
> +        */
> +       int                             name_version;
> +       const char                      *name;
> +
> +       short                           wait_type_inner;
> +       short                           wait_type_outer;
> +
> +#ifdef CONFIG_LOCK_STAT
> +       unsigned long                   contention_point[LOCKSTAT_POINTS];
> +       unsigned long                   contending_point[LOCKSTAT_POINTS];
> +#endif
> +} __no_randomize_layout;
> +
> +#ifdef CONFIG_LOCK_STAT
> +struct lock_time {
> +       s64                             min;
> +       s64                             max;
> +       s64                             total;
> +       unsigned long                   nr;
> +};
> +
> +enum bounce_type {
> +       bounce_acquired_write,
> +       bounce_acquired_read,
> +       bounce_contended_write,
> +       bounce_contended_read,
> +       nr_bounce_types,
> +
> +       bounce_acquired = bounce_acquired_write,
> +       bounce_contended = bounce_contended_write,
> +};
> +
> +struct lock_class_stats {
> +       unsigned long                   contention_point[LOCKSTAT_POINTS];
> +       unsigned long                   contending_point[LOCKSTAT_POINTS];
> +       struct lock_time                read_waittime;
> +       struct lock_time                write_waittime;
> +       struct lock_time                read_holdtime;
> +       struct lock_time                write_holdtime;
> +       unsigned long                   bounces[nr_bounce_types];
> +};
> +
> +struct lock_class_stats lock_stats(struct lock_class *class);
> +void clear_lock_stats(struct lock_class *class);
> +#endif
> +
> +/*
> + * Map the lock object (the lock instance) to the lock-class object.
> + * This is embedded into specific lock instances:
> + */
> +struct lockdep_map {
> +       struct lock_class_key           *key;
> +       struct lock_class               *class_cache[NR_LOCKDEP_CACHING_CLASSES];
> +       const char                      *name;
> +       short                           wait_type_outer; /* can be taken in this context */
> +       short                           wait_type_inner; /* presents this context */
> +#ifdef CONFIG_LOCK_STAT
> +       int                             cpu;
> +       unsigned long                   ip;
> +#endif
> +};
> +
> +struct pin_cookie { unsigned int val; };
> +
> +#else /* !CONFIG_LOCKDEP */
> +
> +/*
> + * The class key takes no space if lockdep is disabled:
> + */
> +struct lock_class_key { };
> +
> +/*
> + * The lockdep_map takes no space if lockdep is disabled:
> + */
> +struct lockdep_map { };
> +
> +struct pin_cookie { };
> +
> +#endif /* !LOCKDEP */
> +
> +#endif /* __LINUX_LOCKDEP_TYPES_H */
> diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
> index 206774ac6946..1655d767c2c7 100644
> --- a/include/linux/lockdep.h
> +++ b/include/linux/lockdep.h
> @@ -10,181 +10,20 @@
>  #ifndef __LINUX_LOCKDEP_H
>  #define __LINUX_LOCKDEP_H
>
> +#include <linux/lockdep_types.h>
> +
>  struct task_struct;
> -struct lockdep_map;
>
>  /* for sysctl */
>  extern int prove_locking;
>  extern int lock_stat;
>
> -#define MAX_LOCKDEP_SUBCLASSES         8UL
> -
> -#include <linux/types.h>
> -
> -enum lockdep_wait_type {
> -       LD_WAIT_INV = 0,        /* not checked, catch all */
> -
> -       LD_WAIT_FREE,           /* wait free, rcu etc.. */
> -       LD_WAIT_SPIN,           /* spin loops, raw_spinlock_t etc.. */
> -
> -#ifdef CONFIG_PROVE_RAW_LOCK_NESTING
> -       LD_WAIT_CONFIG,         /* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */
> -#else
> -       LD_WAIT_CONFIG = LD_WAIT_SPIN,
> -#endif
> -       LD_WAIT_SLEEP,          /* sleeping locks, mutex_t etc.. */
> -
> -       LD_WAIT_MAX,            /* must be last */
> -};
> -
>  #ifdef CONFIG_LOCKDEP
>
>  #include <linux/linkage.h>
> -#include <linux/list.h>
>  #include <linux/debug_locks.h>
>  #include <linux/stacktrace.h>
>
> -/*
> - * We'd rather not expose kernel/lockdep_states.h this wide, but we do need
> - * the total number of states... :-(
> - */
> -#define XXX_LOCK_USAGE_STATES          (1+2*4)
> -
> -/*
> - * NR_LOCKDEP_CACHING_CLASSES ... Number of classes
> - * cached in the instance of lockdep_map
> - *
> - * Currently main class (subclass == 0) and signle depth subclass
> - * are cached in lockdep_map. This optimization is mainly targeting
> - * on rq->lock. double_rq_lock() acquires this highly competitive with
> - * single depth.
> - */
> -#define NR_LOCKDEP_CACHING_CLASSES     2
> -
> -/*
> - * A lockdep key is associated with each lock object. For static locks we use
> - * the lock address itself as the key. Dynamically allocated lock objects can
> - * have a statically or dynamically allocated key. Dynamically allocated lock
> - * keys must be registered before being used and must be unregistered before
> - * the key memory is freed.
> - */
> -struct lockdep_subclass_key {
> -       char __one_byte;
> -} __attribute__ ((__packed__));
> -
> -/* hash_entry is used to keep track of dynamically allocated keys. */
> -struct lock_class_key {
> -       union {
> -               struct hlist_node               hash_entry;
> -               struct lockdep_subclass_key     subkeys[MAX_LOCKDEP_SUBCLASSES];
> -       };
> -};
> -
> -extern struct lock_class_key __lockdep_no_validate__;
> -
> -struct lock_trace;
> -
> -#define LOCKSTAT_POINTS                4
> -
> -/*
> - * The lock-class itself. The order of the structure members matters.
> - * reinit_class() zeroes the key member and all subsequent members.
> - */
> -struct lock_class {
> -       /*
> -        * class-hash:
> -        */
> -       struct hlist_node               hash_entry;
> -
> -       /*
> -        * Entry in all_lock_classes when in use. Entry in free_lock_classes
> -        * when not in use. Instances that are being freed are on one of the
> -        * zapped_classes lists.
> -        */
> -       struct list_head                lock_entry;
> -
> -       /*
> -        * These fields represent a directed graph of lock dependencies,
> -        * to every node we attach a list of "forward" and a list of
> -        * "backward" graph nodes.
> -        */
> -       struct list_head                locks_after, locks_before;
> -
> -       const struct lockdep_subclass_key *key;
> -       unsigned int                    subclass;
> -       unsigned int                    dep_gen_id;
> -
> -       /*
> -        * IRQ/softirq usage tracking bits:
> -        */
> -       unsigned long                   usage_mask;
> -       const struct lock_trace         *usage_traces[XXX_LOCK_USAGE_STATES];
> -
> -       /*
> -        * Generation counter, when doing certain classes of graph walking,
> -        * to ensure that we check one node only once:
> -        */
> -       int                             name_version;
> -       const char                      *name;
> -
> -       short                           wait_type_inner;
> -       short                           wait_type_outer;
> -
> -#ifdef CONFIG_LOCK_STAT
> -       unsigned long                   contention_point[LOCKSTAT_POINTS];
> -       unsigned long                   contending_point[LOCKSTAT_POINTS];
> -#endif
> -} __no_randomize_layout;
> -
> -#ifdef CONFIG_LOCK_STAT
> -struct lock_time {
> -       s64                             min;
> -       s64                             max;
> -       s64                             total;
> -       unsigned long                   nr;
> -};
> -
> -enum bounce_type {
> -       bounce_acquired_write,
> -       bounce_acquired_read,
> -       bounce_contended_write,
> -       bounce_contended_read,
> -       nr_bounce_types,
> -
> -       bounce_acquired = bounce_acquired_write,
> -       bounce_contended = bounce_contended_write,
> -};
> -
> -struct lock_class_stats {
> -       unsigned long                   contention_point[LOCKSTAT_POINTS];
> -       unsigned long                   contending_point[LOCKSTAT_POINTS];
> -       struct lock_time                read_waittime;
> -       struct lock_time                write_waittime;
> -       struct lock_time                read_holdtime;
> -       struct lock_time                write_holdtime;
> -       unsigned long                   bounces[nr_bounce_types];
> -};
> -
> -struct lock_class_stats lock_stats(struct lock_class *class);
> -void clear_lock_stats(struct lock_class *class);
> -#endif
> -
> -/*
> - * Map the lock object (the lock instance) to the lock-class object.
> - * This is embedded into specific lock instances:
> - */
> -struct lockdep_map {
> -       struct lock_class_key           *key;
> -       struct lock_class               *class_cache[NR_LOCKDEP_CACHING_CLASSES];
> -       const char                      *name;
> -       short                           wait_type_outer; /* can be taken in this context */
> -       short                           wait_type_inner; /* presents this context */
> -#ifdef CONFIG_LOCK_STAT
> -       int                             cpu;
> -       unsigned long                   ip;
> -#endif
> -};
> -
>  static inline void lockdep_copy_map(struct lockdep_map *to,
>                                     struct lockdep_map *from)
>  {
> @@ -421,8 +260,6 @@ static inline void lock_set_subclass(struct lockdep_map *lock,
>
>  extern void lock_downgrade(struct lockdep_map *lock, unsigned long ip);
>
> -struct pin_cookie { unsigned int val; };
> -
>  #define NIL_COOKIE (struct pin_cookie){ .val = 0U, }
>
>  extern struct pin_cookie lock_pin_lock(struct lockdep_map *lock);
> @@ -501,10 +338,6 @@ static inline void lockdep_set_selftest_task(struct task_struct *task)
>  # define lockdep_reset()               do { debug_locks = 1; } while (0)
>  # define lockdep_free_key_range(start, size)   do { } while (0)
>  # define lockdep_sys_exit()                    do { } while (0)
> -/*
> - * The class key takes no space if lockdep is disabled:
> - */
> -struct lock_class_key { };
>
>  static inline void lockdep_register_key(struct lock_class_key *key)
>  {
> @@ -514,11 +347,6 @@ static inline void lockdep_unregister_key(struct lock_class_key *key)
>  {
>  }
>
> -/*
> - * The lockdep_map takes no space if lockdep is disabled:
> - */
> -struct lockdep_map { };
> -
>  #define lockdep_depth(tsk)     (0)
>
>  #define lockdep_is_held_type(l, r)             (1)
> @@ -530,8 +358,6 @@ struct lockdep_map { };
>
>  #define lockdep_recursing(tsk)                 (0)
>
> -struct pin_cookie { };
> -
>  #define NIL_COOKIE (struct pin_cookie){ }
>
>  #define lockdep_pin_lock(l)                    ({ struct pin_cookie cookie = { }; cookie; })
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [v2 PATCH] printk: Make linux/printk.h self-contained
  2020-06-12  4:36 ` [v2 PATCH] " Herbert Xu
  2020-06-12  9:49   ` Andy Shevchenko
@ 2020-06-12 11:32   ` Sergey Senozhatsky
  2020-06-12 13:14   ` Petr Mladek
  2 siblings, 0 replies; 13+ messages in thread
From: Sergey Senozhatsky @ 2020-06-12 11:32 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List, Peter Zijlstra, Ingo Molnar,
	Will Deacon, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, linux-s390

On (20/06/12 14:36), Herbert Xu wrote:
> As it stands if you include printk.h by itself it will fail to
> compile because it requires definitions from ratelimit.h.  However,
> simply including ratelimit.h from printk.h does not work due to
> inclusion loops involving sched.h and kernel.h.
> 
> This patch solves this by moving bits from ratelimit.h into a new
> header file which can then be included by printk.h without any
> worries about header loops.
> 
> The build bot then revealed some intriguing failures arising out
> of this patch.  On s390 there is an inclusion loop with asm/bug.h
> and linux/kernel.h that triggers a compile failure, because kernel.h
> will cause asm-generic/bug.h to be included before s390's own
> asm/bug.h has finished processing.  This has been fixed by not
> including kernel.h in arch/s390/include/asm/bug.h.
> 
> A related failure was seen on powerpc where asm/bug.h leads to
> the inclusion of linux/kernel.h via asm-generic/bug.h which then
> prematurely tries to use the very macros defined in asm/bug.h.
> The particular inclusion path which led to this involves lockdep.h.
> I have fixed this moving the type definitions lockdep.h into the
> new lockdep_types.h.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

FWIW,
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [v2 PATCH] printk: Make linux/printk.h self-contained
  2020-06-12  4:36 ` [v2 PATCH] " Herbert Xu
  2020-06-12  9:49   ` Andy Shevchenko
  2020-06-12 11:32   ` Sergey Senozhatsky
@ 2020-06-12 13:14   ` Petr Mladek
  2020-06-12 16:52     ` Peter Zijlstra
  2 siblings, 1 reply; 13+ messages in thread
From: Petr Mladek @ 2020-06-12 13:14 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Sergey Senozhatsky, Steven Rostedt, Linux Kernel Mailing List,
	Peter Zijlstra, Ingo Molnar, Will Deacon, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, linux-s390

On Fri 2020-06-12 14:36:35, Herbert Xu wrote:
> As it stands if you include printk.h by itself it will fail to
> compile because it requires definitions from ratelimit.h.  However,
> simply including ratelimit.h from printk.h does not work due to
> inclusion loops involving sched.h and kernel.h.
> 
> This patch solves this by moving bits from ratelimit.h into a new
> header file which can then be included by printk.h without any
> worries about header loops.
> 
> The build bot then revealed some intriguing failures arising out
> of this patch.  On s390 there is an inclusion loop with asm/bug.h
> and linux/kernel.h that triggers a compile failure, because kernel.h
> will cause asm-generic/bug.h to be included before s390's own
> asm/bug.h has finished processing.  This has been fixed by not
> including kernel.h in arch/s390/include/asm/bug.h.
> 
> A related failure was seen on powerpc where asm/bug.h leads to
> the inclusion of linux/kernel.h via asm-generic/bug.h which then
> prematurely tries to use the very macros defined in asm/bug.h.
> The particular inclusion path which led to this involves lockdep.h.
> I have fixed this moving the type definitions lockdep.h into the
> new lockdep_types.h.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

I am fine with the changes as long as the kernel test robot
does not complain ;-)

Acked-by: Petr Mladek <pmladek@suse.com>

Well, I wonder if PeterZ is fine with the lockdep part. It might make
sense to split it into separate patch as a prerequisite.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [v2 PATCH] printk: Make linux/printk.h self-contained
  2020-06-12 13:14   ` Petr Mladek
@ 2020-06-12 16:52     ` Peter Zijlstra
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Zijlstra @ 2020-06-12 16:52 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Herbert Xu, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List, Ingo Molnar, Will Deacon,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger, linux-s390

On Fri, Jun 12, 2020 at 03:14:05PM +0200, Petr Mladek wrote:
> On Fri 2020-06-12 14:36:35, Herbert Xu wrote:
> > As it stands if you include printk.h by itself it will fail to
> > compile because it requires definitions from ratelimit.h.  However,
> > simply including ratelimit.h from printk.h does not work due to
> > inclusion loops involving sched.h and kernel.h.
> > 
> > This patch solves this by moving bits from ratelimit.h into a new
> > header file which can then be included by printk.h without any
> > worries about header loops.
> > 
> > The build bot then revealed some intriguing failures arising out
> > of this patch.  On s390 there is an inclusion loop with asm/bug.h
> > and linux/kernel.h that triggers a compile failure, because kernel.h
> > will cause asm-generic/bug.h to be included before s390's own
> > asm/bug.h has finished processing.  This has been fixed by not
> > including kernel.h in arch/s390/include/asm/bug.h.
> > 
> > A related failure was seen on powerpc where asm/bug.h leads to
> > the inclusion of linux/kernel.h via asm-generic/bug.h which then
> > prematurely tries to use the very macros defined in asm/bug.h.
> > The particular inclusion path which led to this involves lockdep.h.
> > I have fixed this moving the type definitions lockdep.h into the
> > new lockdep_types.h.
> > 
> > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> I am fine with the changes as long as the kernel test robot
> does not complain ;-)
> 
> Acked-by: Petr Mladek <pmladek@suse.com>
> 
> Well, I wonder if PeterZ is fine with the lockdep part. It might make
> sense to split it into separate patch as a prerequisite.

They look fine, but yes, I think it makes sense to split that out.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] printk: Make linux/printk.h self-contained
  2020-06-11 12:51 [PATCH] printk: Make linux/printk.h self-contained Herbert Xu
                   ` (2 preceding siblings ...)
  2020-06-12  4:36 ` [v2 PATCH] " Herbert Xu
@ 2020-06-13 12:28 ` kernel test robot
  2020-06-13 13:09   ` Herbert Xu
  3 siblings, 1 reply; 13+ messages in thread
From: kernel test robot @ 2020-06-13 12:28 UTC (permalink / raw)
  To: Herbert Xu, Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List
  Cc: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 48007 bytes --]


Hi Herbert,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Herbert-Xu/printk-Make-linux-printk-h-self-contained/20200611-205340
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: powerpc-randconfig-s031-20200611 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-250-g42323db3-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=powerpc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   kernel/ptrace.c:53:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/ptrace.c:53:22: sparse:    struct task_struct *
   kernel/ptrace.c:53:22: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/ptrace.c:196:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/ptrace.c:196:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/ptrace.c:196:9: sparse:    struct task_struct *
   kernel/ptrace.c:241:44: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/ptrace.c:241:44: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/ptrace.c:241:44: sparse:    struct task_struct *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   kernel/user.c:105:27: sparse: sparse: unknown field name in initializer
   kernel/user.c:105:27: sparse: sparse: unknown field name in initializer
   kernel/user.c:105:27: sparse: sparse: unknown field name in initializer
   include/linux/ratelimit.h:14:9: sparse: sparse: no member 'lock' in struct ratelimit_state
   include/linux/ratelimit.h:15:11: sparse: sparse: no member 'interval' in struct ratelimit_state
   include/linux/ratelimit.h:16:11: sparse: sparse: no member 'burst' in struct ratelimit_state
   include/linux/ratelimit.h:40:11: sparse: sparse: no member 'flags' in struct ratelimit_state
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   arch/powerpc/kernel/signal_64.c:804:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_64.c:804:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_64.c:804:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_64.c:916:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_64.c:916:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_64.c:916:17: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   arch/powerpc/kernel/traps.c:312:16: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:312:16: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:312:16: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:1843:9: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:1843:9: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:1843:9: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:2299:9: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:2299:9: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/traps.c:2299:9: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   arch/powerpc/kernel/signal_32.c:843:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:843:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:843:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1100:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1100:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1100:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1295:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1295:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1295:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1371:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1371:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kernel/signal_32.c:1371:17: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   arch/powerpc/kvm/book3s_emulate.c:847:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kvm/book3s_emulate.c:847:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kvm/book3s_emulate.c:847:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kvm/book3s_emulate.c:1012:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kvm/book3s_emulate.c:1012:17: sparse: sparse: unknown field name in initializer
   arch/powerpc/kvm/book3s_emulate.c:1012:17: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   kernel/sched/core.c:4506:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/core.c:4506:17: sparse:    struct task_struct *
   kernel/sched/core.c:4506:17: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/core.c:4705:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/core.c:4705:22: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/core.c:4705:22: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1809:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct *
   kernel/sched/core.c:1388:38: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/core.c:1388:38: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/core.c:1388:38: sparse:    struct task_struct const *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1809:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1809:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1809:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
   kernel/sched/sched.h:1809:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1809:9: sparse:    struct task_struct *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   kernel/sched/fair.c:5386:38: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/fair.c:5386:38: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/fair.c:5386:38: sparse:    struct task_struct *
   kernel/sched/fair.c:8582:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/fair.c:8582:22: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/fair.c:8582:22: sparse:    struct task_struct *
   kernel/sched/fair.c:10692:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/fair.c:10692:22: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/fair.c:10692:22: sparse:    struct task_struct *
   kernel/sched/fair.c:10825:30: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/fair.c:10825:30: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/fair.c:10825:30: sparse:    struct task_struct *
   kernel/sched/fair.c:5330:35: sparse: sparse: marked inline, but without a definition
   kernel/sched/sched.h:1803:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1803:9: sparse:    struct task_struct *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   kernel/sched/rt.c:912:70: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/rt.c:912:70: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/rt.c:912:70: sparse:    struct task_struct *
   kernel/sched/rt.c:2183:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/rt.c:2183:25: sparse:    struct task_struct *
   kernel/sched/rt.c:2183:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/rt.c:1876:13: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/rt.c:1876:13: sparse:    struct task_struct *
   kernel/sched/rt.c:1876:13: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/rt.c:2300:46: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/rt.c:2300:46: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/rt.c:2300:46: sparse:    struct task_struct *
   kernel/sched/rt.c:2320:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/rt.c:2320:22: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/rt.c:2320:22: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   kernel/sched/deadline.c:2059:13: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/deadline.c:2059:13: sparse:    struct task_struct *
   kernel/sched/deadline.c:2059:13: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/deadline.c:2186:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/deadline.c:2186:25: sparse:    struct task_struct *
   kernel/sched/deadline.c:2186:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/deadline.c:2385:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/deadline.c:2385:22: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/deadline.c:2385:22: sparse:    struct task_struct *
   kernel/sched/deadline.c:2404:46: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/deadline.c:2404:46: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/deadline.c:2404:46: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
   kernel/sched/sched.h:1657:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/sched.h:1657:25: sparse:    struct task_struct *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   kernel/sched/debug.c:435:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   kernel/sched/debug.c:435:22: sparse:    struct task_struct [noderef] <asn:4> *
   kernel/sched/debug.c:435:22: sparse:    struct task_struct *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   net/ipv4/nexthop.c:1088:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
   net/ipv4/nexthop.c:1088:24: sparse:    struct rb_node [noderef] <asn:4> *
   net/ipv4/nexthop.c:1088:24: sparse:    struct rb_node *
   include/linux/rbtree.h:84:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rbtree.h:84:9: sparse:    struct rb_node [noderef] <asn:4> *
   include/linux/rbtree.h:84:9: sparse:    struct rb_node *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   drivers/char/random.c:475:9: sparse: sparse: unknown field name in initializer
   drivers/char/random.c:475:9: sparse: sparse: unknown field name in initializer
   drivers/char/random.c:475:9: sparse: sparse: unknown field name in initializer
   drivers/char/random.c:477:9: sparse: sparse: unknown field name in initializer
   drivers/char/random.c:477:9: sparse: sparse: unknown field name in initializer
   drivers/char/random.c:477:9: sparse: sparse: unknown field name in initializer
   drivers/char/random.c:985:37: sparse: sparse: no member 'missed' in struct ratelimit_state
   drivers/char/random.c:986:25: sparse: sparse: no member 'missed' in struct ratelimit_state
   drivers/char/random.c:988:41: sparse: sparse: no member 'missed' in struct ratelimit_state
   drivers/char/random.c:990:36: sparse: sparse: no member 'missed' in struct ratelimit_state
   drivers/char/random.c:991:25: sparse: sparse: no member 'missed' in struct ratelimit_state
   drivers/char/random.c:993:40: sparse: sparse: no member 'missed' in struct ratelimit_state
   drivers/char/random.c:1805:32: sparse: sparse: no member 'interval' in struct ratelimit_state
   drivers/char/random.c:1806:33: sparse: sparse: no member 'interval' in struct ratelimit_state
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/super.c:2326:31: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/super.c:2326:31: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/super.c:2326:31: sparse:    struct rcu_string *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/ctree.c:129:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/ctree.c:129:22: sparse:    struct extent_buffer [noderef] <asn:4> *
   fs/btrfs/ctree.c:129:22: sparse:    struct extent_buffer *
   fs/btrfs/ctree.c:1085:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/ctree.c:1085:17: sparse:    struct extent_buffer [noderef] <asn:4> *
   fs/btrfs/ctree.c:1085:17: sparse:    struct extent_buffer *
   fs/btrfs/ctree.c:1846:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/ctree.c:1846:17: sparse:    struct extent_buffer [noderef] <asn:4> *
   fs/btrfs/ctree.c:1846:17: sparse:    struct extent_buffer *
   fs/btrfs/ctree.c:3332:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/ctree.c:3332:9: sparse:    struct extent_buffer [noderef] <asn:4> *
   fs/btrfs/ctree.c:3332:9: sparse:    struct extent_buffer *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/extent-tree.c:4517:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:4517:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:4517:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5040:33: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5040:33: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5040:33: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5151:41: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5151:41: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5151:41: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5187:9: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5187:9: sparse: sparse: unknown field name in initializer
   fs/btrfs/extent-tree.c:5187:9: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/volumes.c:7336:9: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:7336:9: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:7336:9: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:7336:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:7336:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:7336:9: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:7356:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:7356:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:7356:9: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:539:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:539:24: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:539:24: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:858:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:858:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:858:17: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:932:33: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:932:33: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:932:33: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:939:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:939:25: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:939:25: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:951:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:951:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:951:17: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:1012:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:1012:25: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:1012:25: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:2055:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:2055:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:2055:17: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:2539:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:2539:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:2539:9: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:4104:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:4104:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:4104:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:6325:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:6325:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:6325:9: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:6535:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:6535:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:6535:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:6538:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:6538:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:6538:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/volumes.c:7242:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:7242:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:7242:17: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:7253:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:7253:25: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:7253:25: sparse:    struct rcu_string *
   fs/btrfs/volumes.c:7267:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/volumes.c:7267:25: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/volumes.c:7267:25: sparse:    struct rcu_string *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/scrub.c:838:16: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:838:16: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:838:16: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1180:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1180:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1180:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1180:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:1180:25: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:1180:25: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:1189:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1189:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1189:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1189:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:1189:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:1189:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:1563:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1563:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:1563:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:703:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:703:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:703:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:717:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:717:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:717:9: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:775:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:775:25: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:775:25: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:2136:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:2136:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:2136:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:2136:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:2136:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:2136:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:2143:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:2143:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:2143:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:2143:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:2143:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:2143:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:3862:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:3862:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:3862:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/scrub.c:3901:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:3901:17: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/scrub.c:3901:17: sparse:    struct rcu_string *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/qgroup.c:1927:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:1927:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:1927:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:1945:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:1945:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:1945:25: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:2039:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:2039:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:2039:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:3844:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:3844:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:3844:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:4008:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:4008:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/qgroup.c:4008:17: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/dev-replace.c:683:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/dev-replace.c:683:25: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/dev-replace.c:683:25: sparse:    struct rcu_string *
   fs/btrfs/dev-replace.c:700:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/dev-replace.c:700:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/dev-replace.c:700:9: sparse:    struct rcu_string *
   fs/btrfs/dev-replace.c:279:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/dev-replace.c:279:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/dev-replace.c:279:9: sparse:    struct rcu_string *
   fs/btrfs/dev-replace.c:431:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/dev-replace.c:431:24: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/dev-replace.c:431:24: sparse:    struct rcu_string *
   fs/btrfs/dev-replace.c:493:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/dev-replace.c:493:9: sparse:    struct rcu_string [noderef] <asn:4> *
   fs/btrfs/dev-replace.c:493:9: sparse:    struct rcu_string *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/block-rsv.c:509:24: sparse: sparse: unknown field name in initializer
   fs/btrfs/block-rsv.c:509:24: sparse: sparse: unknown field name in initializer
   fs/btrfs/block-rsv.c:509:24: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   fs/btrfs/reflink.c:581:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/reflink.c:581:17: sparse: sparse: unknown field name in initializer
   fs/btrfs/reflink.c:581:17: sparse: sparse: unknown field name in initializer
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   include/linux/rculist_bl.h:24:33: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:24:33: sparse:    struct hlist_bl_node [noderef] <asn:4> *
   include/linux/rculist_bl.h:24:33: sparse:    struct hlist_bl_node *
   include/linux/rculist_bl.h:17:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node [noderef] <asn:4> *
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node *
   include/linux/rculist_bl.h:17:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node [noderef] <asn:4> *
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   drivers/md/md-linear.c:61:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/md-linear.c:61:16: sparse:    void [noderef] <asn:4> *
   drivers/md/md-linear.c:61:16: sparse:    void *
   drivers/md/md-linear.c:219:19: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/md-linear.c:219:19: sparse:    void [noderef] <asn:4> *
   drivers/md/md-linear.c:219:19: sparse:    void *
   drivers/md/md-linear.c:224:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/md-linear.c:224:9: sparse:    void [noderef] <asn:4> *
   drivers/md/md-linear.c:224:9: sparse:    void *
--
>> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
   include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
   include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
   include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
   include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
   drivers/md/md-multipath.c:37:40: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/md-multipath.c:37:40: sparse:    struct md_rdev [noderef] <asn:4> *
   drivers/md/md-multipath.c:37:40: sparse:    struct md_rdev *
   drivers/md/md-multipath.c:47:9: sparse: sparse: unknown field name in initializer
   drivers/md/md-multipath.c:47:9: sparse: sparse: unknown field name in initializer
   drivers/md/md-multipath.c:47:9: sparse: sparse: unknown field name in initializer
   drivers/md/md-multipath.c:147:40: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/md-multipath.c:147:40: sparse:    struct md_rdev [noderef] <asn:4> *
   drivers/md/md-multipath.c:147:40: sparse:    struct md_rdev *
   drivers/md/md-multipath.c:161:40: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/md-multipath.c:161:40: sparse:    struct md_rdev [noderef] <asn:4> *
   drivers/md/md-multipath.c:161:40: sparse:    struct md_rdev *
   drivers/md/md-multipath.c:261:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/md/md-multipath.c:261:25: sparse:    struct md_rdev [noderef] <asn:4> *
   drivers/md/md-multipath.c:261:25: sparse:    struct md_rdev *

# https://github.com/0day-ci/linux/commit/17b41842ecf70ea595220b384e6380d29c39b555
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 17b41842ecf70ea595220b384e6380d29c39b555
vim +16 include/linux/ratelimit_types.h

17b41842ecf70e Herbert Xu 2020-06-11  14  
17b41842ecf70e Herbert Xu 2020-06-11  15  struct ratelimit_state {
17b41842ecf70e Herbert Xu 2020-06-11 @16  	raw_spinlock_t	lock;		/* protect the state */
17b41842ecf70e Herbert Xu 2020-06-11  17  
17b41842ecf70e Herbert Xu 2020-06-11  18  	int		interval;
17b41842ecf70e Herbert Xu 2020-06-11  19  	int		burst;
17b41842ecf70e Herbert Xu 2020-06-11  20  	int		printed;
17b41842ecf70e Herbert Xu 2020-06-11  21  	int		missed;
17b41842ecf70e Herbert Xu 2020-06-11  22  	unsigned long	begin;
17b41842ecf70e Herbert Xu 2020-06-11  23  	unsigned long	flags;
17b41842ecf70e Herbert Xu 2020-06-11  24  };
17b41842ecf70e Herbert Xu 2020-06-11  25  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34084 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] printk: Make linux/printk.h self-contained
  2020-06-13 12:28 ` [PATCH] " kernel test robot
@ 2020-06-13 13:09   ` Herbert Xu
  2020-06-13 14:29     ` Luc Van Oostenryck
  0 siblings, 1 reply; 13+ messages in thread
From: Herbert Xu @ 2020-06-13 13:09 UTC (permalink / raw)
  To: kernel test robot, linux-sparse
  Cc: Petr Mladek, Sergey Senozhatsky, Steven Rostedt,
	Linux Kernel Mailing List, kbuild-all

On Sat, Jun 13, 2020 at 08:28:34PM +0800, kernel test robot wrote:
> 
> Hi Herbert,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on linus/master]
> [also build test WARNING on v5.7 next-20200611]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Herbert-Xu/printk-Make-linux-printk-h-self-contained/20200611-205340
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
> :::::: branch date: 13 hours ago
> :::::: commit date: 13 hours ago
> config: powerpc-randconfig-s031-20200611 (attached as .config)
> compiler: powerpc64le-linux-gcc (GCC) 9.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.1-250-g42323db3-dirty
>         # save the attached .config to linux build tree
>         make W=1 C=1 ARCH=powerpc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
> 
> >> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
>    include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
>    include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
>    include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
>    include/linux/ratelimit_types.h:24:1: sparse: sparse: got }

This looks like a bug in sparse as the same code compiles just
fine.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] printk: Make linux/printk.h self-contained
  2020-06-13 13:09   ` Herbert Xu
@ 2020-06-13 14:29     ` Luc Van Oostenryck
  2020-06-15 11:40       ` Herbert Xu
  0 siblings, 1 reply; 13+ messages in thread
From: Luc Van Oostenryck @ 2020-06-13 14:29 UTC (permalink / raw)
  To: Herbert Xu
  Cc: kernel test robot, linux-sparse, Petr Mladek, Sergey Senozhatsky,
	Steven Rostedt, Linux Kernel Mailing List, kbuild-all

On Sat, Jun 13, 2020 at 11:09:49PM +1000, Herbert Xu wrote:
> On Sat, Jun 13, 2020 at 08:28:34PM +0800, kernel test robot wrote:
> > 
> > Hi Herbert,
> > 
> > I love your patch! Perhaps something to improve:
> > 
> > [auto build test WARNING on linus/master]
> > [also build test WARNING on v5.7 next-20200611]
> > [if your patch is applied to the wrong git tree, please drop us a note to help
> > improve the system. BTW, we also suggest to use '--base' option to specify the
> > base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> > 
> > url:    https://github.com/0day-ci/linux/commits/Herbert-Xu/printk-Make-linux-printk-h-self-contained/20200611-205340
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git b29482fde649c72441d5478a4ea2c52c56d97a5e
> > :::::: branch date: 13 hours ago
> > :::::: commit date: 13 hours ago
> > config: powerpc-randconfig-s031-20200611 (attached as .config)
> > compiler: powerpc64le-linux-gcc (GCC) 9.3.0
> > reproduce:
> >         # apt-get install sparse
> >         # sparse version: v0.6.1-250-g42323db3-dirty
> >         # save the attached .config to linux build tree
> >         make W=1 C=1 ARCH=powerpc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > 
> > sparse warnings: (new ones prefixed by >>)
> > 
> > >> include/linux/ratelimit_types.h:16:25: sparse: sparse: expected ; at end of declaration
> >    include/linux/ratelimit_types.h:16:25: sparse: sparse: Expected } at end of struct-union-enum-specifier
> >    include/linux/ratelimit_types.h:16:25: sparse: sparse: got lock
> >    include/linux/ratelimit_types.h:24:1: sparse: sparse: Expected ; at the end of type declaration
> >    include/linux/ratelimit_types.h:24:1: sparse: sparse: got }
> 
> This looks like a bug in sparse as the same code compiles just
> fine.

Hi,

When trying to reproduce, before using sparse, I get:
      CC      kernel/ptrace.o
    In file included from ./include/linux/printk.h:10:0,
                     from ./include/linux/kernel.h:15,
                     from ./include/linux/list.h:9,
                     from ./include/linux/lockdep.h:43,
                     from ./include/linux/spinlock_types.h:18,
                     from ./arch/powerpc/include/asm/lppaca.h:45,
                     from ./arch/powerpc/include/asm/paca.h:17,
                     from ./arch/powerpc/include/asm/current.h:13,
                     from ./include/linux/sched.h:12,
                     from kernel/ptrace.c:13:
    ./include/linux/ratelimit_types.h:16:2: error: unknown type name ‘raw_spinlock_t’
      raw_spinlock_t lock;  /* protect the state */
      ^
    In file included from ./include/linux/wait.h:9:0,
                     from ./include/linux/pid.h:6,
                     from ./include/linux/sched.h:14,
                     from kernel/ptrace.c:13:
    ./include/linux/ratelimit.h: In function ‘ratelimit_state_init’:
    ./include/linux/spinlock.h:100:16: warning: passing argument 1 of ‘__raw_spin_lock_init’ from incompatible pointer type [enabled by default]
      static struct lock_class_key __key;    \
                    ^
    ./include/linux/ratelimit.h:14:2: note: in expansion of macro ‘raw_spin_lock_init’
      raw_spin_lock_init(&rs->lock);
      ^
    ./include/linux/spinlock.h:95:15: note: expected ‘struct raw_spinlock_t *’ but argument is of type ‘int *’
       extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
                   ^
    make[1]: *** [scripts/Makefile.build:281: kernel/ptrace.o] Error 1
    make: *** [Makefile:1777: kernel] Error 2


while there is no such problem with the previous commit.
I think the problem is that:
* ratelimit.h needs raw_spinlock_t
* spinlock_types.h needs lockdep.h
* lockdep.h needs ratelimit.h


Best regards,
Luc

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] printk: Make linux/printk.h self-contained
  2020-06-13 14:29     ` Luc Van Oostenryck
@ 2020-06-15 11:40       ` Herbert Xu
  2020-06-15 19:17         ` Steven Rostedt
  0 siblings, 1 reply; 13+ messages in thread
From: Herbert Xu @ 2020-06-15 11:40 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: kernel test robot, linux-sparse, Petr Mladek, Sergey Senozhatsky,
	Steven Rostedt, Linux Kernel Mailing List, kbuild-all

On Sat, Jun 13, 2020 at 04:29:01PM +0200, Luc Van Oostenryck wrote:
>
> while there is no such problem with the previous commit.
> I think the problem is that:
> * ratelimit.h needs raw_spinlock_t
> * spinlock_types.h needs lockdep.h
> * lockdep.h needs ratelimit.h

Thanks for investigating.  I now realise that this was sent against
my first patch which did have this problem, which was fixed in my
second patch.  Sorry for the false alarm.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] printk: Make linux/printk.h self-contained
  2020-06-15 11:40       ` Herbert Xu
@ 2020-06-15 19:17         ` Steven Rostedt
  0 siblings, 0 replies; 13+ messages in thread
From: Steven Rostedt @ 2020-06-15 19:17 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Luc Van Oostenryck, kernel test robot, linux-sparse, Petr Mladek,
	Sergey Senozhatsky, Linux Kernel Mailing List, kbuild-all

On Mon, 15 Jun 2020 21:40:38 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> Thanks for investigating.  I now realise that this was sent against
> my first patch which did have this problem, which was fixed in my
> second patch.  Sorry for the false alarm.

Which is why it is recommended that new patches start their own threads ;-)

That said,

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

for the v2 patch.

-- Steve

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-06-15 19:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 12:51 [PATCH] printk: Make linux/printk.h self-contained Herbert Xu
2020-06-11 15:53 ` kernel test robot
2020-06-11 16:31 ` kernel test robot
2020-06-12  4:36 ` [v2 PATCH] " Herbert Xu
2020-06-12  9:49   ` Andy Shevchenko
2020-06-12 11:32   ` Sergey Senozhatsky
2020-06-12 13:14   ` Petr Mladek
2020-06-12 16:52     ` Peter Zijlstra
2020-06-13 12:28 ` [PATCH] " kernel test robot
2020-06-13 13:09   ` Herbert Xu
2020-06-13 14:29     ` Luc Van Oostenryck
2020-06-15 11:40       ` Herbert Xu
2020-06-15 19:17         ` Steven Rostedt

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