Skip to content

Commit

Permalink
tools: Delete XEN_DOMCTL_disable_migrate
Browse files Browse the repository at this point in the history
It is conceptually wrong for this information to exist in the hypervisor in
the first place.  Only the toolstack is capable of correctly reasoning about
the non-migrateability of guests.

This hypercall has only ever existed to control the visibility of the
Invariant TSC flag to the guest.  Now that we have properly disentanged that
and moved ITSC into the guests CPUID policy, delete this hypercall.

Furthermore, this fixes a corner case where Xen would override the toolstacks
choice of ITSC for a xenstore stubdomain.  That said, init-xenstore-domain
doesn't currently ask for ITSC, and MiniOS doesn't know what ITSC is either,
so nothing actually changes in practice.

Bump the DOMCTL_INTERFACE_VERSION for 4.15

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
  • Loading branch information
andyhhp committed Sep 18, 2020
1 parent c729d54 commit baa4d06
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 64 deletions.
2 changes: 0 additions & 2 deletions tools/libs/ctrl/include/xenctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1351,8 +1351,6 @@ int xc_domain_get_tsc_info(xc_interface *xch,
uint32_t *gtsc_khz,
uint32_t *incarnation);

int xc_domain_disable_migrate(xc_interface *xch, uint32_t domid);

int xc_domain_maximum_gpfn(xc_interface *xch, uint32_t domid, xen_pfn_t *gpfns);

int xc_domain_nr_gpfns(xc_interface *xch, uint32_t domid, xen_pfn_t *gpfns);
Expand Down
9 changes: 0 additions & 9 deletions tools/libs/ctrl/xc_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,15 +815,6 @@ int xc_domain_set_time_offset(xc_interface *xch,
return do_domctl(xch, &domctl);
}

int xc_domain_disable_migrate(xc_interface *xch, uint32_t domid)
{
DECLARE_DOMCTL;
domctl.cmd = XEN_DOMCTL_disable_migrate;
domctl.domain = domid;
domctl.u.disable_migrate.disable = 1;
return do_domctl(xch, &domctl);
}

int xc_domain_set_tsc_info(xc_interface *xch,
uint32_t domid,
uint32_t tsc_mode,
Expand Down
6 changes: 0 additions & 6 deletions tools/libxl/libxl_dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,6 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
return ERROR_FAIL;
}

if (libxl_defbool_val(d_config->b_info.disable_migrate) &&
xc_domain_disable_migrate(ctx->xch, domid) != 0) {
LOG(ERROR, "Couldn't set nomigrate");
return ERROR_FAIL;
}

/*
* Check if the domain has any CPU or node affinity already. If not, try
* to build up the latter via automatic NUMA placement. In fact, in case
Expand Down
21 changes: 0 additions & 21 deletions tools/python/xen/lowlevel/xc/xc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,20 +1469,6 @@ static PyObject *pyxc_domain_set_tsc_info(XcObject *self, PyObject *args)
return zero;
}

static PyObject *pyxc_domain_disable_migrate(XcObject *self, PyObject *args)
{
uint32_t dom;

if (!PyArg_ParseTuple(args, "i", &dom))
return NULL;

if (xc_domain_disable_migrate(self->xc_handle, dom) != 0)
return pyxc_error_to_exception(self->xc_handle);

Py_INCREF(zero);
return zero;
}

static PyObject *pyxc_domain_send_trigger(XcObject *self,
PyObject *args,
PyObject *kwds)
Expand Down Expand Up @@ -2306,13 +2292,6 @@ static PyMethodDef pyxc_methods[] = {
" 1=always emulate 2=never emulate\n"
"Returns: [int] 0 on success; -1 on error.\n" },

{ "domain_disable_migrate",
(PyCFunction)pyxc_domain_disable_migrate,
METH_VARARGS, "\n"
"Marks domain as non-migratable AND non-restoreable\n"
" dom [int]: Domain whose TSC mode is being set.\n"
"Returns: [int] 0 on success; -1 on error.\n" },

{ "domain_send_trigger",
(PyCFunction)pyxc_domain_send_trigger,
METH_VARARGS | METH_KEYWORDS, "\n"
Expand Down
4 changes: 0 additions & 4 deletions xen/arch/arm/domctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
return 0;
}

case XEN_DOMCTL_disable_migrate:
d->disable_migrate = domctl->u.disable_migrate.disable;
return 0;

case XEN_DOMCTL_vuart_op:
{
int rc;
Expand Down
3 changes: 2 additions & 1 deletion xen/arch/x86/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,8 @@ int init_domain_cpuid_policy(struct domain *d)
if ( !p )
return -ENOMEM;

if ( d->disable_migrate )
/* The hardware domain can't migrate. Give it ITSC if available. */
if ( is_hardware_domain(d) )
p->extd.itsc = cpu_has_itsc;

/*
Expand Down
5 changes: 0 additions & 5 deletions xen/arch/x86/domctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,11 +1277,6 @@ long arch_do_domctl(

break;

case XEN_DOMCTL_disable_migrate:
d->disable_migrate = domctl->u.disable_migrate.disable;
recalculate_cpuid_policy(d);
break;

case XEN_DOMCTL_get_cpu_policy:
/* Process the CPUID leaves. */
if ( guest_handle_is_null(domctl->u.cpu_policy.cpuid_policy) )
Expand Down
4 changes: 0 additions & 4 deletions xen/common/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ struct domain *domain_create(domid_t domid,
if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED )
panic("The value of hardware_dom must be a valid domain ID\n");

d->disable_migrate = true;
old_hwdom = hardware_domain;
hardware_domain = d;
}
Expand Down Expand Up @@ -452,9 +451,6 @@ struct domain *domain_create(domid_t domid,
watchdog_domain_init(d);
init_status |= INIT_watchdog;

if ( is_xenstore_domain(d) )
d->disable_migrate = true;

d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
d->irq_caps = rangeset_new(d, "Interrupts", 0);
if ( !d->iomem_caps || !d->irq_caps )
Expand Down
10 changes: 2 additions & 8 deletions xen/include/public/domctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "hvm/save.h"
#include "memory.h"

#define XEN_DOMCTL_INTERFACE_VERSION 0x00000012
#define XEN_DOMCTL_INTERFACE_VERSION 0x00000013

/*
* NB. xen_domctl.domain is an IN/OUT parameter for this operation.
Expand Down Expand Up @@ -730,11 +730,6 @@ struct xen_domctl_hvmcontext_partial {
XEN_GUEST_HANDLE_64(uint8) buffer; /* OUT: buffer to write record into */
};

/* XEN_DOMCTL_disable_migrate */
struct xen_domctl_disable_migrate {
uint32_t disable; /* IN: 1: disable migration and restore */
};


/* XEN_DOMCTL_gettscinfo */
/* XEN_DOMCTL_settscinfo */
Expand Down Expand Up @@ -1191,7 +1186,7 @@ struct xen_domctl {
#define XEN_DOMCTL_gethvmcontext_partial 55
#define XEN_DOMCTL_vm_event_op 56
#define XEN_DOMCTL_mem_sharing_op 57
#define XEN_DOMCTL_disable_migrate 58
/* #define XEN_DOMCTL_disable_migrate 58 - Obsolete */
#define XEN_DOMCTL_gettscinfo 59
#define XEN_DOMCTL_settscinfo 60
#define XEN_DOMCTL_getpageframeinfo3 61
Expand Down Expand Up @@ -1242,7 +1237,6 @@ struct xen_domctl {
struct xen_domctl_ioport_permission ioport_permission;
struct xen_domctl_hypercall_init hypercall_init;
struct xen_domctl_settimeoffset settimeoffset;
struct xen_domctl_disable_migrate disable_migrate;
struct xen_domctl_tsc_info tsc_info;
struct xen_domctl_hvmcontext hvmcontext;
struct xen_domctl_hvmcontext_partial hvmcontext_partial;
Expand Down
2 changes: 0 additions & 2 deletions xen/include/xen/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@ struct domain
bool is_privileged;
/* Can this guest access the Xen console? */
bool is_console;
/* Non-migratable and non-restoreable? */
bool disable_migrate;
/* Is this guest being debugged by dom0? */
bool debugger_attached;
/*
Expand Down
1 change: 0 additions & 1 deletion xen/xsm/flask/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,6 @@ static int flask_domctl(struct domain *d, int cmd)
return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SETDEBUGGING);

case XEN_DOMCTL_subscribe:
case XEN_DOMCTL_disable_migrate:
return current_has_perm(d, SECCLASS_DOMAIN, DOMAIN__SET_MISC_INFO);

case XEN_DOMCTL_set_virq_handler:
Expand Down
2 changes: 1 addition & 1 deletion xen/xsm/flask/policy/access_vectors
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class domain
getpodtarget
# XENMEM_set_pod_target
setpodtarget
# XEN_DOMCTL_subscribe, XEN_DOMCTL_disable_migrate
# XEN_DOMCTL_subscribe
set_misc_info
# XEN_DOMCTL_set_virq_handler
set_virq_handler
Expand Down

0 comments on commit baa4d06

Please sign in to comment.