Magnus Damm
2006-Apr-04 22:45 UTC
[Xen-devel] [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
Fix __XEN_INTERFACE_VERSION__ old config breakage For old kernel configurations that lack CONFIG_XEN_INTERFACE_VERSION, __XEN_INTERFACE_VERSION__ will currently be defined but set to nothing. If a xen-enabled kernel is built separately from the xen-unstable dist, the following error occurs with xen-unstable-9415: # # using defaults found in .config # SPLIT include/linux/autoconf.h -> include/config/* CC arch/i386/kernel/asm-offsets.s In file included from include/xen/interface/xen.h:439, from include/asm/mach-xen/asm/page.h:20, from include/asm/thread_info.h:14, from include/linux/thread_info.h:21, from include/linux/preempt.h:10, from include/linux/spinlock.h:50, from include/linux/capability.h:45, from include/linux/sched.h:7, from arch/i386/kernel/asm-offsets.c:7: include/xen/interface/xen-compat.h:22:31: #if with no expression include/xen/interface/xen-compat.h:26:31: #if with no expression make[1]: *** [arch/i386/kernel/asm-offsets.s] Error 1 make: *** [prepare0] Error 2 $ The patch below fixes the problem and makes the logic in xen-compat.h work correctly - __XEN_INTERFACE_VERSION__ now becomes unset if the config option is missing. Signed-Off-By: Magnus Damm <magnus@valinux.co.jp> --- linux-2.6-xen-sparse/arch/i386/Makefile +++ linux-2.6-xen-sparse/arch/i386/Makefile 2006-03-31 16:36:09.000000000 +0900 @@ -45,8 +45,10 @@ CFLAGS += $(shell if [ $(call cc-vers CFLAGS += $(cflags-y) +ifneq "$(CONFIG_XEN_INTERFACE_VERSION)" "" cppflags-$(CONFIG_XEN) += \ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION) +endif CPPFLAGS += $(cppflags-y) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Apr-06 14:11 UTC
Re: [Xen-devel] [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 4 Apr 2006, at 23:45, Magnus Damm wrote:> Fix __XEN_INTERFACE_VERSION__ old config breakage > > For old kernel configurations that lack CONFIG_XEN_INTERFACE_VERSION, > __XEN_INTERFACE_VERSION__ will currently be defined but set to nothing. > > If a xen-enabled kernel is built separately from the xen-unstable dist, > the following error occurs with xen-unstable-9415:I don''t think this will work, since the interface version will be set to 0 by xen-compat.h, but the current Linux kernel patches want to build against interface version 0x00030101. Just run ''make oldconfig'' to update your .config file with the correct definition of CONFIG_XEN_INTERFACE_VERSION. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Christian Limpach
2006-Apr-07 00:33 UTC
[Xen-devel] Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 4/4/06, Magnus Damm <magnus@valinux.co.jp> wrote:> Fix __XEN_INTERFACE_VERSION__ old config breakage > > For old kernel configurations that lack CONFIG_XEN_INTERFACE_VERSION, > __XEN_INTERFACE_VERSION__ will currently be defined but set to nothing.I''ve checked in a change to xen-compat.h which handles this case. christian _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Magnus Damm
2006-Apr-07 04:17 UTC
Re: [Xen-devel] Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 4/7/06, Christian Limpach <christian.limpach@gmail.com> wrote:> On 4/4/06, Magnus Damm <magnus@valinux.co.jp> wrote: > > Fix __XEN_INTERFACE_VERSION__ old config breakage > > > > For old kernel configurations that lack CONFIG_XEN_INTERFACE_VERSION, > > __XEN_INTERFACE_VERSION__ will currently be defined but set to nothing. > > I''ve checked in a change to xen-compat.h which handles this case.Very good. A much cleaner solution too. Thanks! / magnus _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Apr-07 07:33 UTC
Re: [Xen-devel] Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 7 Apr 2006, at 05:17, Magnus Damm wrote:>> On 4/4/06, Magnus Damm <magnus@valinux.co.jp> wrote: >>> Fix __XEN_INTERFACE_VERSION__ old config breakage >>> >>> For old kernel configurations that lack CONFIG_XEN_INTERFACE_VERSION, >>> __XEN_INTERFACE_VERSION__ will currently be defined but set to >>> nothing. >> >> I''ve checked in a change to xen-compat.h which handles this case. > > Very good. A much cleaner solution too. Thanks!Does this lead to a kernel that actually works (e.g., can you sgut it down without crashing)? I doubt it. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Magnus Damm
2006-Apr-07 07:48 UTC
Re: [Xen-devel] Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 4/7/06, Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:> > On 7 Apr 2006, at 05:17, Magnus Damm wrote: > > >> On 4/4/06, Magnus Damm <magnus@valinux.co.jp> wrote: > >>> Fix __XEN_INTERFACE_VERSION__ old config breakage > >>> > >>> For old kernel configurations that lack CONFIG_XEN_INTERFACE_VERSION, > >>> __XEN_INTERFACE_VERSION__ will currently be defined but set to > >>> nothing. > >> > >> I''ve checked in a change to xen-compat.h which handles this case. > > > > Very good. A much cleaner solution too. Thanks! > > Does this lead to a kernel that actually works (e.g., can you sgut it > down without crashing)? I doubt it.I use a kernel config without CONFIG_XEN_INTERFACE_VERSION, and building and running dom0 on x86 (in qemu) seems ok to me. / magnus _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Apr-07 08:54 UTC
Re: [Xen-devel] Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 7 Apr 2006, at 08:48, Magnus Damm wrote:>> Does this lead to a kernel that actually works (e.g., can you sgut it >> down without crashing)? I doubt it. > > I use a kernel config without CONFIG_XEN_INTERFACE_VERSION, and > building and running dom0 on x86 (in qemu) seems ok to me.I tried ''xm save'' on such a domU and that doesn''t work. The reason is that the kernel tree expects to be calling the new sched_op hypercall, but because the interface version gets defined to zero, it actually calls the old sched_op hypercall which takes different arguments. I also tried rebooting such a domU and that doesn''t work (the guest is killed but not restarted) -- again because the old and new sched_op hypercall take their arguments in different ways. These problems are somewhat hidden I suppose, since you can boot and run happily with the domain for the most part, but it illustrates that if a guest is defining an obviously interface version we should fail the build, not build some inconsistent combination of guest kernel and hypervisor interface! -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Magnus Damm
2006-Apr-07 09:10 UTC
Re: [Xen-devel] Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 4/7/06, Keir Fraser <Keir.Fraser@cl.cam.ac.uk> wrote:> > On 7 Apr 2006, at 08:48, Magnus Damm wrote: > > >> Does this lead to a kernel that actually works (e.g., can you sgut it > >> down without crashing)? I doubt it. > > > > I use a kernel config without CONFIG_XEN_INTERFACE_VERSION, and > > building and running dom0 on x86 (in qemu) seems ok to me. > > I tried ''xm save'' on such a domU and that doesn''t work. The reason is > that the kernel tree expects to be calling the new sched_op hypercall, > but because the interface version gets defined to zero, it actually > calls the old sched_op hypercall which takes different arguments. I > also tried rebooting such a domU and that doesn''t work (the guest is > killed but not restarted) -- again because the old and new sched_op > hypercall take their arguments in different ways.Oh, I see. I did not test _that_ much. Good that you noticed.> These problems are somewhat hidden I suppose, since you can boot and > run happily with the domain for the most part, but it illustrates that > if a guest is defining an obviously interface version we should fail > the build, not build some inconsistent combination of guest kernel and > hypervisor interface!I''m afraid that I know too little about xen to say something about how multiple interface versions are supposed to work, but I think your plan of failing instead of building an inconsistent kernel sounds good. My main concern was that the code didn''t build with my old config file, and the error message produced by the c-compiler was far from user friendly. If the kernel build should fail then I would prefer some see some kind of #error message. Thanks! / magnus _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2006-Apr-07 09:34 UTC
Re: [Xen-devel] Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
On 7 Apr 2006, at 10:10, Magnus Damm wrote:> I''m afraid that I know too little about xen to say something about how > multiple interface versions are supposed to work, but I think your > plan of failing instead of building an inconsistent kernel sounds > good. > > My main concern was that the code didn''t build with my old config > file, and the error message produced by the c-compiler was far from > user friendly. If the kernel build should fail then I would prefer > some see some kind of #error message. > > Thanks!Yes, that would be nice and preferably generated from within xen-compat.h so the check is not specific to Linux. But I''m not sure whether it''s possible to detect an empty macro definition from CPP? -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel