Skip to contentSkip to conversation

xen: Drop obsolete DOMCTLs

PATCH In review Andrew Cooper 5 participants 10 messages Aug 13, 2019 – Aug 28, 2019 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

cover xen: Drop obsolete DOMCTLs

These domctls exist to work around bugs in obsolete 32bit PV guests. They are no longer useful.

Andrew Cooper (2):
xen: Drop XEN_DOMCTL_suppress_spurious_page_faults
xen: Drop XEN_DOMCTL_{get,set}_machine_address_size

 tools/libxc/include/xenctrl.h       |  9 --------
 tools/libxc/xc_domain.c             | 41 ---------------------------------
 tools/ocaml/libs/xc/xenctrl.ml      |  5 -----
 tools/ocaml/libs/xc/xenctrl.mli     |  5 -----
 tools/ocaml/libs/xc/xenctrl_stubs.c | 26 ---------------------
 tools/python/xen/lowlevel/xc/xc.c   | 45 -------------------------------------
 xen/arch/x86/domctl.c               | 16 -------------
 xen/arch/x86/traps.c                | 14 ------------
 xen/include/asm-x86/domain.h        |  3 ---
 xen/include/public/domctl.h         | 18 +++------------
 xen/xsm/flask/hooks.c               |  3 ---
 xen/xsm/flask/policy/access_vectors |  7 +++---
 12 files changed, 6 insertions(+), 186 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

PATCH 2/2 xen: Drop XEN_DOMCTL_{get, set}_machine_address_size

This functionality is obsolete. It was introduced by c/s 41296317a31 into Xend, but was never exposed in libxl.

Nothing limits this to PV guests, but it makes no sense for HVM guests.

Looking through the XenServer templates, this was used to work around bugs in the 32bit RHEL/CentOS 4.7 and 4.8 kernels (fixed in 4.9) and RHEL/CentOS/OEL 5.2 and 5.3 kernels (fixed in 5.4). RHEL 4 as a major version went out of support in 2017, whereas the 5.2/5.3 kernels went out of support when 5.4 was released in 2009.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Daniel De Graaf <[email protected]>
CC: Christian Lindig <[email protected]>
CC: Rob Hoes <[email protected]>

There may be some resulting simplifications which can be made to the heap allocator, but that involves untangling the other address clamping logic first.

---
 tools/libxc/include/xenctrl.h       |  6 ------
 tools/libxc/xc_domain.c             | 29 -----------------------------
 tools/ocaml/libs/xc/xenctrl.ml      |  5 -----
 tools/ocaml/libs/xc/xenctrl.mli     |  5 -----
 tools/ocaml/libs/xc/xenctrl_stubs.c | 26 --------------------------
 tools/python/xen/lowlevel/xc/xc.c   | 23 -----------------------
 xen/arch/x86/domctl.c               | 12 ------------
 xen/include/public/domctl.h         | 11 ++---------
 xen/xsm/flask/hooks.c               |  2 --
 xen/xsm/flask/policy/access_vectors |  4 ++--
 10 files changed, 4 insertions(+), 119 deletions(-)
tools/libxc/include/xenctrl.h +0 -6
index a36896034a..c92386aab8 100644
@@ -1781,12 +1781,6 @@ int xc_domain_unbind_pt_spi_irq(xc_interface *xch,
                                 uint16_t vspi,
                                 uint16_t spi);
 
-int xc_domain_set_machine_address_size(xc_interface *xch,
-				       uint32_t domid,
-				       unsigned int width);
-int xc_domain_get_machine_address_size(xc_interface *xch,
-				       uint32_t domid);
-
 /* Set the target domain */
 int xc_domain_set_target(xc_interface *xch,
                          uint32_t domid,
tools/libxc/xc_domain.c +0 -29
index 64ca513aae..e544218d2e 100644
@@ -2161,35 +2161,6 @@ int xc_domain_subscribe_for_suspend(
     return do_domctl(xch, &domctl);
 }
 
-int xc_domain_set_machine_address_size(xc_interface *xch,
-                                       uint32_t domid,
-                                       unsigned int width)
-{
-    DECLARE_DOMCTL;
-
-    memset(&domctl, 0, sizeof(domctl));
-    domctl.domain = domid;
-    domctl.cmd    = XEN_DOMCTL_set_machine_address_size;
-    domctl.u.address_size.size = width;
-
-    return do_domctl(xch, &domctl);
-}
-
-
-int xc_domain_get_machine_address_size(xc_interface *xch, uint32_t domid)
-{
-    DECLARE_DOMCTL;
-    int rc;
-
-    memset(&domctl, 0, sizeof(domctl));
-    domctl.domain = domid;
-    domctl.cmd    = XEN_DOMCTL_get_machine_address_size;
-
-    rc = do_domctl(xch, &domctl);
-
-    return rc == 0 ? domctl.u.address_size.size : rc;
-}
-
 int xc_domain_debug_control(xc_interface *xc, uint32_t domid, uint32_t sop, uint32_t vcpu)
 {
     DECLARE_DOMCTL;
tools/ocaml/libs/xc/xenctrl.ml +0 -5
index a57130a3c3..35958b94d5 100644
@@ -241,11 +241,6 @@ external domain_set_memmap_limit: handle -> domid -> int64 -> unit
 external domain_memory_increase_reservation: handle -> domid -> int64 -> unit
        = "stub_xc_domain_memory_increase_reservation"
 
-external domain_set_machine_address_size: handle -> domid -> int -> unit
-       = "stub_xc_domain_set_machine_address_size"
-external domain_get_machine_address_size: handle -> domid -> int
-       = "stub_xc_domain_get_machine_address_size"
-
 external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
                         -> string option array
                         -> string option array
tools/ocaml/libs/xc/xenctrl.mli +0 -5
index 476bbecb90..6c4268d453 100644
@@ -202,11 +202,6 @@ val pages_to_mib : int64 -> int64
 external watchdog : handle -> int -> int32 -> int
   = "stub_xc_watchdog"
 
-external domain_set_machine_address_size: handle -> domid -> int -> unit
-  = "stub_xc_domain_set_machine_address_size"
-external domain_get_machine_address_size: handle -> domid -> int
-       = "stub_xc_domain_get_machine_address_size"
-
 external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
                         -> string option array
                         -> string option array
tools/ocaml/libs/xc/xenctrl_stubs.c +0 -26
index c4fdc58b2d..2e1b29ce33 100644
@@ -759,32 +759,6 @@ CAMLprim value stub_xc_domain_memory_increase_reservation(value xch,
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_set_machine_address_size(value xch,
-						       value domid,
-						       value width)
-{
-	CAMLparam3(xch, domid, width);
-	uint32_t c_domid = _D(domid);
-	int c_width = Int_val(width);
-
-	int retval = xc_domain_set_machine_address_size(_H(xch), c_domid, c_width);
-	if (retval)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_get_machine_address_size(value xch,
-                                                       value domid)
-{
-	CAMLparam2(xch, domid);
-	int retval;
-
-	retval = xc_domain_get_machine_address_size(_H(xch), _D(domid));
-	if (retval < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_int(retval));
-}
-
 CAMLprim value stub_xc_domain_cpuid_set(value xch, value domid,
                                         value input,
                                         value config)
tools/python/xen/lowlevel/xc/xc.c +0 -23
index 7e831a26a7..f0430ca85e 100644
@@ -770,22 +770,6 @@ static PyObject *pyxc_dom_set_cpuid(XcObject *self,
 
     return pyxc_create_cpuid_dict(regs_transform);
 }
-
-static PyObject *pyxc_dom_set_machine_address_size(XcObject *self,
-						   PyObject *args,
-						   PyObject *kwds)
-{
-    uint32_t dom, width;
-
-    if (!PyArg_ParseTuple(args, "ii", &dom, &width))
-	return NULL;
-
-    if (xc_domain_set_machine_address_size(self->xc_handle, dom, width) != 0)
-	return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
 #endif /* __i386__ || __x86_64__ */
 
 static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
@@ -2413,13 +2397,6 @@ static PyMethodDef pyxc_methods[] = {
       "Set the default cpuid policy for a domain.\n"
       " dom [int]: Identifier of domain.\n\n"
       "Returns: [int] 0 on success; exception on error.\n" },
-
-    { "domain_set_machine_address_size",
-      (PyCFunction)pyxc_dom_set_machine_address_size,
-      METH_VARARGS, "\n"
-      "Set maximum machine address size for this domain.\n"
-      " dom [int]: Identifier of domain.\n"
-      " width [int]: Maximum machine address width.\n" },
 #endif
 
     { "dom_set_memshr", 
xen/arch/x86/domctl.c +0 -12
index 34a6f88b8a..1e98fc8009 100644
@@ -643,18 +643,6 @@ long arch_do_domctl(
             ASSERT_UNREACHABLE();
         break;
 
-    case XEN_DOMCTL_set_machine_address_size:
-        if ( d->tot_pages > 0 )
-            ret = -EBUSY;
-        else
-            d->arch.physaddr_bitsize = domctl->u.address_size.size;
-        break;
-
-    case XEN_DOMCTL_get_machine_address_size:
-        domctl->u.address_size.size = d->arch.physaddr_bitsize;
-        copyback = true;
-        break;
-
     case XEN_DOMCTL_sendtrigger:
     {
         struct vcpu *v;
xen/include/public/domctl.h +2 -9
index 726ce675e8..72d5133cba 100644
@@ -691,13 +691,6 @@ struct xen_domctl_subscribe {
     uint32_t port; /* IN */
 };
 
-/*
- * Define the maximum machine address size which should be allocated
- * to a guest.
- */
-/* XEN_DOMCTL_set_machine_address_size */
-/* XEN_DOMCTL_get_machine_address_size */
-
 /* XEN_DOMCTL_debug_op */
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF         0
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON          1
@@ -1165,8 +1158,8 @@ struct xen_domctl {
 #define XEN_DOMCTL_unbind_pt_irq                 48
 #define XEN_DOMCTL_set_cpuid                     49
 #define XEN_DOMCTL_get_device_group              50
-#define XEN_DOMCTL_set_machine_address_size      51
-#define XEN_DOMCTL_get_machine_address_size      52
+/* #define XEN_DOMCTL_set_machine_address_size   51 - Obsolete */
+/* #define XEN_DOMCTL_get_machine_address_size   52 - Obsolete */
 /* #define XEN_DOMCTL_suppress_spurious_page_faults 53 - Obsolete */
 #define XEN_DOMCTL_debug_op                      54
 #define XEN_DOMCTL_gethvmcontext_partial         55
xen/xsm/flask/hooks.c +0 -2
index fd5ec992cf..6800f2d9a0 100644
@@ -684,11 +684,9 @@ static int flask_domctl(struct domain *d, int cmd)
         return current_has_perm(d, SECCLASS_HVM, HVM__GETHVMC);
 
     case XEN_DOMCTL_set_address_size:
-    case XEN_DOMCTL_set_machine_address_size:
         return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SETADDRSIZE);
 
     case XEN_DOMCTL_get_address_size:
-    case XEN_DOMCTL_get_machine_address_size:
         return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__GETADDRSIZE);
 
     case XEN_DOMCTL_mem_sharing_op:
xen/xsm/flask/policy/access_vectors +2 -2
index c9ebd0f37e..76f3d60ddd 100644
@@ -166,9 +166,9 @@ class domain
     set_target
 # SCHEDOP_remote_shutdown
     shutdown
-# XEN_DOMCTL_set{,_machine}_address_size
+# XEN_DOMCTL_set_address_size
     setaddrsize
-# XEN_DOMCTL_get{,_machine}_address_size
+# XEN_DOMCTL_get_address_size
     getaddrsize
 # XEN_DOMCTL_sendtrigger
     trigger
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/2 xen: Drop XEN_DOMCTL_suppress_spurious_page_faults

In reply to Andrew Cooper

This functionality is obsolete. It was introduced by c/s 39407bed9c0 into Xend, but never exposed in libxl.

While not explicitly limited to PV guests, this is PV-only by virtue of its position in the pagefault handler.

Looking though the XenServer templates, this was used to work around bugs in the 32bit RHEL/CentOS 4.{5..7} kernels (fixed in 4.8). RHEL 4 as a major version when out if support in 2017.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Daniel De Graaf <[email protected]>

---
 tools/libxc/include/xenctrl.h       |  3 ---
 tools/libxc/xc_domain.c             | 12 ------------
 tools/python/xen/lowlevel/xc/xc.c   | 22 ----------------------
 xen/arch/x86/domctl.c               |  4 ----
 xen/arch/x86/traps.c                | 14 --------------
 xen/include/asm-x86/domain.h        |  3 ---
 xen/include/public/domctl.h         |  7 +------
 xen/xsm/flask/hooks.c               |  1 -
 xen/xsm/flask/policy/access_vectors |  3 +--
 9 files changed, 2 insertions(+), 67 deletions(-)
tools/libxc/include/xenctrl.h +0 -3
index 0ff6ed9e70..a36896034a 100644
@@ -1787,9 +1787,6 @@ int xc_domain_set_machine_address_size(xc_interface *xch,
 int xc_domain_get_machine_address_size(xc_interface *xch,
 				       uint32_t domid);
 
-int xc_domain_suppress_spurious_page_faults(xc_interface *xch,
-					  uint32_t domid);
-
 /* Set the target domain */
 int xc_domain_set_target(xc_interface *xch,
                          uint32_t domid,
tools/libxc/xc_domain.c +0 -12
index 05d771f2ce..64ca513aae 100644
@@ -2190,18 +2190,6 @@ int xc_domain_get_machine_address_size(xc_interface *xch, uint32_t domid)
     return rc == 0 ? domctl.u.address_size.size : rc;
 }
 
-int xc_domain_suppress_spurious_page_faults(xc_interface *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);
-
-}
-
 int xc_domain_debug_control(xc_interface *xc, uint32_t domid, uint32_t sop, uint32_t vcpu)
 {
     DECLARE_DOMCTL;
tools/python/xen/lowlevel/xc/xc.c +0 -22
index 188bfa34da..7e831a26a7 100644
@@ -786,22 +786,6 @@ static PyObject *pyxc_dom_set_machine_address_size(XcObject *self,
     Py_INCREF(zero);
     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(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
 #endif /* __i386__ || __x86_64__ */
 
 static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
@@ -2436,12 +2420,6 @@ 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
 
     { "dom_set_memshr", 
xen/arch/x86/domctl.c +0 -4
index 2d45e5b8a8..34a6f88b8a 100644
@@ -988,10 +988,6 @@ long arch_do_domctl(
         }
         break;
 
-    case XEN_DOMCTL_suppress_spurious_page_faults:
-        d->arch.suppress_spurious_page_faults = 1;
-        break;
-
 #ifdef CONFIG_HVM
     case XEN_DOMCTL_debug_op:
     {
xen/arch/x86/traps.c +0 -14
index 23069e25ec..350903add5 100644
@@ -1452,20 +1452,6 @@ void do_page_fault(struct cpu_user_regs *regs)
               error_code, _p(addr));
     }
 
-    if ( unlikely(current->domain->arch.suppress_spurious_page_faults) )
-    {
-        pf_type = spurious_page_fault(addr, regs);
-        if ( (pf_type == smep_fault) || (pf_type == smap_fault))
-        {
-            printk(XENLOG_G_ERR "%pv fatal SM%cP violation\n",
-                   current, (pf_type == smep_fault) ? 'E' : 'A');
-
-            domain_crash(current->domain);
-        }
-        if ( pf_type != real_fault )
-            return;
-    }
-
     if ( unlikely(regs->error_code & PFEC_reserved_bit) )
         reserved_bit_page_fault(addr, regs);
 
xen/include/asm-x86/domain.h +0 -3
index 933b85901f..8523c3f5e0 100644
@@ -339,9 +339,6 @@ struct arch_domain
     /* 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;
-
     /* Is PHYSDEVOP_eoi to automatically unmask the event channel? */
     bool_t auto_unmask;
 
xen/include/public/domctl.h +1 -6
index 19486d5e32..726ce675e8 100644
@@ -698,11 +698,6 @@ struct xen_domctl_subscribe {
 /* XEN_DOMCTL_set_machine_address_size */
 /* XEN_DOMCTL_get_machine_address_size */
 
-/*
- * Do not inject spurious page faults into this domain.
- */
-/* XEN_DOMCTL_suppress_spurious_page_faults */
-
 /* XEN_DOMCTL_debug_op */
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF         0
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON          1
@@ -1172,7 +1167,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_get_device_group              50
 #define XEN_DOMCTL_set_machine_address_size      51
 #define XEN_DOMCTL_get_machine_address_size      52
-#define XEN_DOMCTL_suppress_spurious_page_faults 53
+/* #define XEN_DOMCTL_suppress_spurious_page_faults 53 - Obsolete */
 #define XEN_DOMCTL_debug_op                      54
 #define XEN_DOMCTL_gethvmcontext_partial         55
 #define XEN_DOMCTL_vm_event_op                   56
xen/xsm/flask/hooks.c +0 -1
index 791c1f66af..fd5ec992cf 100644
@@ -712,7 +712,6 @@ static int flask_domctl(struct domain *d, int cmd)
 
     case XEN_DOMCTL_subscribe:
     case XEN_DOMCTL_disable_migrate:
-    case XEN_DOMCTL_suppress_spurious_page_faults:
         return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SET_MISC_INFO);
 
     case XEN_DOMCTL_set_virq_handler:
xen/xsm/flask/policy/access_vectors +1 -2
index 194d743a71..c9ebd0f37e 100644
@@ -176,8 +176,7 @@ class domain
     getpodtarget
 # XENMEM_set_pod_target
     setpodtarget
-# XEN_DOMCTL_subscribe, XEN_DOMCTL_disable_migrate,
-# XEN_DOMCTL_suppress_spurious_page_faults
+# XEN_DOMCTL_subscribe, XEN_DOMCTL_disable_migrate
     set_misc_info
 # XEN_DOMCTL_set_virq_handler
     set_virq_handler
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/2
#2 lore raw

Re: [Xen-devel] [PATCH 1/2] xen: Drop XEN_DOMCTL_suppress_spurious_page_faults

Quoted 11 lines · Andrew Cooper

This functionality is obsolete. It was introduced by c/s 39407bed9c0 into Xend, but never exposed in libxl.

While not explicitly limited to PV guests, this is PV-only by virtue of its position in the pagefault handler.

Looking though the XenServer templates, this was used to work around bugs in the 32bit RHEL/CentOS 4.{5..7} kernels (fixed in 4.8). RHEL 4 as a major version when out if support in 2017.

Python part:

Also, I confirm it isn't used in Qubes OS.

Quoted 201 lines

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Daniel De Graaf <[email protected]>

---
 tools/libxc/include/xenctrl.h       |  3 ---
 tools/libxc/xc_domain.c             | 12 ------------
 tools/python/xen/lowlevel/xc/xc.c   | 22 ----------------------
 xen/arch/x86/domctl.c               |  4 ----
 xen/arch/x86/traps.c                | 14 --------------
 xen/include/asm-x86/domain.h        |  3 ---
 xen/include/public/domctl.h         |  7 +------
 xen/xsm/flask/hooks.c               |  1 -
 xen/xsm/flask/policy/access_vectors |  3 +--
 9 files changed, 2 insertions(+), 67 deletions(-)
tools/libxc/include/xenctrl.h +0 -3
index 0ff6ed9e70..a36896034a 100644
@@ -1787,9 +1787,6 @@ int xc_domain_set_machine_address_size(xc_interface *xch,
 int xc_domain_get_machine_address_size(xc_interface *xch,
 				       uint32_t domid);
 
-int xc_domain_suppress_spurious_page_faults(xc_interface *xch,
-					  uint32_t domid);
-
 /* Set the target domain */
 int xc_domain_set_target(xc_interface *xch,
                          uint32_t domid,
tools/libxc/xc_domain.c +0 -12
index 05d771f2ce..64ca513aae 100644
@@ -2190,18 +2190,6 @@ int xc_domain_get_machine_address_size(xc_interface *xch, uint32_t domid)
     return rc == 0 ? domctl.u.address_size.size : rc;
 }
 
-int xc_domain_suppress_spurious_page_faults(xc_interface *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);
-
-}
-
 int xc_domain_debug_control(xc_interface *xc, uint32_t domid, uint32_t sop, uint32_t vcpu)
 {
     DECLARE_DOMCTL;
tools/python/xen/lowlevel/xc/xc.c +0 -22
index 188bfa34da..7e831a26a7 100644
@@ -786,22 +786,6 @@ static PyObject *pyxc_dom_set_machine_address_size(XcObject *self,
     Py_INCREF(zero);
     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(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
 #endif /* __i386__ || __x86_64__ */
 
 static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
@@ -2436,12 +2420,6 @@ 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
 
     { "dom_set_memshr", 
xen/arch/x86/domctl.c +0 -4
index 2d45e5b8a8..34a6f88b8a 100644
@@ -988,10 +988,6 @@ long arch_do_domctl(
         }
         break;
 
-    case XEN_DOMCTL_suppress_spurious_page_faults:
-        d->arch.suppress_spurious_page_faults = 1;
-        break;
-
 #ifdef CONFIG_HVM
     case XEN_DOMCTL_debug_op:
     {
xen/arch/x86/traps.c +0 -14
index 23069e25ec..350903add5 100644
@@ -1452,20 +1452,6 @@ void do_page_fault(struct cpu_user_regs *regs)
               error_code, _p(addr));
     }
 
-    if ( unlikely(current->domain->arch.suppress_spurious_page_faults) )
-    {
-        pf_type = spurious_page_fault(addr, regs);
-        if ( (pf_type == smep_fault) || (pf_type == smap_fault))
-        {
-            printk(XENLOG_G_ERR "%pv fatal SM%cP violation\n",
-                   current, (pf_type == smep_fault) ? 'E' : 'A');
-
-            domain_crash(current->domain);
-        }
-        if ( pf_type != real_fault )
-            return;
-    }
-
     if ( unlikely(regs->error_code & PFEC_reserved_bit) )
         reserved_bit_page_fault(addr, regs);
 
xen/include/asm-x86/domain.h +0 -3
index 933b85901f..8523c3f5e0 100644
@@ -339,9 +339,6 @@ struct arch_domain
     /* 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;
-
     /* Is PHYSDEVOP_eoi to automatically unmask the event channel? */
     bool_t auto_unmask;
 
xen/include/public/domctl.h +1 -6
index 19486d5e32..726ce675e8 100644
@@ -698,11 +698,6 @@ struct xen_domctl_subscribe {
 /* XEN_DOMCTL_set_machine_address_size */
 /* XEN_DOMCTL_get_machine_address_size */
 
-/*
- * Do not inject spurious page faults into this domain.
- */
-/* XEN_DOMCTL_suppress_spurious_page_faults */
-
 /* XEN_DOMCTL_debug_op */
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF         0
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON          1
@@ -1172,7 +1167,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_get_device_group              50
 #define XEN_DOMCTL_set_machine_address_size      51
 #define XEN_DOMCTL_get_machine_address_size      52
-#define XEN_DOMCTL_suppress_spurious_page_faults 53
+/* #define XEN_DOMCTL_suppress_spurious_page_faults 53 - Obsolete */
 #define XEN_DOMCTL_debug_op                      54
 #define XEN_DOMCTL_gethvmcontext_partial         55
 #define XEN_DOMCTL_vm_event_op                   56
xen/xsm/flask/hooks.c +0 -1
index 791c1f66af..fd5ec992cf 100644
@@ -712,7 +712,6 @@ static int flask_domctl(struct domain *d, int cmd)
 
     case XEN_DOMCTL_subscribe:
     case XEN_DOMCTL_disable_migrate:
-    case XEN_DOMCTL_suppress_spurious_page_faults:
         return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SET_MISC_INFO);
 
     case XEN_DOMCTL_set_virq_handler:
xen/xsm/flask/policy/access_vectors +1 -2
index 194d743a71..c9ebd0f37e 100644
@@ -176,8 +176,7 @@ class domain
     getpodtarget
 # XENMEM_set_pod_target
     setpodtarget
-# XEN_DOMCTL_subscribe, XEN_DOMCTL_disable_migrate,
-# XEN_DOMCTL_suppress_spurious_page_faults
+# XEN_DOMCTL_subscribe, XEN_DOMCTL_disable_migrate
     set_misc_info
 # XEN_DOMCTL_set_virq_handler
     set_virq_handler
Signature · 5 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 2/2
#6 lore raw

Re: [Xen-devel] [PATCH 2/2] xen: Drop XEN_DOMCTL_{get, set}_machine_address_size

In reply to Andrew Cooper
Quoted 5 lines · Andrew Cooper

This functionality is obsolete. It was introduced by c/s 41296317a31 into Xend, but was never exposed in libxl.

Nothing limits this to PV guests, but it makes no sense for HVM guests.

Quoted 7 lines

Looking through the XenServer templates, this was used to work around bugs in the 32bit RHEL/CentOS 4.7 and 4.8 kernels (fixed in 4.9) and RHEL/CentOS/OEL 5.2 and 5.3 kernels (fixed in 5.4). RHEL 4 as a major version went out of support in 2017, whereas the 5.2/5.3 kernels went out of support when 5.4 was released in 2009.

Python part:

Also, I confirm it isn't used in Qubes OS.

Quoted 277 lines

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Ian Jackson <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Daniel De Graaf <[email protected]>
CC: Christian Lindig <[email protected]>
CC: Rob Hoes <[email protected]>

There may be some resulting simplifications which can be made to the heap allocator, but that involves untangling the other address clamping logic first.

---
 tools/libxc/include/xenctrl.h       |  6 ------
 tools/libxc/xc_domain.c             | 29 -----------------------------
 tools/ocaml/libs/xc/xenctrl.ml      |  5 -----
 tools/ocaml/libs/xc/xenctrl.mli     |  5 -----
 tools/ocaml/libs/xc/xenctrl_stubs.c | 26 --------------------------
 tools/python/xen/lowlevel/xc/xc.c   | 23 -----------------------
 xen/arch/x86/domctl.c               | 12 ------------
 xen/include/public/domctl.h         | 11 ++---------
 xen/xsm/flask/hooks.c               |  2 --
 xen/xsm/flask/policy/access_vectors |  4 ++--
 10 files changed, 4 insertions(+), 119 deletions(-)
tools/libxc/include/xenctrl.h +0 -6
index a36896034a..c92386aab8 100644
@@ -1781,12 +1781,6 @@ int xc_domain_unbind_pt_spi_irq(xc_interface *xch,
                                 uint16_t vspi,
                                 uint16_t spi);
 
-int xc_domain_set_machine_address_size(xc_interface *xch,
-				       uint32_t domid,
-				       unsigned int width);
-int xc_domain_get_machine_address_size(xc_interface *xch,
-				       uint32_t domid);
-
 /* Set the target domain */
 int xc_domain_set_target(xc_interface *xch,
                          uint32_t domid,
tools/libxc/xc_domain.c +0 -29
index 64ca513aae..e544218d2e 100644
@@ -2161,35 +2161,6 @@ int xc_domain_subscribe_for_suspend(
     return do_domctl(xch, &domctl);
 }
 
-int xc_domain_set_machine_address_size(xc_interface *xch,
-                                       uint32_t domid,
-                                       unsigned int width)
-{
-    DECLARE_DOMCTL;
-
-    memset(&domctl, 0, sizeof(domctl));
-    domctl.domain = domid;
-    domctl.cmd    = XEN_DOMCTL_set_machine_address_size;
-    domctl.u.address_size.size = width;
-
-    return do_domctl(xch, &domctl);
-}
-
-
-int xc_domain_get_machine_address_size(xc_interface *xch, uint32_t domid)
-{
-    DECLARE_DOMCTL;
-    int rc;
-
-    memset(&domctl, 0, sizeof(domctl));
-    domctl.domain = domid;
-    domctl.cmd    = XEN_DOMCTL_get_machine_address_size;
-
-    rc = do_domctl(xch, &domctl);
-
-    return rc == 0 ? domctl.u.address_size.size : rc;
-}
-
 int xc_domain_debug_control(xc_interface *xc, uint32_t domid, uint32_t sop, uint32_t vcpu)
 {
     DECLARE_DOMCTL;
tools/ocaml/libs/xc/xenctrl.ml +0 -5
index a57130a3c3..35958b94d5 100644
@@ -241,11 +241,6 @@ external domain_set_memmap_limit: handle -> domid -> int64 -> unit
 external domain_memory_increase_reservation: handle -> domid -> int64 -> unit
        = "stub_xc_domain_memory_increase_reservation"
 
-external domain_set_machine_address_size: handle -> domid -> int -> unit
-       = "stub_xc_domain_set_machine_address_size"
-external domain_get_machine_address_size: handle -> domid -> int
-       = "stub_xc_domain_get_machine_address_size"
-
 external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
                         -> string option array
                         -> string option array
tools/ocaml/libs/xc/xenctrl.mli +0 -5
index 476bbecb90..6c4268d453 100644
@@ -202,11 +202,6 @@ val pages_to_mib : int64 -> int64
 external watchdog : handle -> int -> int32 -> int
   = "stub_xc_watchdog"
 
-external domain_set_machine_address_size: handle -> domid -> int -> unit
-  = "stub_xc_domain_set_machine_address_size"
-external domain_get_machine_address_size: handle -> domid -> int
-       = "stub_xc_domain_get_machine_address_size"
-
 external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
                         -> string option array
                         -> string option array
tools/ocaml/libs/xc/xenctrl_stubs.c +0 -26
index c4fdc58b2d..2e1b29ce33 100644
@@ -759,32 +759,6 @@ CAMLprim value stub_xc_domain_memory_increase_reservation(value xch,
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_set_machine_address_size(value xch,
-						       value domid,
-						       value width)
-{
-	CAMLparam3(xch, domid, width);
-	uint32_t c_domid = _D(domid);
-	int c_width = Int_val(width);
-
-	int retval = xc_domain_set_machine_address_size(_H(xch), c_domid, c_width);
-	if (retval)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_get_machine_address_size(value xch,
-                                                       value domid)
-{
-	CAMLparam2(xch, domid);
-	int retval;
-
-	retval = xc_domain_get_machine_address_size(_H(xch), _D(domid));
-	if (retval < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_int(retval));
-}
-
 CAMLprim value stub_xc_domain_cpuid_set(value xch, value domid,
                                         value input,
                                         value config)
tools/python/xen/lowlevel/xc/xc.c +0 -23
index 7e831a26a7..f0430ca85e 100644
@@ -770,22 +770,6 @@ static PyObject *pyxc_dom_set_cpuid(XcObject *self,
 
     return pyxc_create_cpuid_dict(regs_transform);
 }
-
-static PyObject *pyxc_dom_set_machine_address_size(XcObject *self,
-						   PyObject *args,
-						   PyObject *kwds)
-{
-    uint32_t dom, width;
-
-    if (!PyArg_ParseTuple(args, "ii", &dom, &width))
-	return NULL;
-
-    if (xc_domain_set_machine_address_size(self->xc_handle, dom, width) != 0)
-	return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
 #endif /* __i386__ || __x86_64__ */
 
 static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
@@ -2413,13 +2397,6 @@ static PyMethodDef pyxc_methods[] = {
       "Set the default cpuid policy for a domain.\n"
       " dom [int]: Identifier of domain.\n\n"
       "Returns: [int] 0 on success; exception on error.\n" },
-
-    { "domain_set_machine_address_size",
-      (PyCFunction)pyxc_dom_set_machine_address_size,
-      METH_VARARGS, "\n"
-      "Set maximum machine address size for this domain.\n"
-      " dom [int]: Identifier of domain.\n"
-      " width [int]: Maximum machine address width.\n" },
 #endif
 
     { "dom_set_memshr", 
xen/arch/x86/domctl.c +0 -12
index 34a6f88b8a..1e98fc8009 100644
@@ -643,18 +643,6 @@ long arch_do_domctl(
             ASSERT_UNREACHABLE();
         break;
 
-    case XEN_DOMCTL_set_machine_address_size:
-        if ( d->tot_pages > 0 )
-            ret = -EBUSY;
-        else
-            d->arch.physaddr_bitsize = domctl->u.address_size.size;
-        break;
-
-    case XEN_DOMCTL_get_machine_address_size:
-        domctl->u.address_size.size = d->arch.physaddr_bitsize;
-        copyback = true;
-        break;
-
     case XEN_DOMCTL_sendtrigger:
     {
         struct vcpu *v;
xen/include/public/domctl.h +2 -9
index 726ce675e8..72d5133cba 100644
@@ -691,13 +691,6 @@ struct xen_domctl_subscribe {
     uint32_t port; /* IN */
 };
 
-/*
- * Define the maximum machine address size which should be allocated
- * to a guest.
- */
-/* XEN_DOMCTL_set_machine_address_size */
-/* XEN_DOMCTL_get_machine_address_size */
-
 /* XEN_DOMCTL_debug_op */
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF         0
 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON          1
@@ -1165,8 +1158,8 @@ struct xen_domctl {
 #define XEN_DOMCTL_unbind_pt_irq                 48
 #define XEN_DOMCTL_set_cpuid                     49
 #define XEN_DOMCTL_get_device_group              50
-#define XEN_DOMCTL_set_machine_address_size      51
-#define XEN_DOMCTL_get_machine_address_size      52
+/* #define XEN_DOMCTL_set_machine_address_size   51 - Obsolete */
+/* #define XEN_DOMCTL_get_machine_address_size   52 - Obsolete */
 /* #define XEN_DOMCTL_suppress_spurious_page_faults 53 - Obsolete */
 #define XEN_DOMCTL_debug_op                      54
 #define XEN_DOMCTL_gethvmcontext_partial         55
xen/xsm/flask/hooks.c +0 -2
index fd5ec992cf..6800f2d9a0 100644
@@ -684,11 +684,9 @@ static int flask_domctl(struct domain *d, int cmd)
         return current_has_perm(d, SECCLASS_HVM, HVM__GETHVMC);
 
     case XEN_DOMCTL_set_address_size:
-    case XEN_DOMCTL_set_machine_address_size:
         return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SETADDRSIZE);
 
     case XEN_DOMCTL_get_address_size:
-    case XEN_DOMCTL_get_machine_address_size:
         return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__GETADDRSIZE);
 
     case XEN_DOMCTL_mem_sharing_op:
xen/xsm/flask/policy/access_vectors +2 -2
index c9ebd0f37e..76f3d60ddd 100644
@@ -166,9 +166,9 @@ class domain
     set_target
 # SCHEDOP_remote_shutdown
     shutdown
-# XEN_DOMCTL_set{,_machine}_address_size
+# XEN_DOMCTL_set_address_size
     setaddrsize
-# XEN_DOMCTL_get{,_machine}_address_size
+# XEN_DOMCTL_get_address_size
     getaddrsize
 # XEN_DOMCTL_sendtrigger
     trigger
Signature · 5 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v1 2/2
#7 lore raw

Re: [Xen-devel] [PATCH 2/2] xen: Drop XEN_DOMCTL_{get, set}_machine_address_size

In reply to Andrew Cooper
Quoted 9 lines · Andrew Cooper

This functionality is obsolete. It was introduced by c/s 41296317a31 into Xend, but was never exposed in libxl.

Nothing limits this to PV guests, but it makes no sense for HVM guests.

Quoted 8 lines

Looking through the XenServer templates, this was used to work around bugs in the 32bit RHEL/CentOS 4.7 and 4.8 kernels (fixed in 4.9) and RHEL/CentOS/OEL 5.2 and 5.3 kernels (fixed in 5.4). RHEL 4 as a major version went out of support in 2017, whereas the 5.2/5.3 kernels went out of support when 5.4 was released in 2009.

---

tools/ocaml/libs/xc/xenctrl.ml      |  5 -----
tools/ocaml/libs/xc/xenctrl.mli     |  5 -----
tools/ocaml/libs/xc/xenctrl_stubs.c | 26 —————————————

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on the v1 series
#9 lore raw
In reply to Andrew Cooper
Quoted 6 lines · Andrew Cooper

These domctls exist to work around bugs in obsolete 32bit PV guests. They are no longer useful.

Andrew Cooper (2):
xen: Drop XEN_DOMCTL_suppress_spurious_page_faults
xen: Drop XEN_DOMCTL_{get,set}_machine_address_size

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 1/2
#3 lore raw

Re: [Xen-devel] [PATCH 1/2] xen: Drop XEN_DOMCTL_suppress_spurious_page_faults

In reply to Andrew Cooper
Quoted 2 lines · Andrew Cooper

This functionality is obsolete. It was introduced by c/s 39407bed9c0 into Xend, but never exposed in libxl.

This is good enough a reason I think (hope), while ...

Quoted 6 lines

While not explicitly limited to PV guests, this is PV-only by virtue of its position in the pagefault handler.

Looking though the XenServer templates, this was used to work around bugs in the 32bit RHEL/CentOS 4.{5..7} kernels (fixed in 4.8). RHEL 4 as a major version when out if support in 2017.

... I wouldn't accept this as justification, since people are free to use out-of-support software for as long as they wish.

Quoted 1 line

Hypervisor parts

with one further suggestion:

Quoted 9 lines
xen/arch/x86/traps.c +0 -3
@@ -1452,20 +1452,6 @@ void do_page_fault(struct cpu_user_regs *regs)
                error_code, _p(addr));
      }
 
-    if ( unlikely(current->domain->arch.suppress_spurious_page_faults) )
-    {
-        pf_type = spurious_page_fault(addr, regs);

xen/arch/x86/traps.c void do_page_fault(struct cpu_user_regs *regs) · line 1467

Quoted 10 lines
xen/arch/x86/traps.c +0 -10
-        if ( (pf_type == smep_fault) || (pf_type == smap_fault))
-        {
-            printk(XENLOG_G_ERR "%pv fatal SM%cP violation\n",
-                   current, (pf_type == smep_fault) ? 'E' : 'A');
-
-            domain_crash(current->domain);
-        }
-        if ( pf_type != real_fault )
-            return;
-    }

You may want to consider reducing pf_type's scope at the same time.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v1 2/2
#8 lore raw

Re: [Xen-devel] [PATCH 2/2] xen: Drop XEN_DOMCTL_{get, set}_machine_address_size

In reply to Andrew Cooper
Quoted 5 lines · Andrew Cooper

This functionality is obsolete. It was introduced by c/s 41296317a31 into Xend, but was never exposed in libxl.

Nothing limits this to PV guests, but it makes no sense for HVM guests.

Quoted 7 lines

Looking through the XenServer templates, this was used to work around bugs in the 32bit RHEL/CentOS 4.7 and 4.8 kernels (fixed in 4.9) and RHEL/CentOS/OEL 5.2 and 5.3 kernels (fixed in 5.4). RHEL 4 as a major version went out of support in 2017, whereas the 5.2/5.3 kernels went out of support when 5.4 was released in 2009.

I find it a little surprising that we've got away without this being hooked up in libxl. Anyway, x86 hypervisor parts

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Re: [Xen-devel] [PATCH 1/2] xen: Drop XEN_DOMCTL_suppress_spurious_page_faults

In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 3 lines · Andrew Cooper

This functionality is obsolete.  It was introduced by c/s 39407bed9c0 into
Xend, but never exposed in libxl.

This is good enough a reason I think (hope), while ...

Quoted 4 lines

While not explicitly limited to PV guests, this is PV-only by virtue of its
position in the pagefault handler.

Quoted 7 lines
Quoted 5 lines

Looking though the XenServer templates, this was used to work around bugs in
the 32bit RHEL/CentOS 4.{5..7} kernels (fixed in 4.8).  RHEL 4 as a major
version when out if support in 2017.

... I wouldn't accept this as justification,

I'd be approaching this differently if support were in libxl, but...

Quoted 2 lines

since people are
free to use out-of-support software for as long as they wish.

... there are a lot of very good reasons not to keep on using out-of-support software.  A recent example is the WannaCry outbreak which spread in part due to the still-prolific use of Windows XP.

Furthermore, people running kernels which are that obsolete will also be running similarly-obsolete versions of Xen, so this change isn't going to affect them.

Quoted 5 lines
Quoted 2 lines

Hypervisor parts

Thanks,

Quoted 16 lines

with one further suggestion:

Quoted 14 lines
xen/arch/x86/traps.c +0 -0
@@ -1452,20 +1452,6 @@ void do_page_fault(struct cpu_user_regs *regs)
                 error_code, _p(addr));
       }

  -    if ( unlikely(current->domain->arch.suppress_spurious_page_faults) ) -    {
-        pf_type = spurious_page_fault(addr, regs);
-        if ( (pf_type == smep_fault) || (pf_type == smap_fault)) -        {
-            printk(XENLOG_G_ERR "%pv fatal SM%cP violation\n", -                   current, (pf_type == smep_fault) ? 'E' : 'A'); -

Quoted 8 lines
Quoted 5 lines

-            domain_crash(current->domain);
-        }
-        if ( pf_type != real_fault )
-            return;
-    }

You may want to consider reducing pf_type's scope at the same time.

This isn't too much of a change, so I've included it.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel