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-changelog

[Xen-changelog] [xen-unstable] x86: make injection of spurious page faul

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: make injection of spurious page faults configurable per domain
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 15 Oct 2008 12:40:08 -0700
Delivery-date: Wed, 15 Oct 2008 12:39:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224082586 -3600
# Node ID 3603e95245fab2bb5e331c411ed67205ce0248ac
# Parent  61218a1763da340e6fbf5a153255ad723c254661
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@xxxxxxxxxx>
---
 tools/libxc/xc_domain.c                 |   12 ++++++++++++
 tools/libxc/xenctrl.h                   |    3 +++
 tools/python/xen/lowlevel/xc/xc.c       |   21 +++++++++++++++++++++
 tools/python/xen/xend/XendConfig.py     |    1 +
 tools/python/xen/xend/XendDomainInfo.py |    4 ++++
 tools/python/xen/xm/create.py           |    9 ++++++++-
 xen/arch/x86/domctl.c                   |   15 +++++++++++++++
 xen/arch/x86/traps.c                    |    4 ++++
 xen/include/asm-x86/domain.h            |    2 ++
 xen/include/public/domctl.h             |    4 ++++
 10 files changed, 74 insertions(+), 1 deletion(-)

diff -r 61218a1763da -r 3603e95245fa tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Wed Oct 15 11:58:15 2008 +0100
+++ b/tools/libxc/xc_domain.c   Wed Oct 15 15:56:26 2008 +0100
@@ -1049,6 +1049,18 @@ int xc_domain_get_machine_address_size(i
     return rc == 0 ? domctl.u.address_size.size : rc;
 }
 
+int xc_domain_suppress_spurious_page_faults(int xc, uint32_t domid)
+{
+    DECLARE_DOMCTL;
+
+    memset(&domctl, 0, sizeof(domctl));
+    domctl.domain = domid;
+    domctl.cmd    = XEN_DOMCTL_suppress_spurious_page_faults;
+
+    return do_domctl(xc, &domctl);
+
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 61218a1763da -r 3603e95245fa tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Wed Oct 15 11:58:15 2008 +0100
+++ b/tools/libxc/xenctrl.h     Wed Oct 15 15:56:26 2008 +0100
@@ -1103,6 +1103,9 @@ int xc_domain_get_machine_address_size(i
 int xc_domain_get_machine_address_size(int handle,
                                       uint32_t domid);
 
+int xc_domain_suppress_spurious_page_faults(int handle,
+                                         uint32_t domid);
+
 /* Set the target domain */
 int xc_domain_set_target(int xc_handle,
                          uint32_t domid,
diff -r 61218a1763da -r 3603e95245fa tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Oct 15 11:58:15 2008 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Wed Oct 15 15:56:26 2008 +0100
@@ -859,6 +859,21 @@ static PyObject *pyxc_dom_set_machine_ad
     return zero;
 }
 
+static PyObject *pyxc_dom_suppress_spurious_page_faults(XcObject *self,
+                                                     PyObject *args,
+                                                     PyObject *kwds)
+{
+    uint32_t dom;
+
+    if (!PyArg_ParseTuple(args, "i", &dom))
+       return NULL;
+
+    if (xc_domain_suppress_spurious_page_faults(self->xc_handle, dom) != 0)
+       return pyxc_error_to_exception();
+
+    Py_INCREF(zero);
+    return zero;
+}
 #endif /* __i386__ || __x86_64__ */
 
 static PyObject *pyxc_hvm_build(XcObject *self,
@@ -1911,6 +1926,12 @@ static PyMethodDef pyxc_methods[] = {
       "Set maximum machine address size for this domain.\n"
       " dom [int]: Identifier of domain.\n"
       " width [int]: Maximum machine address width.\n" },
+
+    { "domain_suppress_spurious_page_faults",
+      (PyCFunction)pyxc_dom_suppress_spurious_page_faults,
+      METH_VARARGS, "\n"
+      "Do not propagate spurious page faults to this guest.\n"
+      " dom [int]: Identifier of domain.\n" },
 #endif
 
     { NULL, NULL, 0, NULL }
diff -r 61218a1763da -r 3603e95245fa tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Wed Oct 15 11:58:15 2008 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Wed Oct 15 15:56:26 2008 +0100
@@ -210,6 +210,7 @@ XENAPI_CFG_TYPES = {
     'cpuid' : dict,
     'cpuid_check' : dict,
     'machine_address_size': int,
+    'suppress_spurious_page_faults': bool0,
 }
 
 # List of legacy configuration keys that have no equivalent in the
diff -r 61218a1763da -r 3603e95245fa tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Oct 15 11:58:15 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Oct 15 15:56:26 2008 +0100
@@ -2241,6 +2241,10 @@ class XendDomainInfo:
             if self.info.has_key('machine_address_size'):
                 log.debug("_initDomain: setting maximum machine address size 
%d" % self.info['machine_address_size'])
                 xc.domain_set_machine_address_size(self.domid, 
self.info['machine_address_size'])
+
+            if self.info.has_key('suppress_spurious_page_faults') and 
self.info['suppress_spurious_page_faults']:
+                log.debug("_initDomain: suppressing spurious page faults")
+                xc.domain_suppress_spurious_page_faults(self.domid)
                 
             self._createChannels()
 
diff -r 61218a1763da -r 3603e95245fa tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Wed Oct 15 11:58:15 2008 +0100
+++ b/tools/python/xen/xm/create.py     Wed Oct 15 15:56:26 2008 +0100
@@ -583,6 +583,10 @@ gopts.var('machine_address_size', val='B
           fn=set_int, default=None,
           use="""Maximum machine address size""")
 
+gopts.var('suppress_spurious_page_faults', val='yes|no',
+          fn=set_bool, default=None,
+          use="""Do not inject spurious page faults into this guest""")
+
 def err(msg):
     """Print an error to stderr and exit.
     """
@@ -633,6 +637,9 @@ def configure_image(vals):
 
     if vals.machine_address_size:
         config_image.append(['machine_address_size', 
vals.machine_address_size])
+
+    if vals.suppress_spurious_page_faults:
+        config_image.append(['suppress_spurious_page_faults', 
vals.suppress_spurious_page_faults])
 
     return config_image
     
@@ -887,7 +894,7 @@ def make_config(vals):
                    'restart', 'on_poweroff',
                    'on_reboot', 'on_crash', 'vcpus', 'vcpu_avail', 'features',
                    'on_xend_start', 'on_xend_stop', 'target', 'cpuid',
-                   'cpuid_check', 'machine_address_size'])
+                   'cpuid_check', 'machine_address_size', 
'suppress_spurious_page_faults'])
 
     if vals.uuid is not None:
         config.append(['uuid', vals.uuid])
diff -r 61218a1763da -r 3603e95245fa xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c     Wed Oct 15 11:58:15 2008 +0100
+++ b/xen/arch/x86/domctl.c     Wed Oct 15 15:56:26 2008 +0100
@@ -1028,6 +1028,21 @@ long arch_do_domctl(
     }
     break;
 
+    case XEN_DOMCTL_suppress_spurious_page_faults:
+    {
+        struct domain *d;
+
+        ret = -ESRCH;
+        d = rcu_lock_domain_by_id(domctl->domain);
+        if ( d != NULL )
+        {
+            d->arch.suppress_spurious_page_faults = 1;
+            rcu_unlock_domain(d);
+            ret = 0;
+        }
+    }
+    break;
+
     default:
         ret = -ENOSYS;
         break;
diff -r 61218a1763da -r 3603e95245fa xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Wed Oct 15 11:58:15 2008 +0100
+++ b/xen/arch/x86/traps.c      Wed Oct 15 15:56:26 2008 +0100
@@ -1241,6 +1241,10 @@ asmlinkage void do_page_fault(struct cpu
               "Faulting linear address: %p\n",
               regs->error_code, _p(addr));
     }
+
+    if ( unlikely(current->domain->arch.suppress_spurious_page_faults
+                  && spurious_page_fault(addr, regs)) )
+        return;
 
     propagate_page_fault(addr, regs->error_code);
 }
diff -r 61218a1763da -r 3603e95245fa xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h      Wed Oct 15 11:58:15 2008 +0100
+++ b/xen/include/asm-x86/domain.h      Wed Oct 15 15:56:26 2008 +0100
@@ -250,6 +250,8 @@ struct arch_domain
     bool_t is_32bit_pv;
     /* Is shared-info page in 32-bit format? */
     bool_t has_32bit_shinfo;
+    /* Domain cannot handle spurious page faults? */
+    bool_t suppress_spurious_page_faults;
 
     /* Continuable domain_relinquish_resources(). */
     enum {
diff -r 61218a1763da -r 3603e95245fa xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Wed Oct 15 11:58:15 2008 +0100
+++ b/xen/include/public/domctl.h       Wed Oct 15 15:56:26 2008 +0100
@@ -614,6 +614,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_subsc
 #define XEN_DOMCTL_set_machine_address_size  51
 #define XEN_DOMCTL_get_machine_address_size  52
 
+/*
+ * Do not inject spurious page faults into this domain.
+ */
+#define XEN_DOMCTL_suppress_spurious_page_faults 53
 
 struct xen_domctl {
     uint32_t cmd;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: make injection of spurious page faults configurable per domain, Xen patchbot-unstable <=