linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH -next] Fix printk_once build errors due to __read_mostly
@ 2013-10-30 10:18 James Hogan
  2013-10-30 13:46 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: James Hogan @ 2013-10-30 10:18 UTC (permalink / raw)
  To: Joe Perches, Andrew Morton
  Cc: linux-kernel, linux-next, James Hogan, linux-metag

Commit 3e39c1ab04ba (printk: mark printk_once test variable
__read_mostly) added __read_mostly to the __print_once bool in the
printk_once() macro, but __read_mostly is defined in <linux/cache.h>
which isn't included from <linux/printk.h>. This results in build errors
like this:

arch/metag/mm/l2cache.c: In function 'meta_l2c_setup':
arch/metag/mm/l2cache.c:56: error: '__read_mostly' undeclared

This is fixed by adding an include of <linux/cache.h> from
<linux/printk.h> since I don't think printk_once() users should need to
include <linux/cache.h> for it to work.

Note that this actually adds a recursive include, since <linux/cache.h>
includes <linux/kernel.h>, which includes <linux/printk.h>. The actual
dependencies are all in macros so it doesn't actually seem to result in
any build failures, but it's clearly less than ideal.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-metag@vger.kernel.org
---
This build failure was caught in today's linux-next.

I'm not too keen on this due to the recursive include. Is it better to
just workaround the problem by including <linux/cache.h> from the .c
file that fails to build, or should the original patch be removed
instead?

 include/linux/printk.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index abd42dd..b13d00e 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -2,6 +2,7 @@
 #define __KERNEL_PRINTK__
 
 #include <stdarg.h>
+#include <linux/cache.h>
 #include <linux/init.h>
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>
-- 
1.8.1.2

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

* Re: [RFC PATCH -next] Fix printk_once build errors due to __read_mostly
  2013-10-30 10:18 [RFC PATCH -next] Fix printk_once build errors due to __read_mostly James Hogan
@ 2013-10-30 13:46 ` Joe Perches
  2013-10-30 17:02 ` Joe Perches
  2013-10-30 20:48 ` Andrew Morton
  2 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2013-10-30 13:46 UTC (permalink / raw)
  To: James Hogan; +Cc: Andrew Morton, linux-kernel, linux-next, linux-metag

On Wed, 2013-10-30 at 10:18 +0000, James Hogan wrote:
> Commit 3e39c1ab04ba (printk: mark printk_once test variable
> __read_mostly) added __read_mostly to the __print_once bool in the
> printk_once() macro, but __read_mostly is defined in <linux/cache.h>
> which isn't included from <linux/printk.h>. This results in build errors
> like this:
> 
> arch/metag/mm/l2cache.c: In function 'meta_l2c_setup':
> arch/metag/mm/l2cache.c:56: error: '__read_mostly' undeclared
> 
> This is fixed by adding an include of <linux/cache.h> from
> <linux/printk.h> since I don't think printk_once() users should need to
> include <linux/cache.h> for it to work.
> 
> Note that this actually adds a recursive include, since <linux/cache.h>
> includes <linux/kernel.h>, which includes <linux/printk.h>. The actual
> dependencies are all in macros so it doesn't actually seem to result in
> any build failures, but it's clearly less than ideal.

Thanks James.

Oh well.  Pity about the recursive #include.
It seems most every actual use of __read_mostly gets
that cache.h include indirectly.

Perhaps it's better just to remove the __read_mostly patch
as the __read_mostly value is pretty low.

Andrew, could you please remove my __read_mostly patch?

I preferred that printk.h not be a file that
could be independently used via #include.

https://lkml.org/lkml/2011/5/25/331
https://lkml.org/lkml/2011/5/25/333

and that only kernel.h should be used.

Maybe that's still a better approach.

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

* Re: [RFC PATCH -next] Fix printk_once build errors due to __read_mostly
  2013-10-30 10:18 [RFC PATCH -next] Fix printk_once build errors due to __read_mostly James Hogan
  2013-10-30 13:46 ` Joe Perches
