Re: hardirq.h removal broke sparc64 build...

From: David Miller
Date: Wed Jan 07 2009 - 18:30:27 EST


From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 7 Jan 2009 14:58:22 -0800

> On Wed, 07 Jan 2009 14:43:10 -0800 (PST)
> David Miller <davem@xxxxxxxxxxxxx> wrote:
>
> > 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:
...
> > we can't include asm/cpudata.h into asm/topology.h otherwise
> > we get:
...
> > 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

Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index a8bc1cb..a778fb5 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -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‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i