All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Dario Faggioli <dario.faggioli@citrix.com>,
	xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Wei Liu <wei.liu@citrix.com>
Subject: Re: Pausing / unpausing a single domain VCPU via libxc
Date: Thu, 26 Jan 2017 18:03:38 +0200	[thread overview]
Message-ID: <1330053a-798a-83a8-de25-f3f70b385682@bitdefender.com> (raw)
In-Reply-To: <1485446418.32103.176.camel@citrix.com>

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

  reply	other threads:[~2017-01-26 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2017-01-26 15:53 ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330053a-798a-83a8-de25-f3f70b385682@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=wei.liu@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.