From: Wei Liu Subject: Re: [PATCH for 4.6 v4 2/3] xl/libxl: disallow saving a guest with vNUMA configured Date: Fri, 11 Sep 2015 15:31:49 +0100 Message-ID: <20150911143149.GO1695@zion.uk.xensource.com> References: <1441979409-3064-1-git-send-email-wei.liu2@citrix.com> <1441979409-3064-3-git-send-email-wei.liu2@citrix.com> <1441980035.3549.41.camel@citrix.com> <20150911141415.GN1695@zion.uk.xensource.com> <1441981461.3549.54.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZaPZx-0001QU-1X for xen-devel@lists.xenproject.org; Fri, 11 Sep 2015 14:45:29 +0000 Content-Disposition: inline In-Reply-To: <1441981461.3549.54.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Xen-devel , Wei Liu , Ian Jackson , andrew.cooper3@citrix.com List-Id: xen-devel@lists.xenproject.org On Fri, Sep 11, 2015 at 03:24:21PM +0100, Ian Campbell wrote: > On Fri, 2015-09-11 at 15:14 +0100, Wei Liu wrote: > @@ -1636,6 +1638,20 @@ void libxl__domain_save(libxl__egc *egc, > > libxl__domain_suspend_state *dss) > > | (debug ? XCFLAGS_DEBUG : 0) > > | (dss->hvm ? XCFLAGS_HVM : 0); > > > > + /* Disallow saving a guest with vNUMA configured because migration > > + * stream does not preserve node information. > > + * > > + * Do not differentiate "no vnuma configuration" from "empty vnuma > > + * configuration". > > + */ > > + rc = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes, &nr_vmemranges, > > + &nr_vcpus, NULL, NULL, NULL); > > Sorry for not noticing this before but this is putting a non-libxl error > code in a variable named rc, which is verboten in coding style. > My bad. Should have noticed that earlier. > Not least because I think it is now possible to get through this function > successfully without changing it from the rc == -1 which might be assigned > here (in the case where xs_suspend_evtchn_port returns < 0). > > Ian. Add a new variable called ret to store return value from xc function call. Here is the patch. ---8<--- >From c2e9567fa0c5a00405d3759321c9eefb8ec049fc Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Wed, 9 Sep 2015 17:11:24 +0100 Subject: [PATCH] xl/libxl: disallow saving a guest with vNUMA configured This is because the migration stream does not preserve node information. Note this is not a regression for migration v2 vs legacy migration because neither of them preserves node information. Signed-off-by: Wei Liu --- Cc: andrew.cooper3@citrix.com v4: 1. Don't differentiate "no vnuma" from "empty vnuma". 2. Use ret to store xc function call return value. v3: 1. Update manpage, code comment and commit message. 2. *Don't* check if nomigrate is set. --- docs/man/xl.cfg.pod.5 | 2 ++ tools/libxl/libxl_dom.c | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index c6345b8..157c855 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -263,6 +263,8 @@ virtual node. Note that virtual NUMA for PV guest is not yet supported, because there is an issue with cpuid handling that affects PV virtual NUMA. +Further more, guest with virtual NUMA cannot be saved or migrated +because migration stream does not preserve node information. Each B is a list, which has a form of "[VNODE_CONFIG_OPTION,VNODE_CONFIG_OPTION, ... ]" (without quotes). diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index c2518a3..905dc5a 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -24,6 +24,7 @@ #include #include #include +#include libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid) { @@ -1602,7 +1603,7 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) { STATE_AO_GC(dss->ao); int port; - int rc; + int rc, ret; /* Convenience aliases */ const uint32_t domid = dss->domid; @@ -1612,6 +1613,7 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) const libxl_domain_remus_info *const r_info = dss->remus; libxl__srm_save_autogen_callbacks *const callbacks = &dss->sws.shs.callbacks.save.a; + unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0; dss->rc = 0; logdirty_init(&dss->logdirty); @@ -1636,6 +1638,20 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) | (debug ? XCFLAGS_DEBUG : 0) | (dss->hvm ? XCFLAGS_HVM : 0); + /* Disallow saving a guest with vNUMA configured because migration + * stream does not preserve node information. + * + * Do not differentiate "no vnuma configuration" from "empty vnuma + * configuration". + */ + ret = xc_domain_getvnuma(CTX->xch, domid, &nr_vnodes, &nr_vmemranges, + &nr_vcpus, NULL, NULL, NULL); + if (ret != -1 || errno != XEN_EOPNOTSUPP) { + LOG(ERROR, "Cannot save a guest with vNUMA configured"); + rc = ERROR_FAIL; + goto out; + } + dss->guest_evtchn.port = -1; dss->guest_evtchn_lockfd = -1; dss->guest_responded = 0; -- 2.1.4