Skip to contentSkip to conversation

hardirq.h removal broke sparc64 build...

DISCUSSION David Miller 3 participants 5 messages Jan 7, 2009 – Jan 8, 2009

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

[ Andrew, read carefully, I think some part of a patch you
merged might have been lost while reshuffling or whatever. ]

This change:

commit ba84be2338d3a2b6020d39279335bb06fcd332e1

Author: Russell King <[email protected]>
Date:   Tue Jan 6 14:41:07 2009 -0800

remove linux/hardirq.h from asm-generic/local.h

broke the build on sparc64:

drivers/base/topology.c: In function ‘show_physical_package_id’:
drivers/base/topology.c:103: error: implicit declaration of function ‘cpu_data’ drivers/base/topology.c:103: error: request for member ‘proc_id’ in something not a structure or union drivers/base/topology.c: In function ‘show_core_id’:
drivers/base/topology.c:106: error: request for member ‘core_id’ in something not a structure or union

Even though there is a footnote there from Alexey saying that sparc64 was fixed up :-)

[[email protected]: fix sparc64]

I've spent most of last night and this morning trying to figure out a way to fix this, it is very non-trivial.

Adding a simple asm/cpudata.h include into asm/topology_64.h for the SMP case does not work.

asm/cpudata.h brings in percpu.h which wants SLAB which wants to use GFP_* values and thus includes gfp.h

And thus because of the include loop:

	linux/gfp.h --> linux/mmzone.h --> linux/topology.h -->
	asm/topology.h --> asm/cpudata.h --> linux/percpu.h -->
	linux/slab.h

we can't include asm/cpudata.h into asm/topology.h otherwise we get:

include/linux/slub_def.h: In function ‘kmalloc_large’:
include/linux/slub_def.h:209: error: implicit declaration of function ‘__get_free_pages’ include/linux/slub_def.h:209: error: ‘__GFP_COMP’ undeclared (first use in this function) include/linux/slub_def.h:209: error: (Each undeclared identifier is reported only once include/linux/slub_def.h:209: error: for each function it appears in.) include/linux/slub_def.h:209: warning: cast to pointer from integer of different size

for the drivers/base/topology.o build failure case above.

Actually, looking at the patch, where is the part from Alexey that does the "fix sparc64"? I see nothing in the patch that would even appear to possibly be for that. The diffstat is:

 arch/avr32/kernel/traps.c     |    1 +
 arch/sh/kernel/traps_32.c     |    1 +
 drivers/acpi/processor_idle.c |    1 +
 include/asm-generic/local.h   |    1 -
 4 files changed, 3 insertions(+), 1 deletion(-)

Was Alexey's fix removed or lost? :-/
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¬¥ªÜ–)îÇø§¶›¡Ü¨}©ž²Æ zÚ&j:+v‰¨þø¯ù®w¥þŠà2ŠÞ™¨è­Ú&¢)ß¡«a¶Úÿÿûàz¿äz¹Þ—ú+ƒùšŽŠÝ¢jÿŠwèþf

#1 lore raw
Quoted 6 lines · On Wed, 07 Jan 2009 14:43:10 -0800 (PST) David Miller <[email protected]>…

[ Andrew, read carefully, I think some part of a patch you
merged might have been lost while reshuffling or whatever. ]

This change:

Quoted 7 lines

commit ba84be2338d3a2b6020d39279335bb06fcd332e1

Author: Russell King <[email protected]>
Date:   Tue Jan 6 14:41:07 2009 -0800

remove linux/hardirq.h from asm-generic/local.h

broke the build on sparc64:

urgh, sorry.

Quoted 10 lines

drivers/base/topology.c: In function ___show_physical_package_id___:
drivers/base/topology.c:103: error: implicit declaration of function ___cpu_data___ drivers/base/topology.c:103: error: request for member ___proc_id___ in something not a structure or union drivers/base/topology.c: In function ___show_core_id___:
drivers/base/topology.c:106: error: request for member ___core_id___ in something not a structure or union

Even though there is a footnote there from Alexey saying that sparc64 was fixed up :-)

[[email protected]: fix sparc64]

OK, that patch was misdescribed. It in fact added the <asm/hardirq.h> includes to arch/avr32/kernel/traps.c and arch/sh/kernel/traps_32.c.

The "sparc fix" was Sam's patch:

arch/sparc/kernel/mdesc.c renamed from arch/sparc/kernel/mdesc.c~remove-linux-hardirqh-from-asm-generic-localh-sparc-fix +1 -0
@@ -11,6 +11,7 @@
 #include <linux/mm.h>
 #include <linux/miscdevice.h>
 
+#include <asm/cpudata.h>
 #include <asm/hypervisor.h>
 #include <asm/mdesc.h>
 #include <asm/prom.h>
arch/sparc/kernel/sysfs.c renamed from arch/sparc/kernel/sysfs.c~remove-linux-hardirqh-from-asm-generic-localh-sparc-fix +1 -0
@@ -8,6 +8,7 @@
 #include <linux/percpu.h>
 #include <linux/init.h>
 
+#include <asm/cpudata.h>
 #include <asm/hypervisor.h>
 #include <asm/spitfire.h>
 

which did get included.

Quoted 18 lines

I've spent most of last night and this morning trying to figure out a way to fix this, it is very non-trivial.

Adding a simple asm/cpudata.h include into asm/topology_64.h for the SMP case does not work.

asm/cpudata.h brings in percpu.h which wants SLAB which wants to use GFP_* values and thus includes gfp.h

And thus because of the include loop:

	linux/gfp.h --> linux/mmzone.h --> linux/topology.h -->
	asm/topology.h --> asm/cpudata.h --> linux/percpu.h -->
	linux/slab.h

we can't include asm/cpudata.h into asm/topology.h otherwise we get:

Quoted 8 lines

include/linux/slub_def.h: In function ___kmalloc_large___:
include/linux/slub_def.h:209: error: implicit declaration of function _____get_free_pages___ include/linux/slub_def.h:209: error: _____GFP_COMP___ undeclared (first use in this function) include/linux/slub_def.h:209: error: (Each undeclared identifier is reported only once include/linux/slub_def.h:209: error: for each function it appears in.) include/linux/slub_def.h:209: warning: cast to pointer from integer of different size

for the drivers/base/topology.o build failure case above.

yes, there were some nasty problems liek that. In several cases we wimped out and added the necessary includes to the .c file. Will that (sad hack) work here?

author maintainer
#2 lore raw

From: Andrew Morton <[email protected]>
Date: Wed, 7 Jan 2009 14:58:22 -0800

Quoted 8 lines
Quoted 1 line · On Wed, 07 Jan 2009 14:43:10 -0800 (PST) David Miller <[email protected]>…

for the drivers/base/topology.o build failure case above.

yes, there were some nasty problems liek that. In several cases we wimped out and added the necessary includes to the .c file. Will that (sad hack) work here?

I'll try that but if other gremlins pop up I'll simply add a linux/hardirq.h include to arch/sparc/include/asm/local.h

author maintainer
#3 lore raw
In reply to Andrew Morton

From: Andrew Morton <[email protected]>
Date: Wed, 7 Jan 2009 14:58:22 -0800

Quoted 13 lines
Quoted 10 lines · On Wed, 07 Jan 2009 14:43:10 -0800 (PST) David Miller <[email protected]>…

I've spent most of last night and this morning trying to figure out a way to fix this, it is very non-trivial.

Adding a simple asm/cpudata.h include into asm/topology_64.h for the SMP case does not work.

asm/cpudata.h brings in percpu.h which wants SLAB which wants to use GFP_* values and thus includes gfp.h

And thus because of the include loop:

...

Quoted 2 lines
Quoted 2 lines

we can't include asm/cpudata.h into asm/topology.h otherwise we get:

...

Quoted 5 lines
Quoted 1 line

for the drivers/base/topology.o build failure case above.

yes, there were some nasty problems like that. In several cases we wimped out and added the necessary includes to the .c file. Will that (sad hack) work here?

Ok, this works.

Linus, please apply, thanks!

topology: Fix sparc64 build.

Due to changeset ba84be2338d3a2b6020d39279335bb06fcd332e1 ("remove linux/hardirq.h from asm-generic/local.h") the sparc64 build started failing on drivers/base/topology.c:

drivers/base/topology.c: In function ‘show_physical_package_id’:
drivers/base/topology.c:103: error: implicit declaration of function ‘cpu_data’ drivers/base/topology.c:103: error: request for member ‘proc_id’ in something not a structure or union drivers/base/topology.c: In function ‘show_core_id’:
drivers/base/topology.c:106: error: request for member ‘core_id’ in something not a structure or union

Adding the obvious fix of including asm/cpudata.h into asm/topology.h on sparc64 doesn't fix it, in fact it makes things worse because of the header file dependency chain:

	linux/gfp.h --> linux/mmzone.h --> linux/topology.h -->
	asm/topology.h --> asm/cpudata.h --> linux/percpu.h -->
	linux/slab.h

which results in:

include/linux/slub_def.h: In function ‘kmalloc_large’:
include/linux/slub_def.h:209: error: implicit declaration of function ‘__get_free_pages’ include/linux/slub_def.h:209: error: ‘__GFP_COMP’ undeclared (first use in this function) include/linux/slub_def.h:209: error: (Each undeclared identifier is reported only once include/linux/slub_def.h:209: error: for each function it appears in.) include/linux/slub_def.h:209: warning: cast to pointer from integer of different size

The simplest thing to do is to add yet another one-off hack like parts of the guilty changeset did, by putting an explicit linux/hardirq.h include into drivers/base/topology.c

drivers/base/topology.c +1 -0
index a8bc1cb..a778fb5 100644
@@ -28,6 +28,7 @@
 #include <linux/mm.h>
 #include <linux/cpu.h>
 #include <linux/module.h>
+#include <linux/hardirq.h>
 #include <linux/topology.h>
 
 #define define_one_ro(_name) 		\

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¬¥ªÜ–)îÇø§¶›¡Ü¨}©ž²Æ zÚ&j:+v‰¨þø¯ù®w¥þŠà2ŠÞ™¨è­Ú&¢)ß¡«a¶Úÿÿûàz¿äz¹Þ—ú+ƒùšŽŠÝ¢jÿŠwèþf

#4 lore raw
In reply to David Miller
Quoted 5 lines

Actually, looking at the patch, where is the part from Alexey that does the "fix sparc64"? I see nothing in the patch that would even appear to possibly be for that. The diffstat is:

Quoted 7 lines
 arch/avr32/kernel/traps.c     |    1 +
 arch/sh/kernel/traps_32.c     |    1 +
 drivers/acpi/processor_idle.c |    1 +
 include/asm-generic/local.h   |    1 -
 4 files changed, 3 insertions(+), 1 deletion(-)

Was Alexey's fix removed or lost? :-/

When I made my patch I saw some issues in non-sparc files but I did not address these as I thought they were generic bugs addressed by someone else.
I should have checked if the same build error was also present on x86/arm then :-(

I'm glad to see it is sorted out properly now.

Sam