2008-02-01 12:45:52

by Ingo Molnar

[permalink] [raw]
Subject: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'


i have just added lguest to the x86 automated testing infrastructure
back again, and promptly a build failure popped up:

drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference
to `LGUEST_PAGES_regs_trapnum'

(config attached)

i sent the patch below two weeks ago to fix a similar build bug but it's
not upstream yet AFAICS. It resolves this particular build failure as
well.

Ingo

-------------------->
Subject: x86: lguest fix
From: Ingo Molnar <[email protected]>

this commit:

commit 84f7466ee20cc094aa38617abfa2f3834871f054
Author: Rusty Russell <[email protected]>
Date: Sat Jan 19 07:02:29 2008 +1100

Selecting LGUEST should turn on Guest support, as in 2.6.23.

caused build failures due to allowing LGUEST to be selected without
paravirt support.

Signed-off-by: Ingo Molnar <[email protected]>
---
drivers/lguest/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/lguest/Kconfig
===================================================================
--- linux.orig/drivers/lguest/Kconfig
+++ linux/drivers/lguest/Kconfig
@@ -1,6 +1,6 @@
config LGUEST
tristate "Linux hypervisor example code"
- depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX && !(X86_VISWS || X86_VOYAGER)
+ depends on X86_32 && EXPERIMENTAL && PARAVIRT_GUEST && !X86_PAE && FUTEX && !(X86_VISWS || X86_VOYAGER)
select HVC_DRIVER
---help---
This is a very simple module which allows you to run


Attachments:
(No filename) (1.43 kB)
config (44.38 kB)
Download all attachments

2008-02-01 17:06:23

by Ingo Molnar

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'


* Ingo Molnar <[email protected]> wrote:

> i have just added lguest to the x86 automated testing infrastructure
> back again, and promptly a build failure popped up:
>
> drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference
> to `LGUEST_PAGES_regs_trapnum'
>
> (config attached)
>
> i sent the patch below two weeks ago to fix a similar build bug but
> it's not upstream yet AFAICS. It resolves this particular build
> failure as well.

hm, another build failure for sale: lguest fails with another config too
(attached):

