From: "Jan Beulich" Subject: Re: [PATCH 2/4] tools/libxc: Use an explicit check for PV MSRs in xc_domain_save() Date: Thu, 05 Jun 2014 14:41:47 +0100 Message-ID: <53908FBB02000078000183FC@mail.emea.novell.com> References: <1401902794-15542-1-git-send-email-andrew.cooper3@citrix.com> <1401902794-15542-3-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: <1401902794-15542-3-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Ian Jackson , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 04.06.14 at 19:26, wrote: > + /* 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; > + if ( xc_domctl(xch, &domctl) < 0 ) > + { > + PERROR("Error querying maximum number of MSRs for VCPU%d", i); > + goto out; > + } > + > + if ( domctl.u.vcpu_msrs.msr_count ) > + { > + buffer = xc_hypercall_buffer_alloc(xch, buffer, > + domctl.u.vcpu_msrs.msr_count * > + sizeof(xen_domctl_vcpu_msr_t)); > + if ( !buffer ) > + { > + PERROR("Insufficient memory for getting MSRs for VCPU%d", i); > + goto out; > + } > + set_xen_guest_handle(domctl.u.vcpu_msrs.msrs, buffer); > + > + if ( xc_domctl(xch, &domctl) < 0 ) > + { > + PERROR("Error querying MSRs for VCPU%d", i); > + goto out; > + } > + > + xc_hypercall_buffer_free(xch, buffer); > + if ( domctl.u.vcpu_msrs.msr_count ) > + { > + errno = EOPNOTSUPP; > + PERROR("Unable to migrate PV guest using MSRs (yet)"); > + goto out; > + } > + } If you changed the hypervisor side as suggested, you'd get away with a single xc_domctl() and less than half of the number of added lines I suppose: You'd simply as for one MSR, and if you get one, or get -ENOBUFS, you'd know you can't handle it (for now). Jan