Hi all,
I used to run VServer in the past and recently gave Xen a try. I pretty
much like both of these technologies - each of them has some advantages
that the other one can't offer. I appreciate the real independence of
Xen domains but the memory overhead of running a kernel for each domain
and the need to partition the memory space may become a limitation. On
the other hand in VServer the contexts run on top of the same kernel and
may share the available memory which may come handy in some deployments.
So I decided to merge both patches and surprisingly enough - it works! I
don't now (yet) how stable it is but the kernel booted as domU and a
guest vserver context was created, some prcosses are running inside and
everything looks just fine.
Versions used:
* Linux kernel 2.6.11
* Xen 2.0-testing from yesterday
* VServer 2.0-rc4 (last version for 2.6.11)
Apply the attached patch on top of these.
Xen userspace is 2.0-testing as well, util-vserver 0.30.204 (debian
build), running on Debian Sarge.
My configuration was x86, statically compiled without modules, domU with
no physdev access, 3G/1G memspace split on x86, no preempt, no selinux.
What else?
This is the very first shot, I don't guarantee that it is stable,
secure, etc, but if you're brave enough give it a try ;-)
Michal Ludvig
--
* Personal homepage: http://www.logix.cz/michal
Index: linux-2.6.11/arch/xen/i386/Kconfig
===================================================================
--- linux-2.6.11.orig/arch/xen/i386/Kconfig
+++ linux-2.6.11/arch/xen/i386/Kconfig
@@ -546,6 +546,46 @@ config HIGHMEM4G
endchoice
+choice
+ prompt "Memory Split User Space"
+ default SPLIT_3GB
+ help
+ A different Userspace/Kernel split allows you to
+ utilize up to alsmost 3GB of RAM without the requirement
+ for HIGHMEM. It also increases the available lowmem.
+
+config SPLIT_3GB
+ bool "3.0GB/1.0GB Kernel (Default)"
+ help
+ This is the default split of 3GB userspace to 1GB kernel
+ space, which will result in about 860MB of lowmem.
+
+config SPLIT_25GB
+ bool "2.5GB/1.5GB Kernel"
+ help
+ This split provides 2.5GB userspace and 1.5GB kernel
+ space, which will result in about 1370MB of lowmem.
+
+config SPLIT_2GB
+ bool "2.0GB/2.0GB Kernel"
+ help
+ This split provides 2GB userspace and 2GB kernel
+ space, which will result in about 1880MB of lowmem.
+
+config SPLIT_15GB
+ bool "1.5GB/2.5GB Kernel"
+ help
+ This split provides 1.5GB userspace and 2.5GB kernel
+ space, which will result in about 2390MB of lowmem.
+
+config SPLIT_1GB
+ bool "1.0GB/3.0GB Kernel"
+ help
+ This split provides 1GB userspace and 3GB kernel
+ space, which will result in about 2900MB of lowmem.
+
+endchoice
+
config HIGHMEM
bool
depends on HIGHMEM64G || HIGHMEM4G
Index: linux-2.6.11/arch/xen/i386/kernel/entry.S
===================================================================
--- linux-2.6.11.orig/arch/xen/i386/kernel/entry.S
+++ linux-2.6.11/arch/xen/i386/kernel/entry.S
@@ -1011,7 +1011,7 @@ ENTRY(sys_call_table)
.long sys_tgkill /* 270 */
.long sys_utimes
.long sys_fadvise64_64
- .long sys_ni_syscall /* sys_vserver */
+ .long sys_vserver
.long sys_mbind
.long sys_get_mempolicy
.long sys_set_mempolicy
Index: linux-2.6.11/arch/xen/i386/kernel/traps.c
===================================================================
--- linux-2.6.11.orig/arch/xen/i386/kernel/traps.c
+++ linux-2.6.11/arch/xen/i386/kernel/traps.c
@@ -53,6 +53,7 @@
#include <linux/irq.h>
#include <linux/module.h>
+#include <linux/vserver/debug.h>
#include "mach_traps.h"
@@ -303,6 +304,7 @@ void die(const char * str, struct pt_reg
};
static int die_counter;
+ vxh_throw_oops();
if (die.lock_owner != _smp_processor_id()) {
console_verbose();
spin_lock_irq(&die.lock);
@@ -337,6 +339,7 @@ void die(const char * str, struct pt_reg
bust_spinlocks(0);
die.lock_owner = -1;
spin_unlock_irq(&die.lock);
+ vxh_dump_history();
if (in_interrupt())
panic("Fatal exception in interrupt");
Index: linux-2.6.11/include/asm-xen/asm-i386/page.h
===================================================================
--- linux-2.6.11.orig/include/asm-xen/asm-i386/page.h
+++ linux-2.6.11/include/asm-xen/asm-i386/page.h
@@ -167,16 +167,24 @@ extern int sysctl_legacy_va_layout;
#endif /* __ASSEMBLY__ */
-#ifdef __ASSEMBLY__
+#if defined(CONFIG_SPLIT_3GB)
#define __PAGE_OFFSET (0xC0000000)
-#else
-#define __PAGE_OFFSET (0xC0000000UL)
+#elif defined(CONFIG_SPLIT_25GB)
+#define __PAGE_OFFSET (0xA0000000)
+#elif defined(CONFIG_SPLIT_2GB)
+#define __PAGE_OFFSET (0x80000000)
+#elif defined(CONFIG_SPLIT_15GB)
+#define __PAGE_OFFSET (0x60000000)
+#elif defined(CONFIG_SPLIT_1GB)
+#define __PAGE_OFFSET (0x40000000)
#endif
#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
-#define MAXMEM
(HYPERVISOR_VIRT_START-__PAGE_OFFSET-__VMALLOC_RESERVE)
+#define __MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
+#define MAXMEM ((unsigned long)(-PAGE_OFFSET-VMALLOC_RESERVE))
+
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
#define __va(x) ((void *)((unsigned
long)(x)+PAGE_OFFSET))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
Index: linux-2.6.11/include/asm-xen/asm-i386/processor.h
===================================================================
--- linux-2.6.11.orig/include/asm-xen/asm-i386/processor.h
+++ linux-2.6.11/include/asm-xen/asm-i386/processor.h
@@ -308,9 +308,10 @@ extern unsigned int mca_pentium_flag;
extern int bootloader_type;
/*
- * User space process size: 3GB (default).
+ * User space process size: (3GB default).
*/
-#define TASK_SIZE (PAGE_OFFSET)
+#define __TASK_SIZE (__PAGE_OFFSET)
+#define TASK_SIZE ((unsigned long)__TASK_SIZE)
/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
|