From: Tianyang Chen <tiche@seas.upenn.edu>
To: Dario Faggioli <dario.faggioli@citrix.com>,
xen-devel@lists.xenproject.org
Cc: george.dunlap@citrix.com, Dagaen Golomb <dgolomb@seas.upenn.edu>,
Meng Xu <mengxu@cis.upenn.edu>
Subject: Re: [PATCH v4] xen: sched: convert RTDS from time to event driven model
Date: Mon, 8 Feb 2016 14:04:10 -0500 [thread overview]
Message-ID: <56B8E6AA.1000000@seas.upenn.edu> (raw)
In-Reply-To: <1454930829.9227.555.camel@citrix.com>
On 2/8/2016 6:27 AM, Dario Faggioli wrote:
> On Fri, 2016-02-05 at 23:27 -0500, Tianyang Chen wrote:
>>
>> On 2/5/2016 9:39 AM, Dario Faggioli wrote:
>>> On Wed, 2016-02-03 at 21:23 -0500, Tianyang Chen wrote:
>>>>
>> I see. So I'm just curious what can cause spurious wakeup? Does it
>> only
>> happen to a running vcpu (currently on pcpu), and a vcpu that is on
>> either runq or depletedq?
>>
> Hehe, "that's virt, baby!" :-P
>
> No, seriously, vcpu being already running or already in a queue, is
> indeed what makes me call a wakeup a "spurious" wakeup. You can check
> at the performance counters that we update in those cases, to see when
> they happen most. In my experience, on Credit, I've seen them happening
> mostly when a vcpu is running. For instance:
>
> root@Zhaman:~# xenperf |grep vcpu_wake
> sched: vcpu_wake_running T= 39
> sched: vcpu_wake_onrunq T= 0
> sched: vcpu_wake_runnable T= 59875
> sched: vcpu_wake_not_runnable T= 0
>
>>> So we realized that this is just a spurious wakeup, and get back to
>>> what we were doing.
>>>
>>> What's wrong with this I just said?
>>>
>>
>> The reason why I wanted to add a vcpu back to replq is because it
>> could
>> be taken off from the timer handler. Now, because of the spurious
>> wakeup, I think the timer shouldn't take any vcpus off of replq, in
>> which case wake() should be doing nothing just like other schedulers
>> when it's a spurious wakeup. Also, only sleep() should remove events
>> from replq.
>>
> Err... well, that depends on the how the code ends up looking like, and
> it's start to become difficult to reason on it like this.
>
> Perhaps, considering that it looks to me that we are in agreement on
> all the important aspects, you can draft a new version and we'll reason
> and comment on top of that?
>
>>> Mmm... no, I think we should know/figure out whether a
>>> replenishment is
>>> pending already and we are ok with it, or if we need a new one.
>>>
>>
>> Just to make sure, spurious sleep/wakeup are for a vcpu that is on
>> pcpu
>> or any queue right?
>>
> Yes, spurious wakeup is how I'm calling wakeups that needs no action
> from the schedule, because the vcpu is already awake (and either
> running or runnable).
>
> I don't think there is such a thing as spurious sleep... When sleep is
> called, we go to sleep. There are cases where the sleep-->wakeup
> turnaround is really really fast, but I would not call them "spurious
> sleeps", and they should not need much special treatment, not in
> sched_rt.c at least.
>
> Oh, maybe you mean the cases where you wakeup and you find out that
> context_saved() has not run yet (just occurred by looking at the code
> below)? Well, yes... But I wouldn't call those "spurious sleeps"
> either.
>
>> If a real sleep happens, it should be taken off from replq. However,
>> in
>> spurious wakeup (which I assume corresponds to a spurious sleep?),
>> it
>> shouldn't be taken off from replq. Adding back to replq should
>> happen
>> for those vcpus which were taken off because of "real sleep".
>>
> I don't really follow, but I have the feeling that you're making it
> sound more complicated like it is in reality... :-)
>
So my reasoning is that, when sleep() is called in sched_rt.c, a vcpu
will need to be taken off from the replenishment event queue. However, a
vcpu can be put to sleep/not-runnable without even calling sleep(),
which corresponds to a later "spurious wakeup". Is there any way that
RTDS can know when this happens? If not, in rt_vcpu_wake(), it needs to
check, in all situations, if a vcpu is on the replenishment event queue
or not. If not, add it back. I'm I right?
vcpu running --> sleep(), taken off from replq
vcpu on queue --> sleep(), taken off from replq
vcpu not on queue --> sleep(), taken off from replq
However,
vcpu running/on queque/not on queue --> just not runnable anymore (still
on replq) --> spurious wakeup (still on replq)
vcpus shouldn't be added back to replq again.
So in all cases, rt_vcpu_wake() always need to check if a vcpu is on the
replq or not.
Now I think because of the addition of a replenishment queue, spurious
wake up cannot be simply treated as NOP. Just like V4, the "Out" label
basically maintains the replenishment queue.
Anyways, I agree it's gonna be easier to reason on v5 where all changes
are applied.
Thanks,
Tianyang
next prev parent reply other threads:[~2016-02-08 19:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 4:32 [PATCH v4] xen: sched: convert RTDS from time to event driven model Tianyang Chen
2016-02-02 15:08 ` Dario Faggioli
2016-02-02 18:09 ` Tianyang Chen
2016-02-03 12:39 ` Dario Faggioli
2016-02-04 2:23 ` Tianyang Chen
2016-02-05 14:39 ` Dario Faggioli
2016-02-06 4:27 ` Tianyang Chen
2016-02-08 11:27 ` Dario Faggioli
2016-02-08 19:04 ` Tianyang Chen [this message]
2016-02-08 21:23 ` Dario Faggioli
2016-02-04 4:03 ` Meng Xu
2016-02-05 14:45 ` Dario Faggioli
2016-02-03 3:33 ` Meng Xu
2016-02-03 12:30 ` Dario Faggioli
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=56B8E6AA.1000000@seas.upenn.edu \
--to=tiche@seas.upenn.edu \
--cc=dario.faggioli@citrix.com \
--cc=dgolomb@seas.upenn.edu \
--cc=george.dunlap@citrix.com \
--cc=mengxu@cis.upenn.edu \
--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 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).