ia64/xen-unstable
changeset 18639:3603e95245fa
x86: make injection of spurious page faults configurable per domain
Some distro kernels do not handle spurious page faults so allow these
to be supressed on a per VM basis.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Some distro kernels do not handle spurious page faults so allow these
to be supressed on a per VM basis.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Wed Oct 15 15:56:26 2008 +0100 (2008-10-15) |
parents | 61218a1763da |
children | 33d6ed9fd3c5 |
files | tools/libxc/xc_domain.c tools/libxc/xenctrl.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/create.py xen/arch/x86/domctl.c xen/arch/x86/traps.c xen/include/asm-x86/domain.h xen/include/public/domctl.h |
line diff
1.1 --- a/tools/libxc/xc_domain.c Wed Oct 15 11:58:15 2008 +0100 1.2 +++ b/tools/libxc/xc_domain.c Wed Oct 15 15:56:26 2008 +0100 1.3 @@ -1049,6 +1049,18 @@ int xc_domain_get_machine_address_size(i 1.4 return rc == 0 ? domctl.u.address_size.size : rc; 1.5 } 1.6 1.7 +int xc_domain_suppress_spurious_page_faults(int xc, uint32_t domid) 1.8 +{ 1.9 + DECLARE_DOMCTL; 1.10 + 1.11 + memset(&domctl, 0, sizeof(domctl)); 1.12 + domctl.domain = domid; 1.13 + domctl.cmd = XEN_DOMCTL_suppress_spurious_page_faults; 1.14 + 1.15 + return do_domctl(xc, &domctl); 1.16 + 1.17 +} 1.18 + 1.19 /* 1.20 * Local variables: 1.21 * mode: C
2.1 --- a/tools/libxc/xenctrl.h Wed Oct 15 11:58:15 2008 +0100 2.2 +++ b/tools/libxc/xenctrl.h Wed Oct 15 15:56:26 2008 +0100 2.3 @@ -1103,6 +1103,9 @@ int xc_domain_set_machine_address_size(i 2.4 int xc_domain_get_machine_address_size(int handle, 2.5 uint32_t domid); 2.6 2.7 +int xc_domain_suppress_spurious_page_faults(int handle, 2.8 + uint32_t domid); 2.9 + 2.10 /* Set the target domain */ 2.11 int xc_domain_set_target(int xc_handle, 2.12 uint32_t domid,
3.1 --- a/tools/python/xen/lowlevel/xc/xc.c Wed Oct 15 11:58:15 2008 +0100 3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c Wed Oct 15 15:56:26 2008 +0100 3.3 @@ -859,6 +859,21 @@ static PyObject *pyxc_dom_set_machine_ad 3.4 return zero; 3.5 } 3.6 3.7 +static PyObject *pyxc_dom_suppress_spurious_page_faults(XcObject *self, 3.8 + PyObject *args, 3.9 + PyObject *kwds) 3.10 +{ 3.11 + uint32_t dom; 3.12 + 3.13 + if (!PyArg_ParseTuple(args, "i", &dom)) 3.14 + return NULL; 3.15 + 3.16 + if (xc_domain_suppress_spurious_page_faults(self->xc_handle, dom) != 0) 3.17 + return pyxc_error_to_exception(); 3.18 + 3.19 + Py_INCREF(zero); 3.20 + return zero; 3.21 +} 3.22 #endif /* __i386__ || __x86_64__ */ 3.23 3.24 static PyObject *pyxc_hvm_build(XcObject *self, 3.25 @@ -1911,6 +1926,12 @@ static PyMethodDef pyxc_methods[] = { 3.26 "Set maximum machine address size for this domain.\n" 3.27 " dom [int]: Identifier of domain.\n" 3.28 " width [int]: Maximum machine address width.\n" }, 3.29 + 3.30 + { "domain_suppress_spurious_page_faults", 3.31 + (PyCFunction)pyxc_dom_suppress_spurious_page_faults, 3.32 + METH_VARARGS, "\n" 3.33 + "Do not propagate spurious page faults to this guest.\n" 3.34 + " dom [int]: Identifier of domain.\n" }, 3.35 #endif 3.36 3.37 { NULL, NULL, 0, NULL }
4.1 --- a/tools/python/xen/xend/XendConfig.py Wed Oct 15 11:58:15 2008 +0100 4.2 +++ b/tools/python/xen/xend/XendConfig.py Wed Oct 15 15:56:26 2008 +0100 4.3 @@ -210,6 +210,7 @@ XENAPI_CFG_TYPES = { 4.4 'cpuid' : dict, 4.5 'cpuid_check' : dict, 4.6 'machine_address_size': int, 4.7 + 'suppress_spurious_page_faults': bool0, 4.8 } 4.9 4.10 # List of legacy configuration keys that have no equivalent in the
5.1 --- a/tools/python/xen/xend/XendDomainInfo.py Wed Oct 15 11:58:15 2008 +0100 5.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Oct 15 15:56:26 2008 +0100 5.3 @@ -2241,6 +2241,10 @@ class XendDomainInfo: 5.4 if self.info.has_key('machine_address_size'): 5.5 log.debug("_initDomain: setting maximum machine address size %d" % self.info['machine_address_size']) 5.6 xc.domain_set_machine_address_size(self.domid, self.info['machine_address_size']) 5.7 + 5.8 + if self.info.has_key('suppress_spurious_page_faults') and self.info['suppress_spurious_page_faults']: 5.9 + log.debug("_initDomain: suppressing spurious page faults") 5.10 + xc.domain_suppress_spurious_page_faults(self.domid) 5.11 5.12 self._createChannels() 5.13
6.1 --- a/tools/python/xen/xm/create.py Wed Oct 15 11:58:15 2008 +0100 6.2 +++ b/tools/python/xen/xm/create.py Wed Oct 15 15:56:26 2008 +0100 6.3 @@ -583,6 +583,10 @@ gopts.var('machine_address_size', val='B 6.4 fn=set_int, default=None, 6.5 use="""Maximum machine address size""") 6.6 6.7 +gopts.var('suppress_spurious_page_faults', val='yes|no', 6.8 + fn=set_bool, default=None, 6.9 + use="""Do not inject spurious page faults into this guest""") 6.10 + 6.11 def err(msg): 6.12 """Print an error to stderr and exit. 6.13 """ 6.14 @@ -634,6 +638,9 @@ def configure_image(vals): 6.15 if vals.machine_address_size: 6.16 config_image.append(['machine_address_size', vals.machine_address_size]) 6.17 6.18 + if vals.suppress_spurious_page_faults: 6.19 + config_image.append(['suppress_spurious_page_faults', vals.suppress_spurious_page_faults]) 6.20 + 6.21 return config_image 6.22 6.23 def configure_disks(config_devs, vals): 6.24 @@ -887,7 +894,7 @@ def make_config(vals): 6.25 'restart', 'on_poweroff', 6.26 'on_reboot', 'on_crash', 'vcpus', 'vcpu_avail', 'features', 6.27 'on_xend_start', 'on_xend_stop', 'target', 'cpuid', 6.28 - 'cpuid_check', 'machine_address_size']) 6.29 + 'cpuid_check', 'machine_address_size', 'suppress_spurious_page_faults']) 6.30 6.31 if vals.uuid is not None: 6.32 config.append(['uuid', vals.uuid])
7.1 --- a/xen/arch/x86/domctl.c Wed Oct 15 11:58:15 2008 +0100 7.2 +++ b/xen/arch/x86/domctl.c Wed Oct 15 15:56:26 2008 +0100 7.3 @@ -1028,6 +1028,21 @@ long arch_do_domctl( 7.4 } 7.5 break; 7.6 7.7 + case XEN_DOMCTL_suppress_spurious_page_faults: 7.8 + { 7.9 + struct domain *d; 7.10 + 7.11 + ret = -ESRCH; 7.12 + d = rcu_lock_domain_by_id(domctl->domain); 7.13 + if ( d != NULL ) 7.14 + { 7.15 + d->arch.suppress_spurious_page_faults = 1; 7.16 + rcu_unlock_domain(d); 7.17 + ret = 0; 7.18 + } 7.19 + } 7.20 + break; 7.21 + 7.22 default: 7.23 ret = -ENOSYS; 7.24 break;
8.1 --- a/xen/arch/x86/traps.c Wed Oct 15 11:58:15 2008 +0100 8.2 +++ b/xen/arch/x86/traps.c Wed Oct 15 15:56:26 2008 +0100 8.3 @@ -1242,6 +1242,10 @@ asmlinkage void do_page_fault(struct cpu 8.4 regs->error_code, _p(addr)); 8.5 } 8.6 8.7 + if ( unlikely(current->domain->arch.suppress_spurious_page_faults 8.8 + && spurious_page_fault(addr, regs)) ) 8.9 + return; 8.10 + 8.11 propagate_page_fault(addr, regs->error_code); 8.12 } 8.13
9.1 --- a/xen/include/asm-x86/domain.h Wed Oct 15 11:58:15 2008 +0100 9.2 +++ b/xen/include/asm-x86/domain.h Wed Oct 15 15:56:26 2008 +0100 9.3 @@ -250,6 +250,8 @@ struct arch_domain 9.4 bool_t is_32bit_pv; 9.5 /* Is shared-info page in 32-bit format? */ 9.6 bool_t has_32bit_shinfo; 9.7 + /* Domain cannot handle spurious page faults? */ 9.8 + bool_t suppress_spurious_page_faults; 9.9 9.10 /* Continuable domain_relinquish_resources(). */ 9.11 enum {
10.1 --- a/xen/include/public/domctl.h Wed Oct 15 11:58:15 2008 +0100 10.2 +++ b/xen/include/public/domctl.h Wed Oct 15 15:56:26 2008 +0100 10.3 @@ -614,6 +614,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_subsc 10.4 #define XEN_DOMCTL_set_machine_address_size 51 10.5 #define XEN_DOMCTL_get_machine_address_size 52 10.6 10.7 +/* 10.8 + * Do not inject spurious page faults into this domain. 10.9 + */ 10.10 +#define XEN_DOMCTL_suppress_spurious_page_faults 53 10.11 10.12 struct xen_domctl { 10.13 uint32_t cmd;