WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][IA64] configure VHPT size per HVM domain

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxx>
Subject: [Xen-devel] [PATCH][IA64] configure VHPT size per HVM domain
From: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
Date: Tue, 16 Oct 2007 15:21:39 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 15 Oct 2007 23:22:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Keir and Alex,

A Virtual Hash Page Table(VHPT) is a special feature of IA64.
It's an extension of TLB that resides in memory and can be 
automatically searched by the processor.

This patch allows user to configure VHPT size per HVM domain.

We have an interesting result.
We tried some large transaction benchmark,
for VHPT size in 512K, 2M, 4M, 8M:
 - Linux is getting a better score (totally 20% up)
 - Windows is getting a worse score (totally 10% down)

The reason of windows degradation is, windows OS flushes 
TLB more frequently. Xen hypervisor must clear the memory of VHPT
with TLB flushing, that becomes an overhead.

This patch is significant for IA64 to support both linux guest
and windows guest simultaneously.

Thanks,
Kouya

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r 2863852e02f6 tools/examples/xmexample.vti
--- a/tools/examples/xmexample.vti      Mon Oct 15 11:41:28 2007 -0600
+++ b/tools/examples/xmexample.vti      Tue Oct 16 11:31:53 2007 +0900
@@ -34,6 +34,10 @@ name = "ExampleVTIDomain"
 #cpus = ""         # leave to Xen to pick
 #cpus = "0"        # all vcpus run on CPU0
 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5
+
+# VHPT size(2**n), default=23 (8MB), minimum=15 (32KB).
+# In Windows OS, smaller size shows better performance.
+#vhpt = 23
 
 # Optionally define mac and/or bridge for the network interfaces.
 # Random MACs are assigned if not given.
diff -r 2863852e02f6 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Mon Oct 15 11:41:28 2007 -0600
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Oct 16 10:03:46 2007 +0900
@@ -538,15 +538,20 @@ static PyObject *pyxc_hvm_build(XcObject
 #endif
     char *image;
     int store_evtchn, memsize, vcpus = 1, pae = 0, acpi = 0, apic = 1;
+    int vhpt = 0;
     unsigned long store_mfn;
 
     static char *kwd_list[] = { "domid", "store_evtchn",
                                "memsize", "image", "vcpus", "pae", "acpi",
-                               "apic", NULL };
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|iiii", kwd_list,
-                                      &dom, &store_evtchn, &memsize,
-                                      &image, &vcpus, &pae, &acpi, &apic) )
-        return NULL;
+                               "apic", "vhpt", NULL };
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|iiiii", kwd_list,
+                                      &dom, &store_evtchn, &memsize, &image,
+                                      &vcpus, &pae, &acpi, &apic, &vhpt) )
+        return NULL;
+
+#ifdef __ia64__
+    xc_set_hvm_param(self->xc_handle, dom, HVM_PARAM_VHPT_SIZE, vhpt);
+#endif
 
     if ( xc_hvm_build(self->xc_handle, dom, memsize, image) != 0 )
         return pyxc_error_to_exception();
diff -r 2863852e02f6 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Mon Oct 15 11:41:28 2007 -0600
+++ b/tools/python/xen/xend/XendConfig.py       Tue Oct 16 10:21:25 2007 +0900
@@ -127,7 +127,7 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 
                         'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl',
                         'soundhw','stdvga', 'usb', 'usbdevice', 'vnc',
                         'vncconsole', 'vncdisplay', 'vnclisten',
-                        'vncpasswd', 'vncunused', 'xauthority', 'pci']
+                        'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt']
 
 # Xen API console 'other_config' keys.
 XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten',
diff -r 2863852e02f6 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Mon Oct 15 11:41:28 2007 -0600
+++ b/tools/python/xen/xend/image.py    Tue Oct 16 10:03:46 2007 +0900
@@ -277,6 +277,7 @@ class HVMImageHandler(ImageHandler):
         self.pae  = int(vmConfig['platform'].get('pae',  0))
         self.apic = int(vmConfig['platform'].get('apic', 0))
         self.acpi = int(vmConfig['platform'].get('acpi', 0))
+        self.vhpt = int(vmConfig['platform'].get('vhpt', 0))
         
 
     def buildDomain(self):
@@ -292,6 +293,7 @@ class HVMImageHandler(ImageHandler):
         log.debug("pae            = %d", self.pae)
         log.debug("acpi           = %d", self.acpi)
         log.debug("apic           = %d", self.apic)
+        log.debug("vhpt           = %d", self.vhpt)
 
         rc = xc.hvm_build(domid          = self.vm.getDomid(),
                           image          = self.kernel,
@@ -300,7 +302,8 @@ class HVMImageHandler(ImageHandler):
                           vcpus          = self.vm.getVCpuCount(),
                           pae            = self.pae,
                           acpi           = self.acpi,
-                          apic           = self.apic)
+                          apic           = self.apic,
+                          vhpt           = self.vhpt)
         rc['notes'] = { 'SUSPEND_CANCEL': 1 }
         return rc
 
diff -r 2863852e02f6 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Mon Oct 15 11:41:28 2007 -0600
+++ b/tools/python/xen/xm/create.py     Tue Oct 16 11:22:10 2007 +0900
@@ -209,6 +209,10 @@ gopts.var('vcpu_avail', val='VCPUS',
 gopts.var('vcpu_avail', val='VCPUS',
           fn=set_long, default=None,
           use="Bitmask for virtual CPUs to make available immediately.")
+
+gopts.var('vhpt', val='VHPT',
+          fn=set_int, default=0,
+          use="VHPT Size(2**n) of IA64 HVM domain.")
 
 gopts.var('cpu_cap', val='CAP',
           fn=set_int, default=None,
@@ -721,7 +725,7 @@ def configure_hvm(config_image, vals):
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
              'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
              'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
-             'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci' ]
+             'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'vhpt' ]
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
             config_image.append([a, vals.__dict__[a]])
diff -r 2863852e02f6 xen/arch/ia64/vmx/vmmu.c
--- a/xen/arch/ia64/vmx/vmmu.c  Mon Oct 15 11:41:28 2007 -0600
+++ b/xen/arch/ia64/vmx/vmmu.c  Tue Oct 16 10:12:40 2007 +0900
@@ -96,8 +96,14 @@ static int init_domain_vhpt(struct vcpu 
 static int init_domain_vhpt(struct vcpu *v)
 {
     int rc;
-
-    rc = thash_alloc(&(v->arch.vhpt), default_vhpt_sz, "vhpt");
+    u64 size = v->domain->arch.hvm_domain.params[HVM_PARAM_VHPT_SIZE];
+
+    if (size == 0)
+        size = default_vhpt_sz;
+    else
+        size = canonicalize_vhpt_size(size);
+
+    rc = thash_alloc(&(v->arch.vhpt), size, "vhpt");
     v->arch.arch_vmx.mpta = v->arch.vhpt.pta.val;
     return rc;
 }
diff -r 2863852e02f6 xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h   Mon Oct 15 11:41:28 2007 -0600
+++ b/xen/include/public/hvm/params.h   Tue Oct 16 10:03:54 2007 +0900
@@ -52,7 +52,8 @@
 
 #ifdef __ia64__
 #define HVM_PARAM_NVRAM_FD     7
-#define HVM_NR_PARAMS          8
+#define HVM_PARAM_VHPT_SIZE    8
+#define HVM_NR_PARAMS          9
 #else
 #define HVM_NR_PARAMS          7
 #endif
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel