Pausing / unpausing a single domain VCPU via libxc
Hello,
I see that there's currently no xc_vcpu_pause() (there's only xc_domain_pause(), which freezes all the VCPUs), but there's XEN_DOMCTL_gdbsx_pausevcpu, which is only used by tools/debugger/gdbsx/xg/xg_main.c.
Wouldn't it make sense to have a "regular" DOMCTL in libxc that the debugger, as well as other clients, would make use of (said xc_vcpu_pause() / xc_vcpu_unpause())?
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
[Adding tools people, and Andrew's which, according to git history, has touched the involved (Xen) code for last :-) ]
Quoted 11 lines · Razvan Cojocaru
Hello,
I see that there's currently no
xc_vcpu_pause()(there's onlyxc_domain_pause(), which freezes all the VCPUs), but there'sXEN_DOMCTL_gdbsx_pausevcpu, which is only used bytools/debugger/gdbsx/xg/xg_main.c.Wouldn't it make sense to have a "regular" DOMCTL in libxc that the debugger, as well as other clients, would make use of (said
xc_vcpu_pause()/xc_vcpu_unpause())?
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)?
Regards,
Dario
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 15 lines · Dario Faggioli
[Adding tools people, and Andrew's which, according to git history,
has touched the involved (Xen) code for last :-) ]Quoted 11 lines · Razvan Cojocaru
Hello,
I see that there's currently no
xc_vcpu_pause()(there's onlyxc_domain_pause(), which freezes all the VCPUs), but there'sXEN_DOMCTL_gdbsx_pausevcpu, which is only used bytools/debugger/gdbsx/xg/xg_main.c.Wouldn't it make sense to have a "regular" DOMCTL in libxc that the debugger, as well as other clients, would make use of (said
xc_vcpu_pause()/xc_vcpu_unpause())?
Quoted 6 lines
You mean you'd want to implement
xc_vcpu_pause()by means of theXEN_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.
As for a use case, an introspection application might be interested in briefly pausing a VCPU while it inspects data related to it.
Does XEN_DOMCTL_gdbsx_pausevcpu require that the whole domain is paused (for longer that the duration of the actual hypercall)?
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines · Razvan Cojocaru
Quoted 7 lines · Dario Faggioli
You mean you'd want to implement
xc_vcpu_pause()by means of theXEN_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)?
Quoted 10 lines
Not necessarily implement
xc_vcpu_pause()by means ofXEN_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 inxg_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.
Quoted 4 lines
Does
XEN_DOMCTL_gdbsx_pausevcpurequire 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
Signature · 4 lines
<<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)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 55 lines · Dario Faggioli
Quoted 9 lines · Razvan Cojocaru
Quoted 7 lines · Dario Faggioli
You mean you'd want to implement
xc_vcpu_pause()by means of theXEN_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)?Quoted 10 lines
Not necessarily implement
xc_vcpu_pause()by means ofXEN_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 inxg_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.
Quoted 4 lines
Does
XEN_DOMCTL_gdbsx_pausevcpurequire 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):
Quoted 6 lines
/*
* 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
*/
Right. Thank you for clearing that up!
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 26.01.17 at 13:08, <[email protected]> wrote:
I see that there's currently no
xc_vcpu_pause()(there's onlyxc_domain_pause(), which freezes all the VCPUs), but there'sXEN_DOMCTL_gdbsx_pausevcpu, which is only used bytools/debugger/gdbsx/xg/xg_main.c.Wouldn't it make sense to have a "regular" DOMCTL in libxc that the debugger, as well as other clients, would make use of (said
xc_vcpu_pause()/xc_vcpu_unpause())?
I could imagine the main reason for it to not exist being that using it may confuse the guest (seeing one or more of its vCPU-s no longer respond for some arbitrary time period).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel