Skip to contentSkip to conversation

configure VHPT size per HVM domain

PATCH In review Kouya Shimura 4 participants 10 messages Oct 16, 2007 – Oct 19, 2007 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure VHPT size per HVM domain

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

tools/examples/xmexample.vti +4 -0
diff -r 2863852e02f6 tools/examples/xmexample.vti
@@ -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.
tools/python/xen/lowlevel/xc/xc.c +10 -5
diff -r 2863852e02f6 tools/python/xen/lowlevel/xc/xc.c
@@ -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();
tools/python/xen/xend/XendConfig.py +1 -1
diff -r 2863852e02f6 tools/python/xen/xend/XendConfig.py
@@ -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',
tools/python/xen/xend/image.py +4 -1
diff -r 2863852e02f6 tools/python/xen/xend/image.py
@@ -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
 
tools/python/xen/xm/create.py +5 -1
diff -r 2863852e02f6 tools/python/xen/xm/create.py
@@ -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]])
xen/arch/ia64/vmx/vmmu.c +8 -2
diff -r 2863852e02f6 xen/arch/ia64/vmx/vmmu.c
@@ -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;
 }
xen/include/public/hvm/params.h +2 -1
diff -r 2863852e02f6 xen/include/public/hvm/params.h
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Hi Kouya.

I guess Linux PV domains (especially dom0) possibly can gain similar performance improvement by increasing VHPT size too.
So would it be easy to make vhpt parameter non hvm specific? I know your concern is hvm domain, though.

On Tue, Oct 16, 2007 at 03:21:39PM +0900, Kouya Shimura wrote:
Content-Description: message body text

Quoted 172 lines

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

diff -r 2863852e02f6 tools/examples/xmexample.vti

tools/examples/xmexample.vti +4 -0
@@ -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

tools/python/xen/lowlevel/xc/xc.c +10 -5
@@ -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

tools/python/xen/xend/XendConfig.py +1 -1
@@ -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

tools/python/xen/xend/image.py +4 -1
@@ -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

tools/python/xen/xm/create.py +5 -1
@@ -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

xen/arch/ia64/vmx/vmmu.c +8 -2
@@ -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

xen/include/public/hvm/params.h +2 -1
@@ -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-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

Signature · 1 line
yamahata
#2 lore raw
In reply to Kouya Shimura

I've cleaned up the xc.hvm_build() interface in changeset 16116. Please merge against that. The main change will be that you will set the new HVM parameter in IA64_HVM_ImageHandler.buildDomain(), rather than passing the new parameter down to xc.hvm_build().

-- Keir

Quoted 168 lines · Kouya Shimura

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

diff -r 2863852e02f6 tools/examples/xmexample.vti

tools/examples/xmexample.vti Tue Oct 16 11:31:53 2007 +0900 renamed from tools/examples/xmexample.vti Mon Oct 15 11:41:28 2007 -0600 +4 -0
@@ -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

tools/python/xen/lowlevel/xc/xc.c Tue Oct 16 10:03:46 2007 +0900 renamed from tools/python/xen/lowlevel/xc/xc.c Mon Oct 15 11:41:28 2007 -0600 +10 -5
@@ -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

tools/python/xen/xend/XendConfig.py Tue Oct 16 10:21:25 2007 +0900 renamed from tools/python/xen/xend/XendConfig.py Mon Oct 15 11:41:28 2007 -0600 +1 -1
@@ -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

tools/python/xen/xend/image.py Tue Oct 16 10:03:46 2007 +0900 renamed from tools/python/xen/xend/image.py Mon Oct 15 11:41:28 2007 -0600 +4 -1
@@ -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

tools/python/xen/xm/create.py Tue Oct 16 11:22:10 2007 +0900 renamed from tools/python/xen/xm/create.py Mon Oct 15 11:41:28 2007 -0600 +5 -1
@@ -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

xen/arch/ia64/vmx/vmmu.c Tue Oct 16 10:12:40 2007 +0900 renamed from xen/arch/ia64/vmx/vmmu.c Mon Oct 15 11:41:28 2007 -0600 +8 -2
@@ -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

xen/include/public/hvm/params.h Tue Oct 16 10:03:54 2007 +0900 renamed from xen/include/public/hvm/params.h Mon Oct 15 11:41:28 2007 -0600 +2 -1
@@ -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
#3 lore raw

cover configure VHPT size per domain

Hi Keir and Alex,

I merged the patch and added support for PV domain. Please apply for Xen 3.2.0.

patch 1/2: common part
patch 2/2: ia64 part

Thanks,
Kouya

Quoted 184 lines · Keir Fraser

I've cleaned up the xc.hvm_build() interface in changeset 16116. Please merge against that. The main change will be that you will set the new HVM parameter in IA64_HVM_ImageHandler.buildDomain(), rather than passing the new parameter down to xc.hvm_build().

-- Keir

Quoted 159 lines · Kouya Shimura

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

diff -r 2863852e02f6 tools/examples/xmexample.vti

tools/examples/xmexample.vti Tue Oct 16 11:31:53 2007 +0900 renamed from tools/examples/xmexample.vti Mon Oct 15 11:41:28 2007 -0600 +4 -0
@@ -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

tools/python/xen/lowlevel/xc/xc.c Tue Oct 16 10:03:46 2007 +0900 renamed from tools/python/xen/lowlevel/xc/xc.c Mon Oct 15 11:41:28 2007 -0600 +10 -5
@@ -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

tools/python/xen/xend/XendConfig.py Tue Oct 16 10:21:25 2007 +0900 renamed from tools/python/xen/xend/XendConfig.py Mon Oct 15 11:41:28 2007 -0600 +1 -1
@@ -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

tools/python/xen/xend/image.py Tue Oct 16 10:03:46 2007 +0900 renamed from tools/python/xen/xend/image.py Mon Oct 15 11:41:28 2007 -0600 +4 -1
@@ -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

tools/python/xen/xm/create.py Tue Oct 16 11:22:10 2007 +0900 renamed from tools/python/xen/xm/create.py Mon Oct 15 11:41:28 2007 -0600 +5 -1
@@ -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

xen/arch/ia64/vmx/vmmu.c Tue Oct 16 10:12:40 2007 +0900 renamed from xen/arch/ia64/vmx/vmmu.c Mon Oct 15 11:41:28 2007 -0600 +8 -2
@@ -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

xen/include/public/hvm/params.h Tue Oct 16 10:03:54 2007 +0900 line 59

Quoted 9 lines
xen/include/public/hvm/params.h Tue Oct 16 10:03:54 2007 +0900 renamed from xen/include/public/hvm/params.h Mon Oct 15 11:41:28 2007 -0600 +2 -1
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

Re: [PATCH 0/2][IA64] configure VHPT size per domain

Both parts are now applied to xen-unstable.

-- Keir

Quoted 198 lines · Kouya Shimura

Hi Keir and Alex,

I merged the patch and added support for PV domain. Please apply for Xen 3.2.0.

patch 1/2: common part
patch 2/2: ia64 part

Thanks,
Kouya

Quoted 186 lines · Keir Fraser

I've cleaned up the xc.hvm_build() interface in changeset 16116. Please merge against that. The main change will be that you will set the new HVM parameter in IA64_HVM_ImageHandler.buildDomain(), rather than passing the new parameter down to xc.hvm_build().

-- Keir

Quoted 161 lines · Kouya Shimura

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

diff -r 2863852e02f6 tools/examples/xmexample.vti

tools/examples/xmexample.vti Tue Oct 16 11:31:53 2007 +0900 renamed from tools/examples/xmexample.vti Mon Oct 15 11:41:28 2007 -0600 +4 -0
@@ -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

tools/python/xen/lowlevel/xc/xc.c Tue Oct 16 10:03:46 2007 +0900 renamed from tools/python/xen/lowlevel/xc/xc.c Mon Oct 15 11:41:28 2007 -0600 +10 -5
@@ -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

tools/python/xen/xend/XendConfig.py Tue Oct 16 10:21:25 2007 +0900 renamed from tools/python/xen/xend/XendConfig.py Mon Oct 15 11:41:28 2007 -0600 +1 -1
@@ -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

tools/python/xen/xend/image.py Tue Oct 16 10:03:46 2007 +0900 renamed from tools/python/xen/xend/image.py Mon Oct 15 11:41:28 2007 -0600 +4 -1
@@ -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

tools/python/xen/xm/create.py Tue Oct 16 11:22:10 2007 +0900 renamed from tools/python/xen/xm/create.py Mon Oct 15 11:41:28 2007 -0600 +5 -1
@@ -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

xen/arch/ia64/vmx/vmmu.c Tue Oct 16 10:12:40 2007 +0900 renamed from xen/arch/ia64/vmx/vmmu.c Mon Oct 15 11:41:28 2007 -0600 +8 -2
@@ -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

xen/include/public/hvm/params.h Tue Oct 16 10:03:54 2007 +0900 line 59

Quoted 9 lines
xen/include/public/hvm/params.h Tue Oct 16 10:03:54 2007 +0900 renamed from xen/include/public/hvm/params.h Mon Oct 15 11:41:28 2007 -0600 +2 -1
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw

PATCH 1/2 configure VHPT size per domain: common part

In reply to Keir Fraser

common part.

# HG changeset patch
# User Kouya Shimura <[email protected]> # Date 1192770562 -32400
# Node ID 4b8752eccee77c2a3ef20f58bcc1c935dd80865a # Parent b4278beaf3549f410a5a6086dbd8af93c495aeac common part.

tools/examples/xmexample.vti +4 -0
diff -r b4278beaf354 -r 4b8752eccee7 tools/examples/xmexample.vti
@@ -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
+
+# Log2 of VHPT size, 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.
tools/libxc/xc_dom_ia64.c +1 -0
diff -r b4278beaf354 -r 4b8752eccee7 tools/libxc/xc_dom_ia64.c
@@ -260,6 +260,7 @@ int arch_setup_bootearly(struct xc_dom_i
     domctl.u.arch_setup.bp = (dom->start_info_pfn << PAGE_SHIFT)
         + sizeof(start_info_t);
     domctl.u.arch_setup.maxmem = dom->total_pages << PAGE_SHIFT;
+    domctl.u.arch_setup.vhpt_size_log2 = dom->flags;
     rc = do_domctl(dom->guest_xc, &domctl);
     return rc;
 }
tools/python/xen/xend/XendConfig.py +1 -1
diff -r b4278beaf354 -r 4b8752eccee7 tools/python/xen/xend/XendConfig.py
@@ -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',
tools/python/xen/xend/XendConstants.py +2 -0
diff -r b4278beaf354 -r 4b8752eccee7 tools/python/xen/xend/XendConstants.py
@@ -43,6 +43,8 @@ HVM_PARAM_PAE_ENABLED  = 4
 HVM_PARAM_PAE_ENABLED  = 4
 HVM_PARAM_IOREQ_PFN    = 5
 HVM_PARAM_BUFIOREQ_PFN = 6
+HVM_PARAM_NVRAM_FD     = 7
+HVM_PARAM_VHPT_SIZE    = 8
 
 restart_modes = [
     "restart",
tools/python/xen/xend/image.py +21 -2
diff -r b4278beaf354 -r 4b8752eccee7 tools/python/xen/xend/image.py
@@ -197,6 +197,7 @@ class LinuxImageHandler(ImageHandler):
 class LinuxImageHandler(ImageHandler):
 
     ostype = "linux"
+    flags = 0
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
@@ -213,6 +214,8 @@ class LinuxImageHandler(ImageHandler):
         log.debug("ramdisk        = %s", self.ramdisk)
         log.debug("vcpus          = %d", self.vm.getVCpuCount())
         log.debug("features       = %s", self.vm.getFeatures())
+        if arch.type == "ia64":
+            log.debug("vhpt          = %d", self.flags)
 
         return xc.linux_build(domid          = self.vm.getDomid(),
                               memsize        = mem_mb,
@@ -221,7 +224,8 @@ class LinuxImageHandler(ImageHandler):
                               console_evtchn = console_evtchn,
                               cmdline        = self.cmdline,
                               ramdisk        = self.ramdisk,
-                              features       = self.vm.getFeatures())
+                              features       = self.vm.getFeatures(),
+                              flags          = self.flags)
 
 class PPC_LinuxImageHandler(LinuxImageHandler):
 
@@ -500,8 +504,13 @@ class HVMImageHandler(ImageHandler):
 
 class IA64_HVM_ImageHandler(HVMImageHandler):
 
+    def configure(self, vmConfig):
+        HVMImageHandler.configure(self, vmConfig)
+        self.vhpt = int(vmConfig['platform'].get('vhpt',  0))
+
     def buildDomain(self):
         xc.nvram_init(self.vm.getName(), self.vm.getDomid())
+        xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_VHPT_SIZE, self.vhpt)
         return HVMImageHandler.buildDomain(self)
 
     def getRequiredAvailableMemory(self, mem_kb):
@@ -517,6 +526,16 @@ class IA64_HVM_ImageHandler(HVMImageHand
     def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
         # Explicit shadow memory is not a concept 
         return 0
+
+class IA64_Linux_ImageHandler(LinuxImageHandler):
+
+    def configure(self, vmConfig):
+        LinuxImageHandler.configure(self, vmConfig)
+        self.vhpt = int(vmConfig['platform'].get('vhpt',  0))
+
+    def buildDomain(self):
+        self.flags = self.vhpt
+        return LinuxImageHandler.buildDomain(self)
 
 class X86_HVM_ImageHandler(HVMImageHandler):
 
@@ -562,7 +581,7 @@ _handlers = {
         "linux": PPC_LinuxImageHandler,
     },
     "ia64": {
-        "linux": LinuxImageHandler,
+        "linux": IA64_Linux_ImageHandler,
         "hvm": IA64_HVM_ImageHandler,
     },
     "x86": {
tools/python/xen/xm/create.py +8 -1
diff -r b4278beaf354 -r 4b8752eccee7 tools/python/xen/xm/create.py
@@ -210,6 +210,10 @@ 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="Log2 of domain VHPT size for IA64.")
+
 gopts.var('cpu_cap', val='CAP',
           fn=set_int, default=None,
           use="""Set the maximum amount of cpu.
@@ -555,7 +559,10 @@ def configure_image(vals):
 
     if vals.builder == 'hvm':
         configure_hvm(config_image, vals) 
-       
+
+    if vals.vhpt != 0:
+        config_image.append(['vhpt', vals.vhpt])
+
     return config_image
     
 def configure_disks(config_devs, vals):
tools/python/xen/xm/xenapi_create.py +1 -1
diff -r b4278beaf354 -r 4b8752eccee7 tools/python/xen/xm/xenapi_create.py
@@ -818,7 +818,7 @@ class sxp2xml:
 
 
     def extract_platform(self, image, document):
-        platform_keys = ['acpi', 'apic', 'pae']
+        platform_keys = ['acpi', 'apic', 'pae', 'vhpt']
 
         def extract_platform_key(key):
             platform = document.createElement("platform")
xen/include/public/domctl.h +1 -0
diff -r b4278beaf354 -r 4b8752eccee7 xen/include/public/domctl.h
@@ -380,6 +380,7 @@ typedef struct xen_domctl_arch_setup {
     uint64_aligned_t maxmem; /* Highest memory address for MDT.  */
     uint64_aligned_t xsi_va; /* Xen shared_info area virtual address.  */
     uint32_t hypercall_imm;  /* Break imm for Xen hypercalls.  */
+    int8_t vhpt_size_log2;   /* Log2 of VHPT size. */
 #endif
 } xen_domctl_arch_setup_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
xen/include/public/hvm/params.h +2 -1
diff -r b4278beaf354 -r 4b8752eccee7 xen/include/public/hvm/params.h
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw

PATCH 2/2 configure VHPT size per domain: ia64 part

In reply to Keir Fraser

IA64 part.

# HG changeset patch
# User Kouya Shimura <[email protected]> # Date 1192770850 -32400
# Node ID 630a8cf763c0a00766ea2c5528ad148740edad8a # Parent b4278beaf3549f410a5a6086dbd8af93c495aeac IA64 part.

xen/arch/ia64/vmx/vmmu.c +9 -13
diff -r b4278beaf354 -r 630a8cf763c0 xen/arch/ia64/vmx/vmmu.c
@@ -22,6 +22,7 @@
 #include <asm/vmx_vcpu.h>
 #include <asm/vmx_pal_vsa.h>
 #include <xen/sched-if.h>
+#include <asm/vhpt.h>
 
 static int default_vtlb_sz = DEFAULT_VTLB_SZ;
 static int default_vhpt_sz = DEFAULT_VHPT_SZ;
@@ -38,17 +39,6 @@ static void __init parse_vtlb_size(char 
     }
 }
 
-static int canonicalize_vhpt_size(int sz)
-{
-    /* minimum 32KB */
-    if (sz < 15)
-        return 15;
-    /* maximum 8MB (since purging TR is hard coded) */
-    if (sz > IA64_GRANULE_SHIFT - 1)
-        return IA64_GRANULE_SHIFT - 1;
-    return sz;
-}
-
 static void __init parse_vhpt_size(char *s)
 {
     int sz = parse_size_and_unit(s, NULL);
@@ -96,8 +86,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;
 }
xen/arch/ia64/xen/dom0_ops.c +17 -0
diff -r b4278beaf354 -r 630a8cf763c0 xen/arch/ia64/xen/dom0_ops.c
@@ -93,6 +93,9 @@ long arch_do_domctl(xen_domctl_t *op, XE
             ds->maxmem = d->arch.convmem_end;
             ds->xsi_va = d->arch.shared_info_va;
             ds->hypercall_imm = d->arch.breakimm;
+#ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
+            ds->vhpt_size_log2 = d->arch.vhpt_size_log2;
+#endif
             /* Copy back.  */
             if ( copy_to_guest(u_domctl, op, 1) )
                 ret = -EFAULT;
@@ -116,6 +119,20 @@ long arch_do_domctl(xen_domctl_t *op, XE
                     for_each_vcpu (d, v)
                         v->arch.breakimm = d->arch.breakimm;
                 }
+#ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
+                if (ds->vhpt_size_log2 == -1) {
+                    d->arch.has_pervcpu_vhpt = 0;
+                    ds->vhpt_size_log2 = -1;
+                    printk(XENLOG_INFO "XEN_DOMCTL_arch_setup: "
+                           "domain %d VHPT is global.\n", d->domain_id);
+                } else {
+                    d->arch.has_pervcpu_vhpt = 1;
+                    d->arch.vhpt_size_log2 = ds->vhpt_size_log2;
+                    printk(XENLOG_INFO "XEN_DOMCTL_arch_setup: "
+                           "domain %d VHPT is per vcpu. size=2**%d\n",
+                           d->domain_id, ds->vhpt_size_log2);
+                }
+#endif
                 if (ds->xsi_va)
                     d->arch.shared_info_va = ds->xsi_va;
                 ret = dom_fw_setup(d, ds->bp, ds->maxmem);
xen/arch/ia64/xen/vhpt.c +22 -10
diff -r b4278beaf354 -r 630a8cf763c0 xen/arch/ia64/xen/vhpt.c
@@ -28,12 +28,13 @@ DEFINE_PER_CPU(volatile u32, vhpt_tlbflu
 #endif
 
 static void
-__vhpt_flush(unsigned long vhpt_maddr)
+__vhpt_flush(unsigned long vhpt_maddr, unsigned long vhpt_size_log2)
 {
 	struct vhpt_lf_entry *v = (struct vhpt_lf_entry*)__va(vhpt_maddr);
+	unsigned long num_entries = 1 << (vhpt_size_log2 - 5);
 	int i;
 
-	for (i = 0; i < VHPT_NUM_ENTRIES; i++, v++)
+	for (i = 0; i < num_entries; i++, v++)
 		v->ti_tag = INVALID_TI_TAG;
 }
 
@@ -42,7 +43,7 @@ local_vhpt_flush(void)
 {
 	/* increment flush clock before flush */
 	u32 flush_time = tlbflush_clock_inc_and_return();
-	__vhpt_flush(__ia64_per_cpu_var(vhpt_paddr));
+	__vhpt_flush(__ia64_per_cpu_var(vhpt_paddr), VHPT_SIZE_LOG2);
 	/* this must be after flush */
 	tlbflush_update_time(&__get_cpu_var(vhpt_tlbflush_timestamp),
 	                     flush_time);
@@ -52,17 +53,23 @@ void
 void
 vcpu_vhpt_flush(struct vcpu* v)
 {
-	__vhpt_flush(vcpu_vhpt_maddr(v));
+	unsigned long vhpt_size_log2 = VHPT_SIZE_LOG2;
+#ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
+	if (HAS_PERVCPU_VHPT(v->domain))
+		vhpt_size_log2 = v->arch.pta.size;
+#endif
+	__vhpt_flush(vcpu_vhpt_maddr(v), vhpt_size_log2);
 	perfc_incr(vcpu_vhpt_flush);
 }
 
 static void
-vhpt_erase(unsigned long vhpt_maddr)
+vhpt_erase(unsigned long vhpt_maddr, unsigned long vhpt_size_log2)
 {
 	struct vhpt_lf_entry *v = (struct vhpt_lf_entry*)__va(vhpt_maddr);
+	unsigned long num_entries = 1 << (vhpt_size_log2 - 5);
 	int i;
 
-	for (i = 0; i < VHPT_NUM_ENTRIES; i++, v++) {
+	for (i = 0; i < num_entries; i++, v++) {
 		v->itir = 0;
 		v->CChain = 0;
 		v->page_flags = 0;
@@ -140,7 +147,7 @@ void __init vhpt_init(void)
 	__get_cpu_var(vhpt_pend) = paddr + (1 << VHPT_SIZE_LOG2) - 1;
 	printk(XENLOG_DEBUG "vhpt_init: vhpt paddr=0x%lx, end=0x%lx\n",
 	       paddr, __get_cpu_var(vhpt_pend));
-	vhpt_erase(paddr);
+	vhpt_erase(paddr, VHPT_SIZE_LOG2);
 	// we don't enable VHPT here.
 	// context_switch() or schedule_tail() does it.
 }
@@ -151,6 +158,11 @@ pervcpu_vhpt_alloc(struct vcpu *v)
 {
 	unsigned long vhpt_size_log2 = VHPT_SIZE_LOG2;
 
+	if (v->domain->arch.vhpt_size_log2 > 0)
+	    vhpt_size_log2 =
+		canonicalize_vhpt_size(v->domain->arch.vhpt_size_log2);
+	printk(XENLOG_DEBUG "%s vhpt_size_log2=%ld\n",
+	       __func__, vhpt_size_log2);
 	v->arch.vhpt_entries =
 		(1UL << vhpt_size_log2) / sizeof(struct vhpt_lf_entry);
 	v->arch.vhpt_page =
@@ -164,11 +176,11 @@ pervcpu_vhpt_alloc(struct vcpu *v)
 
 	v->arch.pta.val = 0; // to zero reserved bits
 	v->arch.pta.ve = 1; // enable vhpt
-	v->arch.pta.size = VHPT_SIZE_LOG2;
+	v->arch.pta.size = vhpt_size_log2;
 	v->arch.pta.vf = 1; // long format
 	v->arch.pta.base = __va_ul(v->arch.vhpt_maddr) >> 15;
 
-	vhpt_erase(v->arch.vhpt_maddr);
+	vhpt_erase(v->arch.vhpt_maddr, vhpt_size_log2);
 	smp_mb(); // per vcpu vhpt may be used by another physical cpu.
 	return 0;
 }
@@ -178,7 +190,7 @@ pervcpu_vhpt_free(struct vcpu *v)
 {
 	if (likely(v->arch.vhpt_page != NULL))
 		free_domheap_pages(v->arch.vhpt_page,
-		                   VHPT_SIZE_LOG2 - PAGE_SHIFT);
+		                   v->arch.pta.size - PAGE_SHIFT);
 }
 #endif
 
xen/include/asm-ia64/domain.h +1 -0
diff -r b4278beaf354 -r 630a8cf763c0 xen/include/asm-ia64/domain.h
@@ -123,6 +123,7 @@ struct arch_domain {
             unsigned int is_vti : 1;
 #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
             unsigned int has_pervcpu_vhpt : 1;
+            unsigned int vhpt_size_log2 : 6;
 #endif
         };
     };
xen/include/asm-ia64/vhpt.h +13 -0
diff -r b4278beaf354 -r 630a8cf763c0 xen/include/asm-ia64/vhpt.h
@@ -84,5 +84,18 @@ vcpu_pta(struct vcpu* v)
         (VHPT_SIZE_LOG2 << 2) | VHPT_ENABLED;
 }
 
+static inline int
+canonicalize_vhpt_size(int sz)
+{
+    /* minimum 32KB */
+    if (sz < 15)
+        return 15;
+    /* maximum 8MB (since purging TR is hard coded) */
+    if (sz > IA64_GRANULE_SHIFT - 1)
+        return IA64_GRANULE_SHIFT - 1;
+    return sz;
+}
+
+
 #endif /* !__ASSEMBLY */
 #endif

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#7 lore raw
In reply to Kouya Shimura

Quoting Kouya Shimura <[email protected]>:

Quoted 7 lines

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.

Good idea.
As Isaku suggested it will be nice to have this option for pv too. And if you want to go farther, you may also want to specify vtlb size!

Tristan.

#8 lore raw
Quoted 1 line · On Tue, Oct 16, 2007 at 01:51:25PM +0200, [email protected] wrote:

And if you want to go farther, you may also want to specify vtlb size!

Yes. The results showed that reducing vTLB flush overhead even with smaller vTLB size is important for Windows performance. So possibly eliminating whole the collision chain might increase Windows performance.

Kouya, do you have any idea about it?

Signature · 1 line
yamahata
#9 lore raw

Hi Yamahata-san,

I'm now thinking about PV domain. Please stay tuned.

As I mentioned before, vTLB is already minimum size(16KB) and no collision for windows.

http://lists.xensource.com/archives/html/xen-ia64-devel/2007-08/msg00108.html

So I feel it's enough about vTLB. If smaller vTLB size is required, we have to prepare a brand new hash function.

Thanks,
Kouya

Quoted 17 lines · Isaku Yamahata
Quoted 1 line · On Tue, Oct 16, 2007 at 01:51:25PM +0200, [email protected] wrote:

And if you want to go farther, you may also want to specify vtlb size!

Yes. The results showed that reducing vTLB flush overhead even with smaller vTLB size is important for Windows performance. So possibly eliminating whole the collision chain might increase Windows performance.

Kouya, do you have any idea about it?

Signature · 6 lines
yamahata

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel