From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: [PATCH v2 2/3] tools/libxc: Use an explicit check for PV MSRs in xc_domain_save() Date: Fri, 6 Jun 2014 18:18:30 +0100 Message-ID: <1402075111-28286-3-git-send-email-andrew.cooper3@citrix.com> References: <1402075111-28286-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1402075111-28286-1-git-send-email-andrew.cooper3@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: Xen-devel Cc: Andrew Cooper , Ian Jackson , Ian Campbell , Jan Beulich List-Id: xen-devel@lists.xenproject.org Migrating PV domains using MSRs is not supported. This uses the new XEN_DOMCTL_get_vcpu_msrs and will fail the migration with an explicit error. This is an improvement upon the current failure of "No extended context for VCPUxx (ENOBUFS)" Support for migrating PV domains which are using MSRs will be included in the migration v2 work. Signed-off-by: Andrew Cooper CC: Jan Beulich CC: Ian Campbell CC: Ian Jackson -- v2: Reduce code based on altered Xen implementation --- tools/libxc/xc_domain_save.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index acf3685..778cbde 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -1995,6 +1995,26 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter goto out; } + /* Check there are no PV MSRs in use. */ + domctl.cmd = XEN_DOMCTL_get_vcpu_msrs; + domctl.domain = dom; + memset(&domctl.u, 0, sizeof(domctl.u)); + domctl.u.vcpu_msrs.vcpu = i; + domctl.u.vcpu_msrs.msr_count = 0; + set_xen_guest_handle_raw(domctl.u.vcpu_msrs.msrs, (void*)1); + + if ( xc_domctl(xch, &domctl) < 0 ) + { + if ( errno == ENOBUFS ) + { + errno = EOPNOTSUPP; + PERROR("Unable to migrate PV guest using MSRs (yet)"); + } + else + PERROR("Error querying maximum number of MSRs for VCPU%d", i); + goto out; + } + /* Start to fetch CPU eXtended States */ /* Get buffer size first */ domctl.cmd = XEN_DOMCTL_getvcpuextstate; -- 1.7.10.4