[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/4] tools/libxc: Use an explicit check for PV MSRs in xc_domain_save()



>>> On 04.06.14 at 19:26, <andrew.cooper3@xxxxxxxxxx> 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.