* Pausing / unpausing a single domain VCPU via libxc
@ 2017-01-26 12:08 Razvan Cojocaru
2017-01-26 15:14 ` Dario Faggioli
2017-01-26 15:53 ` Jan Beulich
0 siblings, 2 replies; 6+ messages in thread
From: Razvan Cojocaru @ 2017-01-26 12:08 UTC (permalink / raw)
To: xen-devel
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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Pausing / unpausing a single domain VCPU via libxc
2017-01-26 12:08 Pausing / unpausing a single domain VCPU via libxc Razvan Cojocaru
@ 2017-01-26 15:14 ` Dario Faggioli
2017-01-26 15:42 ` Razvan Cojocaru
2017-01-26 15:53 ` Jan Beulich
1 sibling, 1 reply; 6+ messages in thread
From: Dario Faggioli @ 2017-01-26 15:14 UTC (permalink / raw)
To: Razvan Cojocaru, xen-devel; +Cc: Andrew Cooper, Ian Jackson, Wei Liu
[-- Attachment #1.1: Type: text/plain, Size: 1126 bytes --]
[Adding tools people, and Andrew's which, according to git history,
has touched the involved (Xen) code for last :-) ]
On Thu, 2017-01-26 at 14:08 +0200, Razvan Cojocaru wrote:
> 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())?
>
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
--
<<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 #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Pausing / unpausing a single domain VCPU via libxc
2017-01-26 15:14 ` Dario Faggioli
@ 2017-01-26 15:42 ` Razvan Cojocaru
2017-01-26 16:00 ` Dario Faggioli
0 siblings, 1 reply; 6+ messages in thread
From: Razvan Cojocaru @ 2017-01-26 15:42 UTC (permalink / raw)
To: Dario Faggioli, xen-devel; +Cc: Andrew Cooper, Ian Jackson, Wei Liu
On 01/26/2017 05:14 PM, Dario Faggioli wrote:
> [Adding tools people, and Andrew's which, according to git history,
> has touched the involved (Xen) code for last :-) ]
>
> On Thu, 2017-01-26 at 14:08 +0200, Razvan Cojocaru wrote:
>> 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())?
>>
> 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.
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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Pausing / unpausing a single domain VCPU via libxc
2017-01-26 12:08 Pausing / unpausing a single domain VCPU via libxc Razvan Cojocaru
2017-01-26 15:14 ` Dario Faggioli
@ 2017-01-26 15:53 ` Jan Beulich
1 sibling, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2017-01-26 15:53 UTC (permalink / raw)
To: Razvan Cojocaru; +Cc: xen-devel
>>> On 26.01.17 at 13:08, <rcojocaru@bitdefender.com> wrote:
> 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())?
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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Pausing / unpausing a single domain VCPU via libxc
2017-01-26 15:42 ` Razvan Cojocaru
@ 2017-01-26 16:00 ` Dario Faggioli
2017-01-26 16:03 ` Razvan Cojocaru
0 siblings, 1 reply; 6+ messages in thread
From: Dario Faggioli @ 2017-01-26 16:00 UTC (permalink / raw)
To: Razvan Cojocaru, xen-devel; +Cc: Andrew Cooper, Ian Jackson, Wei Liu
[-- Attachment #1.1: Type: text/plain, Size: 2657 bytes --]
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 #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Pausing / unpausing a single domain VCPU via libxc
2017-01-26 16:00 ` Dario Faggioli
@ 2017-01-26 16:03 ` Razvan Cojocaru
0 siblings, 0 replies; 6+ messages in thread
From: Razvan Cojocaru @ 2017-01-26 16:03 UTC (permalink / raw)
To: Dario Faggioli, xen-devel; +Cc: Andrew Cooper, Ian Jackson, Wei Liu
On 01/26/2017 06:00 PM, Dario Faggioli wrote:
> 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
> */
Right. Thank you for clearing that up!
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-01-26 16:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 12:08 Pausing / unpausing a single domain VCPU via libxc Razvan Cojocaru
2017-01-26 15:14 ` Dario Faggioli
2017-01-26 15:42 ` Razvan Cojocaru
2017-01-26 16:00 ` Dario Faggioli
2017-01-26 16:03 ` Razvan Cojocaru
2017-01-26 15:53 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.