All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
@ 2006-04-04 22:45 Magnus Damm
  2006-04-06 14:11 ` Keir Fraser
  2006-04-07  0:33 ` Christian Limpach
  0 siblings, 2 replies; 9+ messages in thread
From: Magnus Damm @ 2006-04-04 22:45 UTC (permalink / raw)
  To: xen-devel; +Cc: christian.limpach, Magnus Damm

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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-04 22:45 [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage Magnus Damm
@ 2006-04-06 14:11 ` Keir Fraser
  2006-04-07  0:33 ` Christian Limpach
  1 sibling, 0 replies; 9+ messages in thread
From: Keir Fraser @ 2006-04-06 14:11 UTC (permalink / raw)
  To: Magnus Damm; +Cc: christian.limpach, xen-devel


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-04 22:45 [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage Magnus Damm
  2006-04-06 14:11 ` Keir Fraser
@ 2006-04-07  0:33 ` Christian Limpach
  2006-04-07  4:17   ` Magnus Damm
  1 sibling, 1 reply; 9+ messages in thread
From: Christian Limpach @ 2006-04-07  0:33 UTC (permalink / raw)
  To: Magnus Damm; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

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

[-- Attachment #2: 0010df11836d.txt --]
[-- Type: text/plain, Size: 1048 bytes --]

# HG changeset patch
# User cl349@firebug.cl.cam.ac.uk
# Date Thu Apr  6 23:32:54 2006
# Node ID 0010df11836d182fbb00ebcc016e9e51705470e0
# parent: b6c5920e5d998d8055a8b2f540462ace3e860d99
Support __XEN_INTERFACE_VERSION__ defined to the empty string.
This can happen when building Linux with an old .config file which
doesn't have a value for CONFIG_XEN_INTERFACE_VERSION.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>


--- a/xen/include/public/xen-compat.h	Thu Apr  6 17:58:39 2006
+++ b/xen/include/public/xen-compat.h	Thu Apr  6 23:32:54 2006
@@ -14,8 +14,11 @@
 #if defined(__XEN__)
 /* Xen is built with matching headers and implements the latest interface. */
 #define __XEN_INTERFACE_VERSION__ __XEN_LATEST_INTERFACE_VERSION__
-#elif !defined(__XEN_INTERFACE_VERSION__)
+#elif (__XEN_INTERFACE_VERSION__ - 0) == 0
 /* Guests which do not specify a version get the legacy interface. */
+#ifdef __XEN_INTERFACE_VERSION__
+#undef __XEN_INTERFACE_VERSION__
+#endif
 #define __XEN_INTERFACE_VERSION__ 0x00000000
 #endif
 


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-07  0:33 ` Christian Limpach
@ 2006-04-07  4:17   ` Magnus Damm
  2006-04-07  7:33     ` Keir Fraser
  0 siblings, 1 reply; 9+ messages in thread
From: Magnus Damm @ 2006-04-07  4:17 UTC (permalink / raw)
  To: Christian.Limpach; +Cc: Magnus Damm, xen-devel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-07  4:17   ` Magnus Damm
@ 2006-04-07  7:33     ` Keir Fraser
  2006-04-07  7:48       ` Magnus Damm
  0 siblings, 1 reply; 9+ messages in thread
From: Keir Fraser @ 2006-04-07  7:33 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Magnus Damm, xen-devel, Christian.Limpach


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-07  7:33     ` Keir Fraser
@ 2006-04-07  7:48       ` Magnus Damm
  2006-04-07  8:54         ` Keir Fraser
  0 siblings, 1 reply; 9+ messages in thread
From: Magnus Damm @ 2006-04-07  7:48 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Magnus Damm, xen-devel, Christian.Limpach

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-07  7:48       ` Magnus Damm
@ 2006-04-07  8:54         ` Keir Fraser
  2006-04-07  9:10           ` Magnus Damm
  0 siblings, 1 reply; 9+ messages in thread
From: Keir Fraser @ 2006-04-07  8:54 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Magnus Damm, xen-devel, Christian.Limpach


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-07  8:54         ` Keir Fraser
@ 2006-04-07  9:10           ` Magnus Damm
  2006-04-07  9:34             ` Keir Fraser
  0 siblings, 1 reply; 9+ messages in thread
From: Magnus Damm @ 2006-04-07  9:10 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Magnus Damm, xen-devel, Christian.Limpach

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage
  2006-04-07  9:10           ` Magnus Damm
@ 2006-04-07  9:34             ` Keir Fraser
  0 siblings, 0 replies; 9+ messages in thread
From: Keir Fraser @ 2006-04-07  9:34 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Magnus Damm, xen-devel, Christian.Limpach


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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-04-07  9:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-04 22:45 [PATCH] Fix __XEN_INTERFACE_VERSION__ old config breakage Magnus Damm
2006-04-06 14:11 ` Keir Fraser
2006-04-07  0:33 ` Christian Limpach
2006-04-07  4:17   ` Magnus Damm
2006-04-07  7:33     ` Keir Fraser
2006-04-07  7:48       ` Magnus Damm
2006-04-07  8:54         ` Keir Fraser
2006-04-07  9:10           ` Magnus Damm
2006-04-07  9:34             ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.