@ 2013-10-30 17:02 ` Joe Perches
  2013-10-30 20:48 ` Andrew Morton
  2 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2013-10-30 17:02 UTC (permalink / raw)
  To: James Hogan; +Cc: Andrew Morton, linux-kernel, linux-next, linux-metag

On Wed, 2013-10-30 at 10:18 +0000, James Hogan wrote:
> Commit 3e39c1ab04ba (printk: mark printk_once test variable
> __read_mostly) added __read_mostly to the __print_once bool in the
> printk_once() macro, but __read_mostly is defined in <linux/cache.h>
> which isn't included from <linux/printk.h>. This results in build errors
> like this:
> 
> arch/metag/mm/l2cache.c: In function 'meta_l2c_setup':
> arch/metag/mm/l2cache.c:56: error: '__read_mostly' undeclared
> 
> This is fixed by adding an include of <linux/cache.h> from
> <linux/printk.h> since I don't think printk_once() users should need to
> include <linux/cache.h> for it to work.
> 
> Note that this actually adds a recursive include, since <linux/cache.h>
> includes <linux/kernel.h>, which includes <linux/printk.h>. The actual
> dependencies are all in macros so it doesn't actually seem to result in
> any build failures, but it's clearly less than ideal.
[]
> I'm not too keen on this due to the recursive include. Is it better to
> just workaround the problem by including <linux/cache.h> from the .c
> file that fails to build, or should the original patch be removed
> instead?

Maybe also using this would help avoid some of the
circular dependency:
---
 include/linux/cache.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4c57065..17e7e82 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -1,11 +1,11 @@
 #ifndef __LINUX_CACHE_H
 #define __LINUX_CACHE_H
 
-#include <linux/kernel.h>
+#include <uapi/linux/kernel.h>
 #include <asm/cache.h>
 
 #ifndef L1_CACHE_ALIGN
-#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
+#define L1_CACHE_ALIGN(x) __ALIGN_KERNEL(x, L1_CACHE_BYTES)
 #endif
 
 #ifndef SMP_CACHE_BYTES

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

* Re: [RFC PATCH -next] Fix printk_once build errors due to __read_mostly
  2013-10-30 10:18 [RFC PATCH -next] Fix printk_once build errors due to __read_mostly James Hogan
  2013-10-30 13:46 ` Joe Perches
  2013-10-30 17:02 ` Joe Perches
@ 2013-10-30 20:48 ` Andrew Morton
  2013-10-30 22:58   ` Joe Perches
                     ` (3 more replies)
  2 siblings, 4 replies; 13+ messages in thread
From: Andrew Morton @ 2013-10-30 20:48 UTC (permalink / raw)
  To: James Hogan; +Cc: Joe Perches, linux-kernel, linux-next, linux-metag

On Wed, 30 Oct 2013 10:18:21 +0000 James Hogan <james.hogan@imgtec.com> wrote:

> Commit 3e39c1ab04ba (printk: mark printk_once test variable
> __read_mostly) added __read_mostly to the __print_once bool in the
> printk_once() macro, but __read_mostly is defined in <linux/cache.h>
> which isn't included from <linux/printk.h>. This results in build errors
> like this:
> 
> arch/metag/mm/l2cache.c: In function 'meta_l2c_setup':
> arch/metag/mm/l2cache.c:56: error: '__read_mostly' undeclared
> 
> This is fixed by adding an include of <linux/cache.h> from
> <linux/printk.h> since I don't think printk_once() users should need to
> include <linux/cache.h> for it to work.
> 
> Note that this actually adds a recursive include, since <linux/cache.h>
> includes <linux/kernel.h>, which includes <linux/printk.h>. The actual
> dependencies are all in macros so it doesn't actually seem to result in
> any build failures, but it's clearly less than ideal.

Yitch.

> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Joe Perches <joe@perches.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-metag@vger.kernel.org
> ---
> This build failure was caught in today's linux-next.
> 
> I'm not too keen on this due to the recursive include. Is it better to
> just workaround the problem by including <linux/cache.h> from the .c
> file that fails to build, or should the original patch be removed
> instead?

Well, these patches make the kernel worse.  We should make it better,
not worse.

One approach would be to add a new printk_once.h, which includes
printk.h and cache.h.

I can't immediately think of a nice solution so I guess for now I'll
drop printk-mark-printk_once-test-variable-__read_mostly.patch.

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

* Re: [RFC PATCH -next] Fix printk_once build errors due to __read_mostly
  2013-10-30 20:48 ` Andrew Morton
@ 2013-10-30 22:58   ` Joe Perches
  2013-10-30 23:01   ` [PATCH V2] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2013-10-30 22:58 UTC (permalink / raw)
  To: Andrew Morton; +Cc: James Hogan, linux-kernel, linux-next, linux-metag

On Wed, 2013-10-30 at 13:48 -0700, Andrew Morton wrote:
> On Wed, 30 Oct 2013 10:18:21 +0000 James Hogan <james.hogan@imgtec.com> wrote:
[]
> > Note that this actually adds a recursive include, since <linux/cache.h>
> > includes <linux/kernel.h>, which includes <linux/printk.h>. The actual
> > dependencies are all in macros so it doesn't actually seem to result in
> > any build failures, but it's clearly less than ideal.
> 
> Yitch.

Yeah.

There are about ~700 files in the tree that use __read_mostly.
Only about ~25 of those actually #include <linux/cache.h>

I did a script that adds the #include, but 700 files is a _lot_.

For today's next:

$ git grep -w --name-only __read_mostly | \
  xargs grep -P -l "^\s*#\s*include\s+<linux/cache.h>" | wc -l
28

$ git grep -w --name-only __read_mostly | \
  xargs grep -P -L "^\s*#\s*include\s+<linux/cache.h>" | wc -l
716

Untangling that crud is nasty.

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

* [PATCH V2] printk/cache: Mark printk_once test variable __read_mostly
  2013-10-30 20:48 ` Andrew Morton
  2013-10-30 22:58   ` Joe Perches
