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

Re: [Xen-devel] Pausing / unpausing a single domain VCPU via libxc



On Thu, 2017-01-26 at 17:42 +0200, Razvan Cojocaru wrote:
> On 01/26/2017 05:14 PM, Dario Faggioli wrote:
> > You mean you'd want to implement xc_vcpu_pause() by means of
> > the XEN_DOMCTL_gdbsx_pausevcpu?
> > 
> > What's the use case for that, and does it fit with the
> > implementation
> > of said hypercall (which, e.g., requires that the domain is already
> > paused)?
> 
> Not necessarily implement xc_vcpu_pause() by means of
> XEN_DOMCTL_gdbsx_pausevcpu, it's just that from a design perspective
> this seems rather specialised - the domctl name suggests that this is
> only useful for debugging, and it also hardcodes an implementation
> for
> calling that hypercall in xg_main.c, whereas pausing a single VCPU is
> a
> generic operation that other clients, as well as the debugger, might
> find worthwhile to do.
> 
And, in principle, I agree that it would make sense to have a generic
vCPU pause/unpause API.

Outside of principle --a.k.a., in practise-- I'm not sure whether it
really makes sense, and whether it would actually work.

I'm thinking of how happy a guest would be to be running with one of
it's (v)CPU frozen, and am wondering whether this could cause it to
panic, or behave funnily.

But I haven't tried, of course.

> Does XEN_DOMCTL_gdbsx_pausevcpu require that the whole domain is
> paused
> (for longer that the duration of the actual hypercall)?
> 
AFAICT, it does. See the implementation of the hypercall:

        if ( !d->controller_pause_count )
            break;
        ret = -EINVAL;
        if ( domctl->u.gdbsx_pauseunp_vcpu.vcpu >= d->max_vcpus ||
             (v = d->vcpu[domctl->u.gdbsx_pauseunp_vcpu.vcpu]) == NULL )
            break;
        ret = vcpu_pause_by_systemcontroller(v);

See commit 680d79f10 ("x86/gdbsx: invert preconditions for
XEN_DOMCTL_gdbsx_{,un}pausevcpu hypercalls":

    Revert back to how it was originally, i.e. the 
XEN_DOMCTL_gdbsx_{,un}pausevcpu
    hypercalls are only valid for a domain already paused by the system 
controller.

And see how it's used, e.g., as described in the comment above
xg_step() (or even in its actual code):

/*
 * Single step the given vcpu. This is achieved by pausing all but given vcpus,
 * setting the TF flag, let the domain run and pause, unpause all vcpus, and
 * clear TF flag on given vcpu.
 * Returns: 0 success
 */

Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

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

 


Rackspace

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