Build problems: references to init_mm in pgtable*.h
Hi all,
My normal xen .config will not build on recent linux-2.6-merge.hg trees. The problem is the
include/asm-i386/mach-xen/asm/pgtable-2level.h and include/asm-i386/mach-xen/asm/pgtable-3level.h
files, which reference "init_mm" without ever pulling in a definition of those files.
Whether you see the problem or not depends on the .config; most files which include the pgtable*.h includes already pull in sched.h (which is where init_mm is declared), but not all do so. Trivial patch attached, but it's not necessarily the best solution as we don't want sched.h changes polluting mm .o's unnecessarily.
--Stephen
# HG changeset patch
# User [email protected]
# Node ID c819204afd3829b65080f484e29bba4ef1130044 # Parent 9c37a7190588f04180851153bdcaaba9d566ed75 Builds are breaking with errors such as:
In file included from include/asm/mach-xen/asm/pgtable.h:253,
from include/asm/mach-xen/asm/desc.h:99,
from include/asm/suspend.h:6,
from include/linux/suspend.h:5,
from kernel/power/main.c:11:include/asm/mach-xen/asm/pgtable-2level.h: In function ‘set_pte_at’:include/asm/mach-xen/asm/pgtable-2level.h:21: error: dereferencing pointer to incomplete type include/asm/mach-xen/asm/pgtable-2level.h:21: error: ‘init_mm’ undeclared (first use in this function)
due to include/asm-i386/mach-xen/asm/pgtable-*level.h referencing "init_mm" without declaring it. We need to #include <sched.h> first to make this work.
include/asm-i386/mach-xen/asm/pgtable-2level.h +1 -0
@@ -2,6 +2,7 @@#define _I386_PGTABLE_2LEVEL_H#include <asm-generic/pgtable-nopmd.h> +#include <linux/sched.h> #define pte_ERROR (e) \ printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
include/asm-i386/mach-xen/asm/pgtable-3level.h +1 -0
@@ -2,6 +2,7 @@#define _I386_PGTABLE_3LEVEL_H#include <asm-generic/pgtable-nopud.h> +#include <linux/sched.h> /* * Intel Physical Address Extension (PAE) Mode - three-level page
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · Stephen Tweedie
My normal xen .config will not build on recent linux-2.6-merge.hg trees. The problem is the
include/asm-i386/mach-xen/asm/pgtable-2level.h and include/asm-i386/mach-xen/asm/pgtable-3level.h
Quoted 8 lines
files, which reference "
init_mm" without ever pulling in a definition of those files.Whether you see the problem or not depends on the .config; most files which include the pgtable*.h includes already pull in
sched.h(which is whereinit_mmis declared), but not all do so. Trivial patch attached, but it's not necessarily the best solution as we don't wantsched.hchanges polluting mm .o's unnecessarily.
I've changed the set_pte_at and set_pte_at_sync inline functions to be macros. This way, init_mm only needs to be defined where these macros are used.
Does this fix all the errors you're seeing?
christian
Hi,
Quoted 4 lines · Christian Limpach
I've changed the
set_pte_atandset_pte_at_syncinline functions to be macros. This way,init_mmonly needs to be defined where these macros are used.
Does this fix all the errors you're seeing?
It's still failing for kernel/power/main.c, which depends on CONFIG_PM. Now, which parts of CONFIG_PM are safe under Xen is another question --- the right answer here may well be to add a "depends !XEN" to CONFIG_PM. But with it enabled I still get
CC kernel/power/main.o
In file included from include/asm/suspend.h:6,
from include/linux/suspend.h:5,
from kernel/power/main.c:11:include/asm/mach-xen/asm/desc.h: In function ‘write_ldt_entry’:include/asm/mach-xen/asm/desc.h:103: error: ‘init_mm’ undeclared (first use in this function) include/asm/mach-xen/asm/desc.h:103: error: (Each undeclared identifier is reported only once include/asm/mach-xen/asm/desc.h:103: error: for each function it appears in.)
with the macro fix. I'm using the PM config options:
# Power management options (ACPI, APM)CONFIG_PM=yCONFIG_X86_PM_TIMER=yCONFIG_ACPI_POWER=y
for now --- I really want to be able to run a dom0 on my laptop, even if the cpufreq governer gets a little confused about time spent in a domU. It certainly builds and boots fine with the PM options enabled, as long as I include linux/sched.h in the pgtable*.h files.
Cheers,
Stephen
Quoted 9 lines · Stephen C. Tweedie
Hi,
Quoted 4 lines · Christian Limpach
I've changed the
set_pte_atandset_pte_at_syncinline functions to be macros. This way,init_mmonly needs to be defined where these macros are used.
Does this fix all the errors you're seeing?
Quoted 4 lines
It's still failing for
kernel/power/main.c, which depends onCONFIG_PM. Now, which parts ofCONFIG_PMare safe under Xen is another question --- the right answer here may well be to add a "depends !XEN" toCONFIG_PM. But with it enabled I still get
I've fixed this one now by making write_ldt_entry a proper function instead of an inline function. This avoids having pgtable.h and sched.h included from desc.h.
christian
Quoted 28 lines
CC
kernel/power/main.o
In file included frominclude/asm/suspend.h:6,
frominclude/linux/suspend.h:5,
fromkernel/power/main.c:11:include/asm/mach-xen/asm/desc.h: In function ???write_ldt_entry???:include/asm/mach-xen/asm/desc.h:103: error: ???init_mm??? undeclared (first use in this function)include/asm/mach-xen/asm/desc.h:103: error: (Each undeclared identifier is reported only onceinclude/asm/mach-xen/asm/desc.h:103: error: for each function it appears in.)with the macro fix. I'm using the PM config options:
# Power management options (ACPI, APM)
CONFIG_PM=yCONFIG_X86_PM_TIMER=yCONFIG_ACPI_POWER=yfor now --- I really want to be able to run a dom0 on my laptop, even if the cpufreq governer gets a little confused about time spent in a domU. It certainly builds and boots fine with the PM options enabled, as long as I include
linux/sched.hin the pgtable*.h files.Cheers,
Stephen
Hi,
Quoted 8 lines · Christian Limpach
Quoted 4 lines
It's still failing for
kernel/power/main.c, which depends onCONFIG_PM. Now, which parts ofCONFIG_PMare safe under Xen is another question --- the right answer here may well be to add a "depends !XEN" toCONFIG_PM. But with it enabled I still getI've fixed this one now by making
write_ldt_entrya proper function instead of an inline function. This avoids havingpgtable.handsched.hincluded fromdesc.h.
Thanks --- no more such errors on today's linux-2.6-merge.hg.
--Stephen