@ 2013-10-30 23:01   ` Joe Perches
  2013-10-31 13:35     ` James Hogan
  2013-10-30 23:18   ` [RFC PATCH -next] Fix printk_once build errors due to __read_mostly Stephen Rothwell
  2013-10-31 18:29   ` [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
  3 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2013-10-30 23:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: James Hogan, linux-kernel, linux-next, linux-metag

Add #include <linux/cache.h> to define __read_mostly.

Convert cache.h to use uapi/linux/kernel.h instead
of linux/kernel.h to avoid recursive #includes.

Convert the ALIGN macro to __KERNEL_ALIGN.

printk_once only sets the bool variable tested
once so mark it __read_mostly.

Neaten the alignment so it matches the rest of the
pr_<level>_once #defines too.

Signed-off-by: Joe Perches <joe@perches.com>
---
V2: Add cache.h which was nearly always used
    indirectly via #include <some_other_file.h>,
    generally module.h
    Update cache.h to avoid recursive #include

 include/linux/cache.h  |  4 ++--
 include/linux/printk.h | 19 ++++++++++---------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4c57065..63a1d97 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -1,11 +1,11 @@
 #ifndef __LINUX_CACHE_H
 #define __LINUX_CACHE_H
 
-#include <linux/kernel.h>
+#include <uapi/linux/kernel.h>
 #include <asm/cache.h>
 
 #ifndef L1_CACHE_ALIGN
-#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
+#define L1_CACHE_ALIGN(x) __KERNEL_ALIGN(x, L1_CACHE_BYTES)
 #endif
 
 #ifndef SMP_CACHE_BYTES
diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a78..2449da9 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -5,6 +5,7 @@
 #include <linux/init.h>
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>
+#include <linux/cache.h>
 
 extern const char linux_banner[];
 extern const char linux_proc_banner[];
@@ -251,17 +252,17 @@ extern asmlinkage void dump_stack(void) __cold;
  */
 
 #ifdef CONFIG_PRINTK
-#define printk_once(fmt, ...)			\
-({						\
-	static bool __print_once;		\
-						\
-	if (!__print_once) {			\
-		__print_once = true;		\
-		printk(fmt, ##__VA_ARGS__);	\
-	}					\
+#define printk_once(fmt, ...)					\
+({								\
+	static bool __print_once __read_mostly;			\
+								\
+	if (!__print_once) {					\
+		__print_once = true;				\
+		printk(fmt, ##__VA_ARGS__);			\
+	}							\
 })
 #else
-#define printk_once(fmt, ...)			\
+#define printk_once(fmt, ...)					\
 	no_printk(fmt, ##__VA_ARGS__)
 #endif
 

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

* Re: [RFC PATCH -next] Fix printk_once build errors due to __read_mostly
  2013-10-30 20:48 ` Andrew Morton
  2013-10-30 22:58   ` Joe Perches
  2013-10-30 23:01   ` [PATCH V2] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
@ 2013-10-30 23:18   ` Stephen Rothwell
  2013-10-31 18:29   ` [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
  3 siblings, 0 replies; 13+ messages in thread
From: Stephen Rothwell @ 2013-10-30 23:18 UTC (permalink / raw)
  To: Andrew Morton
  Cc: James Hogan, Joe Perches, linux-kernel, linux-next, linux-metag

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

Hi Andrew,

On Wed, 30 Oct 2013 13:48:39 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
>
> I can't immediately think of a nice solution so I guess for now I'll
> drop printk-mark-printk_once-test-variable-__read_mostly.patch.

I have removed that from my copy of the mmotm tree.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH V2] printk/cache: Mark printk_once test variable __read_mostly
  2013-10-30 23:01   ` [PATCH V2] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
@ 2013-10-31 13:35     ` James Hogan
  0 siblings, 0 replies; 13+ messages in thread
From: James Hogan @ 2013-10-31 13:35 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andrew Morton, linux-kernel, linux-next, linux-metag

On 30/10/13 23:01, Joe Perches wrote:
> Add #include <linux/cache.h> to define __read_mostly.
> 
> Convert cache.h to use uapi/linux/kernel.h instead
> of linux/kernel.h to avoid recursive #includes.
> 
> Convert the ALIGN macro to __KERNEL_ALIGN.
> 
> printk_once only sets the bool variable tested
> once so mark it __read_mostly.
> 
> Neaten the alignment so it matches the rest of the
> pr_<level>_once #defines too.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> V2: Add cache.h which was nearly always used
>     indirectly via #include <some_other_file.h>,
>     generally module.h
>     Update cache.h to avoid recursive #include
> 
>  include/linux/cache.h  |  4 ++--
>  include/linux/printk.h | 19 ++++++++++---------
>  2 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/include/linux/cache.h b/include/linux/cache.h
> index 4c57065..63a1d97 100644
> --- a/include/linux/cache.h
> +++ b/include/linux/cache.h
> @@ -1,11 +1,11 @@
>  #ifndef __LINUX_CACHE_H
>  #define __LINUX_CACHE_H
>  
> -#include <linux/kernel.h>
> +#include <uapi/linux/kernel.h>
>  #include <asm/cache.h>
>  
>  #ifndef L1_CACHE_ALIGN
> -#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
> +#define L1_CACHE_ALIGN(x) __KERNEL_ALIGN(x, L1_CACHE_BYTES)

I think that should be __ALIGN_KERNEL (same applies to commit message).

Otherwise this patch looks good to me and builds all Meta defconfigs fine.
Reviewed-by: James Hogan <james.hogan@imgtec.com>

Thanks
James

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

* [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly
  2013-10-30 20:48 ` Andrew Morton
                     ` (2 preceding siblings ...)
  2013-10-30 23:18   ` [RFC PATCH -next] Fix printk_once build errors due to __read_mostly Stephen Rothwell
@ 2013-10-31 18:29   ` Joe Perches
  2013-11-13  0:23     ` Tony Luck
  3 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2013-10-31 18:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: James Hogan, linux-kernel, linux-next, linux-metag

Add #include <linux/cache.h> to define __read_mostly.

Convert cache.h to use uapi/linux/kernel.h instead
of linux/kernel.h to avoid recursive #includes.

Convert the ALIGN macro to __ALIGN_KERNEL.

printk_once only sets the bool variable tested
once so mark it __read_mostly.

Neaten the alignment so it matches the rest of the
pr_<level>_once #defines too.

Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
---
V3: Fix cache.h conversion and actually
    compiled/built defconfig x86.
V2: Add cache.h which was nearly always used
    indirectly via #include <some_other_file.h>,
    generally module.h
    Update cache.h to avoid recursive #include

 include/linux/cache.h  |  4 ++--
 include/linux/printk.h | 19 ++++++++++---------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4c57065..17e7e82 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -1,11 +1,11 @@
 #ifndef __LINUX_CACHE_H
 #define __LINUX_CACHE_H
 
-#include <linux/kernel.h>
+#include <uapi/linux/kernel.h>
 #include <asm/cache.h>
 
 #ifndef L1_CACHE_ALIGN
-#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
+#define L1_CACHE_ALIGN(x) __ALIGN_KERNEL(x, L1_CACHE_BYTES)
 #endif
 
 #ifndef SMP_CACHE_BYTES
diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a78..2449da9 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -5,6 +5,7 @@
 #include <linux/init.h>
 #include <linux/kern_levels.h>
 #include <linux/linkage.h>
+#include <linux/cache.h>
 
 extern const char linux_banner[];
 extern const char linux_proc_banner[];
@@ -251,17 +252,17 @@ extern asmlinkage void dump_stack(void) __cold;
  */
 
 #ifdef CONFIG_PRINTK
-#define printk_once(fmt, ...)			\
-({						\
-	static bool __print_once;		\
-						\
-	if (!__print_once) {			\
-		__print_once = true;		\
-		printk(fmt, ##__VA_ARGS__);	\
-	}					\
+#define printk_once(fmt, ...)					\
+({								\
+	static bool __print_once __read_mostly;			\
+								\
+	if (!__print_once) {					\
+		__print_once = true;				\
+		printk(fmt, ##__VA_ARGS__);			\
+	}							\
 })
 #else
-#define printk_once(fmt, ...)			\
+#define printk_once(fmt, ...)					\
 	no_printk(fmt, ##__VA_ARGS__)
 #endif
 

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

* Re: [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly
  2013-10-31 18:29   ` [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
@ 2013-11-13  0:23     ` Tony Luck
  2013-11-13  0:29       ` Joe Perches
  0 siblings, 1 reply; 13+ messages in thread
From: Tony Luck @ 2013-11-13  0:23 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Morton, James Hogan, Linux Kernel Mailing List,
	linux-next, linux-metag

Trying this again with HTML disabled in gmail so mailing lists will see it ...

On Thu, Oct 31, 2013 at 11:29 AM, Joe Perches <joe@perches.com> wrote:
> diff --git a/include/linux/cache.h b/include/linux/cache.h
> index 4c57065..17e7e82 100644
> --- a/include/linux/cache.h
> +++ b/include/linux/cache.h
> @@ -1,11 +1,11 @@
>  #ifndef __LINUX_CACHE_H
>  #define __LINUX_CACHE_H
>
> -#include <linux/kernel.h>
> +#include <uapi/linux/kernel.h>
>  #include <asm/cache.h>

This bit seems to be responsible for breaking the ia64 build
in today's linux-next (tag: next-20131112)

Compiler barfs at:
   CC      arch/ia64/kernel/patch.o
In file included from arch/ia64/kernel/patch.c:12:
/home/aegl/zx1-smp/arch/ia64/include/asm/processor.h: In function
‘ia64_get_irr’:
/home/aegl/zx1-smp/arch/ia64/include/asm/processor.h:565: error:
implicit declaration of function ‘test_bit’
In file included from include/linux/bitops.h:33,
                 from include/linux/kernel.h:10,
                 from include/asm-generic/bug.h:13,
                 from /home/aegl/zx1-smp/arch/ia64/include/asm/bug.h:12,
                 from include/linux/bug.h:4,
                 from include/linux/thread_info.h:11,
                 from include/asm-generic/preempt.h:4,
                 from arch/ia64/include/generated/asm/preempt.h:1,
                 from include/linux/preempt.h:18,
                 from include/linux/uaccess.h:4,
                 from /home/aegl/zx1-smp/arch/ia64/include/asm/sections.h:10,
                 from arch/ia64/kernel/patch.c:13:
/home/aegl/zx1-smp/arch/ia64/include/asm/bitops.h: At top level:
/home/aegl/zx1-smp/arch/ia64/include/asm/bitops.h:339: error: static
declaration of ‘test_bit’ follows non-static declaration
/home/aegl/zx1-smp/arch/ia64/include/asm/processor.h:565: error:
previous implicit declaration of ‘test_bit’ was here
make[1]: *** [arch/ia64/kernel/patch.o] Error 1
make: *** [arch/ia64/kernel/patch.o] Error 2

Other files choke in the similar way because they no longer implicitly
get <linux/kernel.h>
(and all the other files that pulls in). Just backing out that one
line of diff fixes it for me.
But presumably is a problem someplace else given the "avoid recursive #includes"
bit of the commit message.

-Tony

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

* Re: [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly
  2013-11-13  0:23     ` Tony Luck
@ 2013-11-13  0:29       ` Joe Perches
  2013-11-13 19:31         ` Tony Luck
  0 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2013-11-13  0:29 UTC (permalink / raw)
  To: Tony Luck
  Cc: Andrew Morton, James Hogan, Linux Kernel Mailing List,
	linux-next, linux-metag

On Tue, 2013-11-12 at 16:23 -0800, Tony Luck wrote:
> Trying this again with HTML disabled in gmail so mailing lists will see it ...

try this:

https://lkml.org/lkml/2013/10/30/604

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

* Re: [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly
  2013-11-13  0:29       ` Joe Perches
@ 2013-11-13 19:31         ` Tony Luck
       [not found]           ` <CA+8MBbJKN174=ybMNE7Z+oT7KjNBzgdy9cvhb_kACvXAbTo9XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Tony Luck @ 2013-11-13 19:31 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andrew Morton, James Hogan, Linux Kernel Mailing List,
	linux-next, linux-metag

On Tue, Nov 12, 2013 at 4:29 PM, Joe Perches <joe@perches.com> wrote:
> try this:
>
> https://lkml.org/lkml/2013/10/30/604
>
>

How is that any different from what is in linux-next?  It still
has the same change to cache.h that reduces the nested
#includes that currently make the build work.

-#include <linux/kernel.h>
+#include <uapi/linux/kernel.h>

-Tony

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

* Re: [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly
       [not found]           ` <CA+8MBbJKN174=ybMNE7Z+oT7KjNBzgdy9cvhb_kACvXAbTo9XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-11-14  1:16             ` Joe Perches
  0 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2013-11-14  1:16 UTC (permalink / raw)
  To: Tony Luck
  Cc: Andrew Morton, James Hogan, Linux Kernel Mailing List,
	linux-next-u79uwXL29TY76Z2rM5mHXA,
	linux-metag-u79uwXL29TY76Z2rM5mHXA

On Wed, 2013-11-13 at 11:31 -0800, Tony Luck wrote:
> On Tue, Nov 12, 2013 at 4:29 PM, Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote:
> > try this:
> >
> > https://lkml.org/lkml/2013/10/30/604
> >
> >
> 
> How is that any different from what is in linux-next?  It still
> has the same change to cache.h that reduces the nested
> #includes that currently make the build work.
> 
> -#include <linux/kernel.h>
> +#include <uapi/linux/kernel.h>
> 
> -Tony

I believe you were cc'd on this email as
a reply to a kbuild test robot report:

I don't have an ia64 cross compiler here but
my presumption is this fixes the problem.

I believe Andrew has picked it up for his mm
series which is haphazardly merged into -next.

-----------

On Thu, 2013-11-07 at 10:54 +0800, kbuild test robot wrote:
> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   7610384ab26340452f06d673c46624927c3901b6
> commit: 7231446cc53d71e126acf3d0230239a6b3ad52bf [169/450] printk/cache: Mark printk_once test variable __read_mostly
> config: make ARCH=ia64 alldefconfig
> 
> All error/warnings:

Hello Fengguang.

>    In file included from arch/ia64/kernel/patch.c:12:0:
>    arch/ia64/include/asm/processor.h: In function 'ia64_get_irr':
> >> arch/ia64/include/asm/processor.h:565:2: error: implicit declaration of function 'test_bit' [-Werror=implicit-function-declaration]

I'm a bit confused how the change I made could cause this error.

Is this an existing warning that's now an error because
bitops.h isn't explicitly #included in processor.h?

(possible fix below)

>    In file included from include/linux/bitops.h:22:0,
>                     from include/linux/kernel.h:10,
>                     from include/asm-generic/bug.h:13,
>                     from arch/ia64/include/asm/bug.h:12,
>                     from include/linux/bug.h:4,
>                     from include/linux/thread_info.h:11,
>                     from include/linux/preempt.h:9,
>                     from include/linux/uaccess.h:4,
>                     from arch/ia64/include/asm/sections.h:10,
>                     from arch/ia64/kernel/patch.c:13:
>    arch/ia64/include/asm/bitops.h: At top level:
> >> arch/ia64/include/asm/bitops.h:339:1: error: static declaration of 'test_bit' follows non-static declaration
>    arch/ia64/include/asm/processor.h:565:9: note: previous implicit declaration of 'test_bit' was here
>    cc1: some warnings being treated as errors
> 
> vim +/test_bit +565 arch/ia64/include/asm/processor.h
> 
>    549        #define cpu_relax()     ia64_hint(ia64_hint_pause)
>    550        
>    551        static inline int
>    552        ia64_get_irr(unsigned int vector)
>    553        {
>    554                unsigned int reg = vector / 64;
>    555                unsigned int bit = vector % 64;
>    556                u64 irr;
>    557        
>    558                switch (reg) {
>    559                case 0: irr = ia64_getreg(_IA64_REG_CR_IRR0); break;
>    560                case 1: irr = ia64_getreg(_IA64_REG_CR_IRR1); break;
>    561                case 2: irr = ia64_getreg(_IA64_REG_CR_IRR2); break;
>    562                case 3: irr = ia64_getreg(_IA64_REG_CR_IRR3); break;
>    563                }
>    564        
>  > 565                return test_bit(bit, &irr);
>    566        }
>    567        
>    568        static inline void
>    569        ia64_set_lrr0 (unsigned long val)
>    570        {
>    571                ia64_setreg(_IA64_REG_CR_LRR0, val);
>    572                ia64_srlz_d();
>    573        }
> 
> ---
> 0-DAY kernel build testing backend              Open Source Technology Center
> http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation

Maybe this fixes it?
---
 arch/ia64/include/asm/processor.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index 5a84b3a..efd1b92 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -71,6 +71,7 @@
 #include <linux/compiler.h>
 #include <linux/threads.h>
 #include <linux/types.h>
+#include <linux/bitops.h>
 
 #include <asm/fpu.h>
 #include <asm/page.h>


--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-11-14  1:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30 10:18 [RFC PATCH -next] Fix printk_once build errors due to __read_mostly James Hogan
2013-10-30 13:46 ` Joe Perches
2013-10-30 17:02 ` Joe Perches
2013-10-30 20:48 ` Andrew Morton
2013-10-30 22:58   ` Joe Perches
2013-10-30 23:01   ` [PATCH V2] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
2013-10-31 13:35     ` James Hogan
2013-10-30 23:18   ` [RFC PATCH -next] Fix printk_once build errors due to __read_mostly Stephen Rothwell
2013-10-31 18:29   ` [PATCH V3] printk/cache: Mark printk_once test variable __read_mostly Joe Perches
2013-11-13  0:23     ` Tony Luck
2013-11-13  0:29       ` Joe Perches
2013-11-13 19:31         ` Tony Luck
     [not found]           ` <CA+8MBbJKN174=ybMNE7Z+oT7KjNBzgdy9cvhb_kACvXAbTo9XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-14  1:16             ` Joe Perches

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