2006-05-09 08:48:56

by Chris Wright

[permalink] [raw]
Subject: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

The XEN config option is selected from the i386 subarch menu by
choosing the X86_XEN "Xen-compatible" subarch.

The XEN_SHADOW_MODE option defines the memory virtualization mode for
the kernel -- with it enabled, the kernel expects the hypervisor to
perform translation between pseudo-physical and machine addresses on
its behalf.

The disabled config options are:
- DOUBLEFAULT: are trapped by Xen and not virtualized
- HZ: defaults to 100 in Xen VMs
- Power management: not supported in unprivileged VMs
- SMP: not supported in this set of patches
- X86_{UP,LOCAL,IO}_APIC: not supported in unprivileged VMs

Signed-off-by: Ian Pratt <[email protected]>
Signed-off-by: Christian Limpach <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
---
arch/i386/Kconfig | 18 ++++++++++++++----
arch/i386/Kconfig.debug | 1 +
drivers/xen/Kconfig | 21 +++++++++++++++++++++
kernel/Kconfig.hz | 4 ++--
kernel/Kconfig.preempt | 1 +
5 files changed, 39 insertions(+), 6 deletions(-)

--- linus-2.6.orig/arch/i386/Kconfig
+++ linus-2.6/arch/i386/Kconfig
@@ -55,6 +55,7 @@ menu "Processor type and features"

config SMP
bool "Symmetric multi-processing support"
+ depends on !X86_XEN
---help---
This enables support for systems with more than one CPU. If you have
a system with only one CPU, like most personal computers, say N. If
@@ -91,6 +92,12 @@ config X86_PC
help
Choose this option if your computer is a standard PC or compatible.

+config X86_XEN
+ bool "Xen-compatible"
+ help
+ Choose this option if you plan to run this kernel on top of the
+ Xen Hypervisor.
+
config X86_ELAN
bool "AMD Elan"
help
@@ -193,6 +200,7 @@ source "arch/i386/Kconfig.cpu"

config HPET_TIMER
bool "HPET Timer Support"
+ depends on !X86_XEN
help
This enables the use of the HPET for the kernel's internal timer.
HPET is the next generation timer replacing legacy 8254s.
@@ -244,7 +252,7 @@ source "kernel/Kconfig.preempt"

config X86_UP_APIC
bool "Local APIC support on uniprocessors"
- depends on !SMP && !(X86_VISWS || X86_VOYAGER)
+ depends on !SMP && !(X86_VISWS || X86_VOYAGER || X86_XEN)
help
A local APIC (Advanced Programmable Interrupt Controller) is an
integrated interrupt controller in the CPU. If you have a single-CPU
@@ -269,12 +277,12 @@ config X86_UP_IOAPIC

config X86_LOCAL_APIC
bool
- depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER)
+ depends on X86_UP_APIC || ((X86_VISWS || SMP) && !(X86_VOYAGER || X86_XEN))
default y

config X86_IO_APIC
bool
- depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER))
+ depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER || X86_XEN))
default y

config X86_VISWS_APIC
@@ -767,7 +775,7 @@ endmenu


menu "Power management options (ACPI, APM)"
- depends on !X86_VOYAGER
+ depends on !(X86_VOYAGER || X86_XEN)

source kernel/power/Kconfig

@@ -1089,6 +1097,8 @@ source "security/Kconfig"

source "crypto/Kconfig"

+source "drivers/xen/Kconfig"
+
source "lib/Kconfig"

#
--- linus-2.6.orig/arch/i386/Kconfig.debug
+++ linus-2.6/arch/i386/Kconfig.debug
@@ -84,6 +84,7 @@ config X86_MPPARSE
config DOUBLEFAULT
default y
bool "Enable doublefault exception handler" if EMBEDDED
+ depends on !X86_XEN
help
This option allows trapping of rare doublefault exceptions that
would otherwise cause a system to silently reboot. Disabling this
--- linus-2.6.orig/kernel/Kconfig.hz
+++ linus-2.6/kernel/Kconfig.hz
@@ -3,7 +3,7 @@
#

choice
- prompt "Timer frequency"
+ prompt "Timer frequency" if !XEN
default HZ_250
help
Allows the configuration of the timer frequency. It is customary
@@ -40,7 +40,7 @@ endchoice

config HZ
int
- default 100 if HZ_100
+ default 100 if HZ_100 || XEN
default 250 if HZ_250
default 1000 if HZ_1000

--- linus-2.6.orig/kernel/Kconfig.preempt
+++ linus-2.6/kernel/Kconfig.preempt
@@ -35,6 +35,7 @@ config PREEMPT_VOLUNTARY

config PREEMPT
bool "Preemptible Kernel (Low-Latency Desktop)"
+ depends on !XEN
help
This option reduces the latency of the kernel by making
all kernel code (that is not executing in a critical section)
--- /dev/null
+++ linus-2.6/drivers/xen/Kconfig
@@ -0,0 +1,21 @@
+#
+# This Kconfig describe xen options
+#
+
+mainmenu "Xen Configuration"
+
+config XEN
+ bool
+ default y if X86_XEN
+ help
+ This is the Linux Xen port.
+
+if XEN
+
+config XEN_SHADOW_MODE
+ bool
+ default y
+ help
+ Fakes out a shadow mode kernel
+
+endif

--


2006-05-09 10:05:46

by Adrian Bunk

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Tue, May 09, 2006 at 12:00:01AM -0700, Chris Wright wrote:
>...
> --- linus-2.6.orig/arch/i386/Kconfig
> +++ linus-2.6/arch/i386/Kconfig
>...
> config X86_IO_APIC
> bool
> - depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER))
> + depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER || X86_XEN))
> default y
>...

<nitpick>not required</nitpick>

> --- linus-2.6.orig/kernel/Kconfig.hz
> +++ linus-2.6/kernel/Kconfig.hz
> @@ -3,7 +3,7 @@
> #
>
> choice
> - prompt "Timer frequency"
> + prompt "Timer frequency" if !XEN
> default HZ_250
> help
> Allows the configuration of the timer frequency. It is customary
> @@ -40,7 +40,7 @@ endchoice
>
> config HZ
> int
> - default 100 if HZ_100
> + default 100 if HZ_100 || XEN
> default 250 if HZ_250
> default 1000 if HZ_1000
>...

Why?

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2006-05-09 11:05:22

by Ed Tomlinson

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Tuesday 09 May 2006 06:05, Adrian Bunk wrote:
> On Tue, May 09, 2006 at 12:00:01AM -0700, Chris Wright wrote:
> >...
> > --- linus-2.6.orig/arch/i386/Kconfig
> > +++ linus-2.6/arch/i386/Kconfig
> >...
> > config X86_IO_APIC
> > bool
> > - depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER))
> > + depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER || X86_XEN))
> > default y
> >...
>
> <nitpick>not required</nitpick>
>
> > --- linus-2.6.orig/kernel/Kconfig.hz
> > +++ linus-2.6/kernel/Kconfig.hz
> > @@ -3,7 +3,7 @@
> > #
> >
> > choice
> > - prompt "Timer frequency"
> > + prompt "Timer frequency" if !XEN
> > default HZ_250
> > help
> > Allows the configuration of the timer frequency. It is customary
> > @@ -40,7 +40,7 @@ endchoice
> >
> > config HZ
> > int
> > - default 100 if HZ_100
> > + default 100 if HZ_100 || XEN
> > default 250 if HZ_250
> > default 1000 if HZ_1000
> >...
>
> Why?

Guessing, but its probably to limit the number of parahypervisor calls.

Ed Tomlinson

2006-05-09 12:48:54

by Christian Limpach

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Tue, May 09, 2006 at 12:05:47PM +0200, Adrian Bunk wrote:
> On Tue, May 09, 2006 at 12:00:01AM -0700, Chris Wright wrote:
> > --- linus-2.6.orig/kernel/Kconfig.hz
> > +++ linus-2.6/kernel/Kconfig.hz
> > @@ -3,7 +3,7 @@
> > #
> >
> > choice
> > - prompt "Timer frequency"
> > + prompt "Timer frequency" if !XEN
> > default HZ_250
> > help
> > Allows the configuration of the timer frequency. It is customary
> > @@ -40,7 +40,7 @@ endchoice
> >
> > config HZ
> > int
> > - default 100 if HZ_100
> > + default 100 if HZ_100 || XEN
> > default 250 if HZ_250
> > default 1000 if HZ_1000
> >...
>
> Why?

Because the hypervisor sends timer interrupts to the guest at a rate
of 100 Hz while the guest is running. We might add support to have
an adjustable rate in the future but so far 100 Hz has worked quite
well for us.

christian

2006-05-09 14:47:16

by Daniel Walker

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Tue, 2006-05-09 at 00:00 -0700, Chris Wright wrote:
> plain text document attachment (config-xen)
> The XEN config option is selected from the i386 subarch menu by
> choosing the X86_XEN "Xen-compatible" subarch.
>
> The XEN_SHADOW_MODE option defines the memory virtualization mode for
> the kernel -- with it enabled, the kernel expects the hypervisor to
> perform translation between pseudo-physical and machine addresses on
> its behalf.
>
> The disabled config options are:
> - DOUBLEFAULT: are trapped by Xen and not virtualized
> - HZ: defaults to 100 in Xen VMs
> - Power management: not supported in unprivileged VMs
> - SMP: not supported in this set of patches
> - X86_{UP,LOCAL,IO}_APIC: not supported in unprivileged VMs
>
> Signed-off-by: Ian Pratt <[email protected]>
> Signed-off-by: Christian Limpach <[email protected]>
> Signed-off-by: Chris Wright <[email protected]>
> ---
> arch/i386/Kconfig | 18 ++++++++++++++----
> arch/i386/Kconfig.debug | 1 +
> drivers/xen/Kconfig | 21 +++++++++++++++++++++
> kernel/Kconfig.hz | 4 ++--
> kernel/Kconfig.preempt | 1 +
> 5 files changed, 39 insertions(+), 6 deletions(-)
>
> --- linus-2.6.orig/arch/i386/Kconfig
> +++ linus-2.6/arch/i386/Kconfig
> @@ -55,6 +55,7 @@ menu "Processor type and features"
>
> config SMP
> bool "Symmetric multi-processing support"
> + depends on !X86_XEN
> ---help---
> This enables support for systems with more than one CPU. If you have
> a system with only one CPU, like most personal computers, say N. If
> @@ -91,6 +92,12 @@ config X86_PC
> help
> Choose this option if your computer is a standard PC or compatible.
>
> +config X86_XEN
> + bool "Xen-compatible"
> + help
> + Choose this option if you plan to run this kernel on top of the
> + Xen Hypervisor.
> +

Couldn't you just add "depends on !SMP && .." to the config X86_XEN
block ?

Daniel

2006-05-09 15:16:58

by Christian Limpach

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Tue, May 09, 2006 at 07:47:12AM -0700, Daniel Walker wrote:
> On Tue, 2006-05-09 at 00:00 -0700, Chris Wright wrote:
> > The disabled config options are:
> > - DOUBLEFAULT: are trapped by Xen and not virtualized
> > - HZ: defaults to 100 in Xen VMs
> > - Power management: not supported in unprivileged VMs
> > - SMP: not supported in this set of patches
> > - X86_{UP,LOCAL,IO}_APIC: not supported in unprivileged VMs
> >
> > +++ linus-2.6/arch/i386/Kconfig
> > @@ -55,6 +55,7 @@ menu "Processor type and features"
> >
> > config SMP
> > bool "Symmetric multi-processing support"
> > + depends on !X86_XEN
> > ---help---
> > This enables support for systems with more than one CPU. If you have
> > a system with only one CPU, like most personal computers, say N. If
> > @@ -91,6 +92,12 @@ config X86_PC
> > help
> > Choose this option if your computer is a standard PC or compatible.
> >
> > +config X86_XEN
> > + bool "Xen-compatible"
> > + help
> > + Choose this option if you plan to run this kernel on top of the
> > + Xen Hypervisor.
> > +
>
> Couldn't you just add "depends on !SMP && .." to the config X86_XEN
> block ?

I guess you could, but it would make it rather non-obvious and tedious
to enable X86_XEN then, wouldn't it?

christian

2006-05-09 16:00:41

by Daniel Walker

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Tue, 2006-05-09 at 16:16 +0100, Christian Limpach wrote:
> > >
> > > +config X86_XEN
> > > + bool "Xen-compatible"
> > > + help
> > > + Choose this option if you plan to run this kernel on top of the
> > > + Xen Hypervisor.
> > > +
> >
> > Couldn't you just add "depends on !SMP && .." to the config X86_XEN
> > block ?
>
> I guess you could, but it would make it rather non-obvious and tedious
> to enable X86_XEN then, wouldn't it?

I guess that true .. Might be better just to support SMP then ..

Daniel

2006-05-09 16:45:23

by Andi Kleen

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Tuesday 09 May 2006 09:00, Chris Wright wrote:
> The XEN config option is selected from the i386 subarch menu by
> choosing the X86_XEN "Xen-compatible" subarch.

I really dislike all these negative option checks.

I think it would be better if you defined a positive symbol like
BARE_METAL (better name?)and define that only for the non XEN case.

-Andi

2006-05-09 23:22:36

by Chris Wright

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

* Adrian Bunk ([email protected]) wrote:
> On Tue, May 09, 2006 at 12:00:01AM -0700, Chris Wright wrote:
> >...
> > --- linus-2.6.orig/arch/i386/Kconfig
> > +++ linus-2.6/arch/i386/Kconfig
> >...
> > config X86_IO_APIC
> > bool
> > - depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER))
> > + depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER || X86_XEN))
> > default y
> >...
>
> <nitpick>not required</nitpick>

True, although SMP is just disabled in this patchset which is a subset
of full Xen support.

thanks,
-chris

2006-05-09 23:22:31

by Chris Wright

[permalink] [raw]
Subject: Re: [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

* Daniel Walker ([email protected]) wrote:
> I guess that true .. Might be better just to support SMP then ..

Yes, and of course Xen does. This is just the smallest functional set of
patches to get discussion, so the SMP bits were dropped for now.

thanks,
-chris

2006-05-10 15:25:29

by Alan

[permalink] [raw]
Subject: Re: [Xen-devel] [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Maw, 2006-05-09 at 00:00 -0700, Chris Wright wrote:
> plain text document atodiad (config-xen)
> The XEN config option is selected from the i386 subarch menu by
> choosing the X86_XEN "Xen-compatible" subarch.

You need this as well. At least if I read the logic right with regards
to Xen and traps it is safe to do the following (although probably not
safe to run Xen on such a physical system anyway)

Signed-off-by: Alan Cox <[email protected]>

--- arch/i386/Kconfig.cpu~ 2006-05-10 15:51:44.956941304 +0100
+++ arch/i386/Kconfig.cpu 2006-05-10 15:51:44.956941304 +0100
@@ -251,7 +251,7 @@

config X86_F00F_BUG
bool
- depends on M586MMX || M586TSC || M586 || M486 || M386
+ depends on ( M586MMX || M586TSC || M586 || M486 || M386 ) && !XEN
default y

config X86_WP_WORKS_OK

2006-05-10 15:48:29

by Christian Limpach

[permalink] [raw]
Subject: Re: [Xen-devel] [RFC PATCH 01/35] Add XEN config options and disable unsupported config options.

On Wed, May 10, 2006 at 04:36:58PM +0100, Alan Cox wrote:
> On Maw, 2006-05-09 at 00:00 -0700, Chris Wright wrote:
> > plain text document atodiad (config-xen)
> > The XEN config option is selected from the i386 subarch menu by
> > choosing the X86_XEN "Xen-compatible" subarch.
>
> You need this as well. At least if I read the logic right with regards
> to Xen and traps it is safe to do the following (although probably not
> safe to run Xen on such a physical system anyway)

Yes. In our tree, we have a config option which completely removes
all the hardware idt table code (X86_NO_IDT) and stores the trap
table as a table suitable to pass directly to the hypervisor.

That's not so useful if you want to build a kernel which can run
both on a hypervisor and on native. I guess you would need to
disable the X86_F00F_BUG code at runtime in such a kernel.

For the non-runtime case, I wonder if it's preferable to disable
X86_F00F_BUG like you suggest or if it would be better to disable
the cpu types listed?

christian

>
> Signed-off-by: Alan Cox <[email protected]>
>
> --- arch/i386/Kconfig.cpu~ 2006-05-10 15:51:44.956941304 +0100
> +++ arch/i386/Kconfig.cpu 2006-05-10 15:51:44.956941304 +0100
> @@ -251,7 +251,7 @@
>
> config X86_F00F_BUG
> bool
> - depends on M586MMX || M586TSC || M586 || M486 || M386
> + depends on ( M586MMX || M586TSC || M586 || M486 || M386 ) && !XEN
> default y
>
> config X86_WP_WORKS_OK
>
>