drivers/lguest/x86/switcher_32.S:(.text+0x284e6f): undefined reference
to `LGUEST_PAGES_host_sp'

looks similar to the previous one so i guess my quick fix attempt was a
bit too quick. Will turn lguest off again. And i'm willing to test
patches as well :)

Ingo


Attachments:
(No filename) (818.00 B)
config (47.23 kB)
Download all attachments

2008-02-02 12:25:22

by Rusty Russell

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

On Saturday 02 February 2008 04:05:51 Ingo Molnar wrote:
> looks similar to the previous one so i guess my quick fix attempt was a
> bit too quick. Will turn lguest off again. And i'm willing to test
> patches as well :)

Yes, sorry, I've been completely busy at linux.conf.au.

Will test and fix.

Thanks for the feedback,
Rusty.

2008-02-03 20:12:11

by Rusty Russell

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

On Saturday 02 February 2008 04:05:51 Ingo Molnar wrote:
> looks similar to the previous one so i guess my quick fix attempt was a
> bit too quick. Will turn lguest off again. And i'm willing to test
> patches as well :)

Hi Ingo,

OK, this problem was caused by asm-offsets.c only having the offsets when
lguest *guest* support was set, not lguest host (host support used to imply
guest support, so now they're separate these bugs come out).

Can you throw this patch into your tree for testing?

Thanks,
Rusty.

Lguest guest support and host support are separate config options: they used
to be tied together. Sort out which parts of asm-offsets are needed for Guest
and Host.

Signed-off-by: Rusty Russell <[email protected]>

diff -r 7d5a5c7a4b95 arch/x86/kernel/asm-offsets_32.c
--- a/arch/x86/kernel/asm-offsets_32.c Sat Feb 02 23:13:05 2008 +1100
+++ b/arch/x86/kernel/asm-offsets_32.c Sun Feb 03 10:13:19 2008 +1100
@@ -20,10 +20,8 @@

#include <xen/interface/xen.h>

-#ifdef CONFIG_LGUEST_GUEST
#include <linux/lguest.h>
#include "../../../drivers/lguest/lg.h"
-#endif

#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -134,6 +132,10 @@ void foo(void)
BLANK();
OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
+#endif
+
+#ifdef CONFIG_LGUEST
+ BLANK();
OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);

2008-02-17 13:52:03

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

On Mon, 4 Feb 2008, Rusty Russell wrote:

> On Saturday 02 February 2008 04:05:51 Ingo Molnar wrote:
> > looks similar to the previous one so i guess my quick fix attempt was a
> > bit too quick. Will turn lguest off again. And i'm willing to test
> > patches as well :)
>
> Hi Ingo,
>
> OK, this problem was caused by asm-offsets.c only having the offsets when
> lguest *guest* support was set, not lguest host (host support used to imply
> guest support, so now they're separate these bugs come out).
>
> Can you throw this patch into your tree for testing?
>
> Thanks,
> Rusty.

Applied. Thanks,

tglx

> Lguest guest support and host support are separate config options: they used
> to be tied together. Sort out which parts of asm-offsets are needed for Guest
> and Host.
>
> Signed-off-by: Rusty Russell <[email protected]>
>
> diff -r 7d5a5c7a4b95 arch/x86/kernel/asm-offsets_32.c
> --- a/arch/x86/kernel/asm-offsets_32.c Sat Feb 02 23:13:05 2008 +1100
> +++ b/arch/x86/kernel/asm-offsets_32.c Sun Feb 03 10:13:19 2008 +1100
> @@ -20,10 +20,8 @@
>
> #include <xen/interface/xen.h>
>
> -#ifdef CONFIG_LGUEST_GUEST
> #include <linux/lguest.h>
> #include "../../../drivers/lguest/lg.h"
> -#endif
>
> #define DEFINE(sym, val) \
> asm volatile("\n->" #sym " %0 " #val : : "i" (val))
> @@ -134,6 +132,10 @@ void foo(void)
> BLANK();
> OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
> OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
> +#endif
> +
> +#ifdef CONFIG_LGUEST
> + BLANK();
> OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
> OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
> OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
>

2008-02-17 14:06:18

by Sergio Luis

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

Thomas Gleixner wrote:
> On Mon, 4 Feb 2008, Rusty Russell wrote:
>
>> On Saturday 02 February 2008 04:05:51 Ingo Molnar wrote:
>>> looks similar to the previous one so i guess my quick fix attempt was a
>>> bit too quick. Will turn lguest off again. And i'm willing to test
>>> patches as well :)
>> Hi Ingo,
>>
>> OK, this problem was caused by asm-offsets.c only having the offsets when
>> lguest *guest* support was set, not lguest host (host support used to imply
>> guest support, so now they're separate these bugs come out).
>>
>> Can you throw this patch into your tree for testing?
>>
>> Thanks,
>> Rusty.
>
> Applied. Thanks,
>
> tglx
>

It doesn't fix the problem totally. If we select
Virtualization->Linux hypervisor example code (CONFIG_LGUEST)
as a module, we will get the same build errors, since the related
offsets won't be generated in include/asm-x86/asm-offset.h
>From arch/x86/kernel/asm_offsets_32.c
[...]
#ifdef CONFIG_LGUEST
BLANK();
OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
OFFSET(LGUEST_PAGES_host_sp, lguest_pages, state.host_sp);
OFFSET(LGUEST_PAGES_guest_gdt_desc, lguest_pages,state.guest_gdt_desc);
OFFSET(LGUEST_PAGES_guest_idt_desc, lguest_pages,state.guest_idt_desc);
OFFSET(LGUEST_PAGES_guest_gdt, lguest_pages, state.guest_gdt);
OFFSET(LGUEST_PAGES_regs_trapnum, lguest_pages, regs.trapnum);
OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
#endif
[...]

-sergio

>> Lguest guest support and host support are separate config options: they used
>> to be tied together. Sort out which parts of asm-offsets are needed for Guest
>> and Host.
>>
>> Signed-off-by: Rusty Russell <[email protected]>
>>
>> diff -r 7d5a5c7a4b95 arch/x86/kernel/asm-offsets_32.c
>> --- a/arch/x86/kernel/asm-offsets_32.c Sat Feb 02 23:13:05 2008 +1100
>> +++ b/arch/x86/kernel/asm-offsets_32.c Sun Feb 03 10:13:19 2008 +1100
>> @@ -20,10 +20,8 @@
>>
>> #include <xen/interface/xen.h>
>>
>> -#ifdef CONFIG_LGUEST_GUEST
>> #include <linux/lguest.h>
>> #include "../../../drivers/lguest/lg.h"
>> -#endif
>>
>> #define DEFINE(sym, val) \
>> asm volatile("\n->" #sym " %0 " #val : : "i" (val))
>> @@ -134,6 +132,10 @@ void foo(void)
>> BLANK();
>> OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
>> OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
>> +#endif
>> +
>> +#ifdef CONFIG_LGUEST
>> + BLANK();
>> OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
>> OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
>> OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2008-02-17 20:13:05

by Christian Kujau

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

On Sun, 17 Feb 2008, Sergio Luis wrote:
> It doesn't fix the problem totally. If we select
> Virtualization->Linux hypervisor example code (CONFIG_LGUEST)
> as a module, we will get the same build errors,

Confirmed, the build errors persist with CONFIG_LGUEST=m and Rusty's patch
applied.

thanks,
Christian.
--
BOFH excuse #283:

Lawn mower blade in your fan need sharpening

2008-02-18 01:03:24

by Sergio Luis

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

Christian Kujau wrote:
> On Sun, 17 Feb 2008, Sergio Luis wrote:
>> It doesn't fix the problem totally. If we select
>> Virtualization->Linux hypervisor example code (CONFIG_LGUEST)
>> as a module, we will get the same build errors,
>
> Confirmed, the build errors persist with CONFIG_LGUEST=m and Rusty's
> patch applied.
>
> thanks,
> Christian.

This will make sure CONFIG_LGUEST is set when building the linux hypervisor example code as both module and built-in,
so that the LGUEST_* offsets will be generated for both cases in asm-offset.h.
I am sure you guys will have a better way to fix this, but anyway...
-sergio

--- linux-2.6.25-rc2.orig/drivers/lguest/Kconfig 2008-02-16 23:21:29.000000000 -0300
+++ linux-2.6.25-rc2/drivers/lguest/Kconfig 2008-02-17 21:44:57.000000000 -0300
@@ -1,7 +1,17 @@
config LGUEST
- tristate "Linux hypervisor example code"
+ bool "Linux hypervisor"
depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX && !(X86_VISWS || X86_VOYAGER)
+ default y
+ ---help---
+ This allows you to select the linux hypervisor example code.
+
+if LGUEST
+
+config LGUEST_HYPERVISOR
+ tristate "Linux hypervisor example code"
+ depends on LGUEST
select HVC_DRIVER
+ default m
---help---
This is a very simple module which allows you to run
multiple instances of the same Linux kernel, using the
@@ -10,3 +20,5 @@
not "rustyvisor". See Documentation/lguest/lguest.txt.

If unsure, say N. If curious, say M. If masochistic, say Y.
+
+endif # LGUEST

2008-02-18 01:30:06

by Sergio Luis

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

Sergio Luis wrote:
> Christian Kujau wrote:
>> On Sun, 17 Feb 2008, Sergio Luis wrote:
>>> It doesn't fix the problem totally. If we select
>>> Virtualization->Linux hypervisor example code (CONFIG_LGUEST)
>>> as a module, we will get the same build errors,
>> Confirmed, the build errors persist with CONFIG_LGUEST=m and Rusty's
>> patch applied.
>>
>> thanks,
>> Christian.
>
> This will make sure CONFIG_LGUEST is set when building the linux hypervisor example code as both module and built-in,
> so that the LGUEST_* offsets will be generated for both cases in asm-offset.h.
> I am sure you guys will have a better way to fix this, but anyway...
> -sergio
>
> --- linux-2.6.25-rc2.orig/drivers/lguest/Kconfig 2008-02-16 23:21:29.000000000 -0300
> +++ linux-2.6.25-rc2/drivers/lguest/Kconfig 2008-02-17 21:44:57.000000000 -0300
> @@ -1,7 +1,17 @@
> config LGUEST
> - tristate "Linux hypervisor example code"
> + bool "Linux hypervisor"
> depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX && !(X86_VISWS || X86_VOYAGER)
> + default y
> + ---help---
> + This allows you to select the linux hypervisor example code.
> +
> +if LGUEST
> +
> +config LGUEST_HYPERVISOR
> + tristate "Linux hypervisor example code"
> + depends on LGUEST
> select HVC_DRIVER
> + default m
> ---help---
> This is a very simple module which allows you to run
> multiple instances of the same Linux kernel, using the
> @@ -10,3 +20,5 @@
> not "rustyvisor". See Documentation/lguest/lguest.txt.
>
> If unsure, say N. If curious, say M. If masochistic, say Y.
> +
> +endif # LGUEST
>
oops. sorry, I just realized I missed the makefile part. I changed the config symbol to CONFIG_LGUEST_HYPERVISOR so I should change it on the makefile as well.
reposting an updated patch for testing:
-sergio


lguest: makes sure CONFIG_LGUEST is defined when building it as a module and built-in into the kernel.

This will make sure CONFIG_LGUEST is set when building the linux hypervisor example code as both module and built-in,
so that the LGUEST_* offsets will be generated for both cases in asm-offset.h.

Signed-off-by: Sergio Luis <[email protected]>


Kconfig | 14 +++++++++++++-
Makefile | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)


diff -urN linux-2.6.25-rc2.orig/drivers/lguest/Kconfig linux-2.6.25-rc2/drivers/lguest/Kconfig
--- linux-2.6.25-rc2.orig/drivers/lguest/Kconfig 2008-02-16 23:21:29.000000000 -0300
+++ linux-2.6.25-rc2/drivers/lguest/Kconfig 2008-02-17 21:44:57.000000000 -0300
@@ -1,7 +1,17 @@
config LGUEST
- tristate "Linux hypervisor example code"
+ bool "Linux hypervisor"
depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX && !(X86_VISWS || X86_VOYAGER)
+ default y
+ ---help---
+ This allows you to select the linux hypervisor example code.
+
+if LGUEST
+
+config LGUEST_HYPERVISOR
+ tristate "Linux hypervisor example code"
+ depends on LGUEST
select HVC_DRIVER
+ default m
---help---
This is a very simple module which allows you to run
multiple instances of the same Linux kernel, using the
@@ -10,3 +20,5 @@
not "rustyvisor". See Documentation/lguest/lguest.txt.

If unsure, say N. If curious, say M. If masochistic, say Y.
+
+endif # LGUEST
diff -urN linux-2.6.25-rc2.orig/drivers/lguest/Makefile linux-2.6.25-rc2/drivers/lguest/Makefile
--- linux-2.6.25-rc2.orig/drivers/lguest/Makefile 2008-02-16 23:21:29.000000000 -0300
+++ linux-2.6.25-rc2/drivers/lguest/Makefile 2008-02-17 22:21:53.000000000 -0300
@@ -2,7 +2,7 @@
obj-$(CONFIG_LGUEST_GUEST) += lguest_device.o

# Host requires the other files, which can be a module.
-obj-$(CONFIG_LGUEST) += lg.o
+obj-$(CONFIG_LGUEST_HYPERVISOR) += lg.o
lg-y = core.o hypercalls.o page_tables.o interrupts_and_traps.o \
segments.o lguest_user.o



2008-02-18 22:14:36

by Christian Kujau

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

On Sun, 17 Feb 2008, Sergio Luis wrote:
> oops. sorry, I just realized I missed the makefile part. I changed
> the config symbol to CONFIG_LGUEST_HYPERVISOR so I should change it on
> the makefile as well. reposting an updated patch for testing:

Hm, now I cannot select LGUEST as a module any more:

$ make clean && time make
[...]
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf -s arch/x86/Kconfig
.config:1793:warning: symbol value 'm' invalid for LGUEST
[...]
Linux hypervisor (LGUEST) [Y/n/?] (NEW)

Is this intentional? I've tried your patch with or without Rusty's patch,
both gave me the same results. My .config:
http://nerdbynature.de/bits/2.6.25-rc2/lguest/

Thanks,
Christian.
--
BOFH excuse #400:

We are Microsoft. What you are experiencing is not a problem; it is an undocumented feature.

2008-02-18 22:22:27

by Sergio Luis

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

Christian Kujau wrote:
> On Sun, 17 Feb 2008, Sergio Luis wrote:
>> oops. sorry, I just realized I missed the makefile part. I changed
>> the config symbol to CONFIG_LGUEST_HYPERVISOR so I should change it on
>> the makefile as well. reposting an updated patch for testing:
>
> Hm, now I cannot select LGUEST as a module any more:
>
> $ make clean && time make
> [...]
> HOSTCC scripts/kconfig/zconf.tab.o
> HOSTLD scripts/kconfig/conf
> scripts/kconfig/conf -s arch/x86/Kconfig
> .config:1793:warning: symbol value 'm' invalid for LGUEST
> [...]
> Linux hypervisor (LGUEST) [Y/n/?] (NEW)

if you select Y here it will prompt you about the lguest hypervisor, the code in question, the one you want to build, and you will then be able to select it as a module, if you want, or built-in into the kernel.
I dont like this approach myself, but it does fix the problem. I was hoping people would come up with better ideas on how to properly fix it.
-sergio

>
> Is this intentional? I've tried your patch with or without Rusty's
> patch, both gave me the same results. My .config:
> http://nerdbynature.de/bits/2.6.25-rc2/lguest/
>
> Thanks,
> Christian.

2008-02-19 03:46:52

by Tony Breeds

[permalink] [raw]
Subject: [PATCH] Fix building lguest as module.

On Mon, Feb 04, 2008 at 07:11:10AM +1100, Rusty Russell wrote:

> Lguest guest support and host support are separate config options: they used
> to be tied together. Sort out which parts of asm-offsets are needed for Guest
> and Host.

<snip> With rusty's patch applied the errors still persist in some
configs. Please try the patch below.

Fixes the following errors from modpost when the lguest (host) support is
modular.

ERROR: "LGUEST_PAGES_guest_gdt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_gdt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_cr3" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_regs" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_idt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_guest_gdt" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_sp" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_regs_trapnum" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_guest_idt_desc" [drivers/lguest/lg.ko] undefined!

Lguest guest support and host support are separate config options: they used
to be tied together. Sort out which parts of asm-offsets are needed for Guest
and Host.

Signed-off-by: Tony Breeds <[email protected]>
---

Original patch from rusty (http://lkml.org/lkml/2008/2/3/168) didn't completely
fix the problem. I think this matches the original intent.

Not sure of the right way to attribute this patch, clearlyt it's mostly
Rusty's work.

arch/x86/kernel/asm-offsets_32.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index afd8446..ae9d289 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -20,10 +20,8 @@

#include <xen/interface/xen.h>

-#ifdef CONFIG_LGUEST_GUEST
#include <linux/lguest.h>
#include "../../../drivers/lguest/lg.h"
-#endif

#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -134,6 +132,10 @@ void foo(void)
BLANK();
OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);
+#endif
+
+#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_MODULE)
+ BLANK();
OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc);
OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc);
OFFSET(LGUEST_PAGES_host_cr3, lguest_pages, state.host_cr3);
--
1.5.4.1




Yours Tony

linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

2008-02-19 07:32:57

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] Fix building lguest as module.


* Tony Breeds <[email protected]> wrote:

> +#endif
> +
> +#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_MODULE)
> + BLANK();

hm. Rusty's original fix is now upstream. I've done a delta to your
patch, find the fix is below.

Ingo

----------------->
Subject: lguest: fix build breakage
From: Tony Breeds <[email protected]>
Date: Tue Feb 19 08:16:03 CET 2008

[ [email protected]: merged to Rusty's patch ]

Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/asm-offsets_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-x86.q/arch/x86/kernel/asm-offsets_32.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/asm-offsets_32.c
+++ linux-x86.q/arch/x86/kernel/asm-offsets_32.c
@@ -128,7 +128,7 @@ void foo(void)
OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
#endif

-#ifdef CONFIG_LGUEST_GUEST
+#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_MODULE)
BLANK();
OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);

2008-02-19 13:54:39

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] Fix building lguest as module.


* Ingo Molnar <[email protected]> wrote:

> > +#endif
> > +
> > +#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_MODULE)
> > + BLANK();
>
> hm. Rusty's original fix is now upstream. I've done a delta to your
> patch, find the fix is below.

the right one is below. There's no 'LGUEST_MODULE' anymore -
'LGUEST_GUEST' is what should be used.

Ingo

------------------->
Subject: lguest: fix build breakage
From: Tony Breeds <[email protected]>
Date: Tue Feb 19 08:16:03 CET 2008

[ [email protected]: merged to Rusty's patch ]

Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
---
arch/x86/kernel/asm-offsets_32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-x86.q/arch/x86/kernel/asm-offsets_32.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/asm-offsets_32.c
+++ linux-x86.q/arch/x86/kernel/asm-offsets_32.c
@@ -128,7 +128,7 @@ void foo(void)
OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
#endif

-#ifdef CONFIG_LGUEST_GUEST
+#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST)
BLANK();
OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled);
OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir);

2008-02-19 21:21:17

by Christian Kujau

[permalink] [raw]
Subject: Re: [build bug] lguest build failure: drivers/lguest/x86/switcher_32.S:(.text+0x3815f8): undefined reference to `LGUEST_PAGES_regs_trapnum'

On Mon, 18 Feb 2008, Sergio Luis wrote:
> if you select Y here it will prompt you about the lguest
> hypervisor, the code in question, the one you want to build, and you
> will then be able to select it as a module, if you want, or built-in
> into the kernel.

Ah, thanks for the clarification. And yes, after applying your patch,
compiling succeeds.

C.
--
BOFH excuse #412:

Radial Telemetry Infiltration

2008-02-19 23:38:18

by Tony Breeds

[permalink] [raw]
Subject: Re: [PATCH] Fix building lguest as module.

On Tue, Feb 19, 2008 at 02:54:01PM +0100, Ingo Molnar wrote:
>
> * Ingo Molnar <[email protected]> wrote:
>
> > > +#endif
> > > +
> > > +#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_MODULE)
> > > + BLANK();
> >
> > hm. Rusty's original fix is now upstream. I've done a delta to your
> > patch, find the fix is below.

Thanks!.
>
> the right one is below. There's no 'LGUEST_MODULE' anymore -
> 'LGUEST_GUEST' is what should be used.

Hmm okay I'm confused now. LGUEST_GUEST is only set when you have guest
support enabled, but if you're only building the host module[1] then that wont
work.

Appologies if I've missed soemthing.

-=-=-=-=-=-=-=-=-=-=-=-
tony@thor:~/projects/kernel/working$ git describe
v2.6.25-rc2-103-gf702c58
tony@thor:~/projects/kernel/working$ egrep LGUEST /scratch/tmp/include/linux/autoconf.h
#define CONFIG_LGUEST_MODULE 1
tony@thor:~/projects/kernel/working$ egrep 'defined.*CONFIG_LGUEST' arch/x86/kernel/asm-offsets_32.c
#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST)
tony@thor:~/projects/kernel/working$ make O=/scratch/tmp -s
GEN /scratch/tmp/Makefile
Using /home/tony/projects/kernel/working as source for kernel
WARNING: modpost: Found 33 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
UPD include/linux/compile.h
Building modules, stage 2.
ERROR: "LGUEST_PAGES_guest_gdt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_gdt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_cr3" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_regs" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_idt_desc" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_guest_gdt" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_host_sp" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_regs_trapnum" [drivers/lguest/lg.ko] undefined!
ERROR: "LGUEST_PAGES_guest_idt_desc" [drivers/lguest/lg.ko] undefined!
make[2]: *** [__modpost] Error 1
make[1]: *** [modules] Error 2
make[1]: *** Waiting for unfinished jobs....
Root device is (3, 3)
Setup is 11320 bytes (padded to 11776 bytes).
System is 2663 kB
Kernel: arch/x86/boot/bzImage is ready (#17)
make: *** [sub-make] Error 2
-=-=-=-=-=-=-=-=-=-=-=-
tony@thor:~/projects/kernel/working$ egrep LGUEST /scratch/tmp/include/linux/autoconf.h
#define CONFIG_LGUEST_MODULE 1
tony@thor:~/projects/kernel/working$ egrep 'defined.*CONFIG_LGUEST' arch/x86/kernel/asm-offsets_32.c
#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_MODULE)
tony@thor:~/projects/kernel/working$ make O=/scratch/tmp -s
GEN /scratch/tmp/Makefile
Using /home/tony/projects/kernel/working as source for kernel
WARNING: modpost: Found 33 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
UPD include/linux/compile.h
Building modules, stage 2.
Root device is (3, 3)
Setup is 11320 bytes (padded to 11776 bytes).
System is 2663 kB
Kernel: arch/x86/boot/bzImage is ready (#18)

I've attached the .config FWIW

[1] Somewhat strange I agree but valid none the less.

Yours Tony

linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!


Attachments:
(No filename) (3.20 kB)
config-lguest (38.55 kB)
Download all attachments

2008-02-20 09:33:51

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] Fix building lguest as module.


* Tony Breeds <[email protected]> wrote:

> > the right one is below. There's no 'LGUEST_MODULE' anymore -
> > 'LGUEST_GUEST' is what should be used.
>
> Hmm okay I'm confused now. LGUEST_GUEST is only set when you have
> guest support enabled, but if you're only building the host module[1]
> then that wont work.

i have no strong idea either - but no more lguest build failures anymore
in my test setup since i applied your patch with my small tweak. Rusty
has pushed his ... lightly tested git tree upstream and went on a
vacation. I'm strongly considering this new merge technique for the next
merge window myself! ;-)

Ingo

2008-02-20 10:02:18

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] Fix building lguest as module.


* Tony Breeds <[email protected]> wrote:

> I've attached the .config FWIW

indeed you are right...

I fixed this build failure too - could you check whether x86.git#test
(which has all these lguest build fixes) works fine for you:

http://people.redhat.com/mingo/x86.git/README

? Thanks,

Ingo

2008-02-22 06:00:57

by Tony Breeds

[permalink] [raw]
Subject: Re: [PATCH] Fix building lguest as module.

On Wed, Feb 20, 2008 at 11:01:40AM +0100, Ingo Molnar wrote:
>
> * Tony Breeds <[email protected]> wrote:
>
> > I've attached the .config FWIW
>
> indeed you are right...
>
> I fixed this build failure too - could you check whether x86.git#test
> (which has all these lguest build fixes) works fine for you:
>
> http://people.redhat.com/mingo/x86.git/README
>
> ? Thanks,

Sure that works. I'm not conviniced that your patch is right as it
treats gust and host support as the same thing. Having said that we're
only talkign about a few constants, so I don't think it's worth anymore
time. If it's not right it can be fixed later by those that know
better.

Yours Tony

linux.conf.au http://www.marchsouth.org/
Jan 19 - 24 2009 The Australian Linux Technical Conference!