xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Cc: Artem_Mygaiev@epam.com,
	Stefano Stabellini <sstabellini@kernel.org>,
	Andrii Anisov <andrii_anisov@epam.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	xen-devel@lists.xensource.com
Subject: Re: Notes on stubdoms and latency on ARM
Date: Sat, 27 May 2017 04:10:03 +0200	[thread overview]
Message-ID: <1495851003.7393.75.camel@citrix.com> (raw)
In-Reply-To: <CAOcqxo2t3k7z8rrrjxWy=WSxzz4-O6zwe8BVFqgGqH6pd6oH4g@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 4448 bytes --]

On Fri, 2017-05-26 at 13:09 -0700, Volodymyr Babchuk wrote:
> Hello Dario,
>
Hi,

> > Feel free to ask anything. :-)
> 
> I'm so unfamiliar, so even don't know what to ask :) But thank you.
> Surely I'll have questions.
> 
Sure. As soon as you have one, go ahead with it.

> > The null scheduler is meant at being useful when you have a static
> > scenario, no (or very few) overbooking (i.e., total nr of vCPUs ~=
> > nr
> > of pCPUS), and what to cut to _zero_ the scheduling overhead.
> > 
> > That may include certain class of real-time workloads, but it not
> > limited to such use case.
> 
> Can't I achieve the same with any other scheduler by pining one vcpu
> to one pcpu?
> 
Of course you can, but not with the same (small!!) level of overhead of
the null scheduler. In fact, even if you do 1-to-1 pinning of all the
vcpus, the general purpose scheduler (like Credit1 and Credit2) can't
rely on assumptions that something like that is indeed in effect, and
that it will always be.

For instance, if you have all vcpus except one pinned to 1 pCPU. That
one missing vcpu, in its turn, can run everywhere. The scheduler has to
always go and see which vcpu is the one that is free to run everywhere,
and whether it should (for instance) preempt any (and, if yes, which)
of the pinned ones.

Also, still in those scheduler, there may be multiple vcpus that are
pinned to the same pCPU. In which case, the scheduler, at each
scheduling decision, needs to figure out which ones (among all the
vcpus) they are, and which one has the right to run on the pCPU.

And, unfortunately, since pinning can change 100% asynchronously wrt
the scheduler, it's really not possible to either make assumptions, nor
even to try to capture some (special case) situation in a data
structure.

Therefore, yes, if you configure 1-to-1 pinning in Credit1 or Credit2,
the actual schedule would be the same. But that will be achieve with
almost the same computational overhead, as if the vcpus were free.

OTOH, the null scheduler is specifically designed for the (semi-)static 
1-to-1 pinning use case, so the overhead it introduces (for making
scheduling decisions) is close to zero.

> > > Do you have any tools to profile or trace XEN core? Also, I don't
> > > think that pure context switch time is the biggest issue. Even
> > > now,
> > > it
> > > allows 180 000 switches per second (if I'm not wrong). I think,
> > > scheduling latency is more important.
> > > 
> > 
> > What do you refer to when you say 'scheduling latency'? As in, the
> > latency between which events, happening on which component?
> 
> I'm worried about interval between task switching events.
> For example: vcpu1 is vcpu of some domU and vcpu2 is vcpu of stubdom
> that runs device emulator for domU.
> vcpu1 issues MMIO access that should be handled by vcpu2 and gets
> blocked by hypervisor. Then there will be two context switches:
> vcpu1->vcpu2 to emulate that MMIO access and vcpu2->vcpu1 to continue
> work. AFAIK, credit2 does not guarantee that vcpu2 will be scheduled
> right after when vcpu1 will be blocked. It can schedule some vcpu3,
> then vcpu4 and only then come back to vcpu2.  That time interval
> between event "vcpu2 was made runable" and event "vcpu2 was scheduled
> on pcpu" is what I call 'scheduling latency'.
>
Yes, currently, that's true. Basically, from the scheduling point of
view, there's no particular relationship between a domain's vcpu, and
the vcpu of the driver/stub-dom that service the domain itself.

But there's a plan to change that, as both I and Stefano said already,
and do something in all schedulers. We'll just start with null, because
it's the easiest. :-)

> This latency can be minimized by mechanism similar to priority
> inheritance: if scheduler knows that vcpu1 waits for vcpu2 and there
> are remaining time slice for vcpu1 it should select vcpu2 as next
> scheduled vcpu. Problem is how to populate such dependencies.
> 
I've spent my PhD studying and doing stuff around priority
inheritance... so something similar to that, is exactly what I had in
mind. :-D

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

  reply	other threads:[~2017-05-27  2:10 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 19:00 Notes on stubdoms and latency on ARM Stefano Stabellini
2017-05-19 19:45 ` Volodymyr Babchuk
2017-05-22 21:41   ` Stefano Stabellini
2017-05-26 19:28     ` Volodymyr Babchuk
2017-05-30 17:29       ` Stefano Stabellini
2017-05-30 17:33         ` Julien Grall
2017-06-01 10:28           ` Julien Grall
2017-06-17  0:17             ` Volodymyr Babchuk
2017-05-31  9:09         ` George Dunlap
2017-05-31 15:53           ` Dario Faggioli
2017-05-31 16:17             ` Volodymyr Babchuk
2017-05-31 17:45           ` Stefano Stabellini
2017-06-01 10:48             ` Julien Grall
2017-06-01 10:52             ` George Dunlap
2017-06-01 10:54               ` George Dunlap
2017-06-01 12:40               ` Dario Faggioli
2017-06-01 15:02                 ` George Dunlap
2017-06-01 18:27               ` Stefano Stabellini
2017-05-31 17:02       ` George Dunlap
2017-06-17  0:14         ` Volodymyr Babchuk
2017-06-19  9:37           ` George Dunlap
2017-06-19 17:54             ` Stefano Stabellini
2017-06-19 18:36               ` Volodymyr Babchuk
2017-06-20 10:11                 ` Dario Faggioli
2017-07-07 15:02                   ` Volodymyr Babchuk
2017-07-07 16:41                     ` Dario Faggioli
2017-07-07 17:03                       ` Volodymyr Babchuk
2017-07-07 21:12                         ` Stefano Stabellini
2017-07-12  6:14                           ` Dario Faggioli
2017-07-17  9:25                             ` George Dunlap
2017-07-17 10:04                               ` Julien Grall
2017-07-17 11:28                                 ` George Dunlap
2017-07-19 11:21                                   ` Julien Grall
2017-07-20  9:25                                     ` Dario Faggioli
2017-07-20  9:10                                   ` Dario Faggioli
2017-07-20  8:49                               ` Dario Faggioli
2017-07-08 14:26                         ` Dario Faggioli
2017-06-20 10:45                 ` Julien Grall
2017-06-20 16:23                   ` Volodymyr Babchuk
2017-06-21 10:38                     ` Julien Grall
2017-06-19 18:26             ` Volodymyr Babchuk
2017-06-20 10:00               ` Dario Faggioli
2017-06-20 10:30                 ` George Dunlap
2017-05-23  7:11   ` Dario Faggioli
2017-05-26 20:09     ` Volodymyr Babchuk
2017-05-27  2:10       ` Dario Faggioli [this message]
2017-05-23  9:08   ` George Dunlap
2017-05-26 19:43     ` Volodymyr Babchuk
2017-05-26 19:46       ` Volodymyr Babchuk

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=1495851003.7393.75.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=Artem_Mygaiev@epam.com \
    --cc=andrii_anisov@epam.com \
    --cc=george.dunlap@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=vlad.babchuk@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).