Skip to contentSkip to conversation

linux-next: build failure after merge of the ftrace tree

DISCUSSION Stephen Rothwell 3 participants 6 messages Nov 21, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Steven,

After merging the ftrace tree, today's linux-next build (powerpc allnoconfig) failed like this:

In file included from include/asm-generic/percpu.h:6:0,
from arch/powerpc/include/asm/percpu.h:19,
from include/linux/percpu.h:11,
from include/linux/sched.h:41,
from arch/powerpc/kernel/asm-offsets.c:17:
include/linux/percpu.h:138:17: error: 'printk_func_t' undeclared here (not in a function)

 DECLARE_PER_CPU(printk_func_t, printk_func);
                 ^
include/linux/percpu-defs.h:101:38: note: in definition of macro 'DECLARE_PER_CPU_SECTION'
  extern __PCPU_ATTRS(sec) __typeof__(type) name
                                      ^

include/linux/percpu.h:138:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(printk_func_t, printk_func);
^

Caused by commit afdc34a3d3b8 ("printk: Add per_cpu printk func to allow printk to be diverted"). See Rule 1 in Documentation/SubmitChecklist.

I reverted that commit (and the following one (a9edc8809328 "x86/nmi:
Perform a safe NMI stack trace on all CPUs" in case it depended in it) for today.

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#1 lore raw
Quoted 11 lines · Stephen Rothwell

Hi Steven,

After merging the ftrace tree, today's linux-next build (powerpc allnoconfig) failed like this:

In file included from include/asm-generic/percpu.h:6:0,
from arch/powerpc/include/asm/percpu.h:19,
from include/linux/percpu.h:11,
from include/linux/sched.h:41,
from arch/powerpc/kernel/asm-offsets.c:17:
include/linux/percpu.h:138:17: error: 'printk_func_t' undeclared here (not in a function)

Quoted 8 lines
 DECLARE_PER_CPU(printk_func_t, printk_func);
                 ^
include/linux/percpu-defs.h:101:38: note: in definition of macro 'DECLARE_PER_CPU_SECTION'
  extern __PCPU_ATTRS(sec) __typeof__(type) name
                                      ^

include/linux/percpu.h:138:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(printk_func_t, printk_func);
^

From: Jiri Kosina <[email protected]>
Subject: [PATCH] printk: make sure printk_func_t is known in percpu.h

Commit afdc34a3d3b8 ("printk: Add per_cpu printk func to allow printk to be diverted") caused percpu variable printk_func to be declared in percpu.h. Make sure that the corresponding type is known at the time of declaration.

Fixes build failure on certain arch/config combinations.

---
 include/linux/percpu.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/percpu.h +1 -0
index a3aa63e..c94c766 100644
@@ -7,6 +7,7 @@
 #include <linux/cpumask.h>
 #include <linux/pfn.h>
 #include <linux/init.h>
+#include <linux/printk.h>
 
 #include <asm/percpu.h>
 
Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw
Quoted 23 lines

From: Jiri Kosina <[email protected]>
Subject: [PATCH] printk: make sure printk_func_t is known in percpu.h

Commit afdc34a3d3b8 ("printk: Add per_cpu printk func to allow printk to be diverted") caused percpu variable printk_func to be declared in percpu.h. Make sure that the corresponding type is known at the time of declaration.

Fixes build failure on certain arch/config combinations.

---
 include/linux/percpu.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/percpu.h +0 -0
index a3aa63e..c94c766 100644

include/linux/percpu.h line 12

Quoted 6 lines
include/linux/percpu.h +1 -0
@@ -7,6 +7,7 @@
 #include <linux/cpumask.h>
 #include <linux/pfn.h>
 #include <linux/init.h>
+#include <linux/printk.h>
 
 #include <asm/percpu.h>

Unfortunately, this wasn't the fix. This was an allnoconfig, which means printk wasn't defined.

-- Steve

From: "Steven Rostedt (Red Hat)" <[email protected]>
Date: Fri, 21 Nov 2014 09:16:58 -0500
Subject: [PATCH] printk/percpu: Do not define printk_func when printk is not
defined

To avoid include hell, the per_cpu variable printk_func was declared in percpu.h. But it is only defined if printk is defined.

---
 include/linux/percpu.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/percpu.h +2 -0
index ba2e85a0ff5b..74398ef1d294 100644
@@ -134,7 +134,9 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
 	(typeof(type) __percpu *)__alloc_percpu(sizeof(type),		\
 						__alignof__(type))
 
+#ifdef CONFIG_PRINTK
 /* To avoid include hell, as printk can not declare this, we declare it here */
 DECLARE_PER_CPU(printk_func_t, printk_func);
+#endif
 
 #endif /* __LINUX_PERCPU_H */
Signature · 1 line
2.1.1
#3 lore raw
Quoted 26 lines · Steven Rostedt
Quoted 26 lines

From: Jiri Kosina <[email protected]>
Subject: [PATCH] printk: make sure printk_func_t is known in percpu.h

Commit afdc34a3d3b8 ("printk: Add per_cpu printk func to allow printk to be diverted") caused percpu variable printk_func to be declared in percpu.h. Make sure that the corresponding type is known at the time of declaration.

Fixes build failure on certain arch/config combinations.

---
 include/linux/percpu.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/percpu.h +1 -0
index a3aa63e..c94c766 100644
@@ -7,6 +7,7 @@
 #include <linux/cpumask.h>
 #include <linux/pfn.h>
 #include <linux/init.h>
+#include <linux/printk.h>
 
Quoted 4 lines

include/linux/percpu.h line 12

Quoted 1 line
include/linux/percpu.h +0 -0
 #include <asm/percpu.h>

Unfortunately, this wasn't the fix. This was an allnoconfig, which means printk wasn't defined.

Ah, thanks, that indeed needs to be done as well.

I still think that the patch I sent should be applied, as there might be configurations where printk.h doesn't implicitly transitively make it into percpu.h.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#4 lore raw
In reply to Steven Rostedt
Quoted 10 lines · On Fri, 21 Nov 2014 09:20:36 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 10 lines
include/linux/percpu.h +1 -0
index a3aa63e..c94c766 100644
@@ -7,6 +7,7 @@
 #include <linux/cpumask.h>
 #include <linux/pfn.h>
 #include <linux/init.h>
+#include <linux/printk.h>
 
Quoted 5 lines

include/linux/percpu.h line 12

Quoted 1 line
include/linux/percpu.h +0 -0
 #include <asm/percpu.h>

Unfortunately, this wasn't the fix. This was an allnoconfig, which means printk wasn't defined.

Just to be safe, I put the printk.h back in. Although it doesn't seem to be needed.

-- Steve

Quoted 1 line

From da1e044a557571fd3718bd161b7ce7f36d3f999e Mon Sep 17 00:00:00 2001

From: "Steven Rostedt (Red Hat)" <[email protected]>
Date: Fri, 21 Nov 2014 09:16:58 -0500
Subject: [PATCH] printk/percpu: Do not define printk_func when printk is not
defined

To avoid include hell, the per_cpu variable printk_func was declared in percpu.h. But it is only defined if printk is defined.

Also add a printk.h include in percpu.h just to be safe.

---
 include/linux/percpu.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/percpu.h +3 -0
index ba2e85a0ff5b..87e9082a2bd4 100644
@@ -5,6 +5,7 @@
 #include <linux/preempt.h>
 #include <linux/smp.h>
 #include <linux/cpumask.h>
+#include <linux/printk.h>
 #include <linux/pfn.h>
 #include <linux/init.h>
 
@@ -134,7 +135,9 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
 	(typeof(type) __percpu *)__alloc_percpu(sizeof(type),		\
 						__alignof__(type))
 
+#ifdef CONFIG_PRINTK
 /* To avoid include hell, as printk can not declare this, we declare it here */
 DECLARE_PER_CPU(printk_func_t, printk_func);
+#endif
 
 #endif /* __LINUX_PERCPU_H */
Signature · 1 line
1.8.1.4
#5 lore raw
In reply to Stephen Rothwell
Quoted 16 lines · On Fri, 21 Nov 2014 18:32:15 +1100 Stephen Rothwell <[email protected]>…

Hi Steven,

After merging the ftrace tree, today's linux-next build (powerpc allnoconfig) failed like this:

In file included from include/asm-generic/percpu.h:6:0,
from arch/powerpc/include/asm/percpu.h:19,
from include/linux/percpu.h:11,
from include/linux/sched.h:41,
from arch/powerpc/kernel/asm-offsets.c:17:
include/linux/percpu.h:138:17: error: 'printk_func_t' undeclared here (not in a function)

 DECLARE_PER_CPU(printk_func_t, printk_func);
                 ^
include/linux/percpu-defs.h:101:38: note: in definition of macro 'DECLARE_PER_CPU_SECTION'
  extern __PCPU_ATTRS(sec) __typeof__(type) name
                                      ^
Quoted 8 lines

include/linux/percpu.h:138:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(printk_func_t, printk_func);
^

Caused by commit afdc34a3d3b8 ("printk: Add per_cpu printk func to allow printk to be diverted"). See Rule 1 in Documentation/SubmitChecklist.

I had to fight header include hell with that change. That's why rule 1 wasn't followed so well.

Thanks Jiri for fixing it. I'll start running your patch through my tests.

-- Steve