xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: george.dunlap@eu.citrix.com, xen-devel@lists.xenproject.org,
	dario.faggioli@citrix.com
Subject: Re: RUNSTATE_runnable delta time for idle_domain accounted to HVM guest.
Date: Thu, 24 Apr 2014 14:02:59 -0400	[thread overview]
Message-ID: <20140424180259.GA2412@localhost.localdomain> (raw)
In-Reply-To: <5358E041020000780000BD41@nat28.tlf.novell.com>

On Thu, Apr 24, 2014 at 08:58:25AM +0100, Jan Beulich wrote:
> >>> On 23.04.14 at 23:28, <konrad.wilk@oracle.com> wrote:
> > 	Question 1: Following the code path, schedule_tail
> > 	for the idle domain would call idle_loop.
> > 
> > 	How do we end up from idle_loop in vcpu_wake?
> > 
> > 	Is that because the HPET (on another CPU)
> > 	has raised the softirq(TIMER_SOFTIRQ) because the
> > 	timer has expired?
> 
> On another or on the same CPU, because work got moved to the CPU
> in question, because some other vCPU in the guest triggered activity
> in a vCPU currently on that CPU, or because some guest set timer
> expired, needing the vCPU to run again.
> 
> > 	Question 2:
> > 
> > 	Who would trigger the SCHEDULE_SOFTIRQ for that?
> > 	I was initially thinking that the 'do_block'. But that
> > 	I think triggers the first call to 'schedule' which
> > 	sets the idle domain to run. Help? It could be
> > 	'vcpu_kick' but 'v->running=0' (done by schedule->context_saved).
> > 	Help!? Who could it be?
> 
> At the example of the credit scheduler, it's vcpu_wake() ->
> csched_vcpu_wake() -> __runq_tickle() that raises the softirq
> (if needed).

<smacks his head>
And it is right there in 'vcpu_wake':

    if ( v->runstate.state >= RUNSTATE_blocked )
        vcpu_runstate_change(v, RUNSTATE_runnable, NOW());
--> SCHED_OP(VCPU2OP(v), wake, v);        <----

Now  I just have to figure out why there is a delta of 6.7msec after the
'vcpu_runstate_change' and the 'wake' triggering the 'schedule' on the
CPU that is idle.
> 
> > Then 'schedule' is called where the 'prev' is the idle
> > domain and 'next' is the guest. However, because 'next' got
> > labelled as 'runstate_RUNNABLE' we account _all of the time
> > that the idle domain had been running as belonging to the guest_.
> 
> Not really - together with the state change vcpu_runstate_change()
> also sets v->runstate.state_entry_time for the new state, i.e. only
> the time since the vCPU became runnable is accounted here.

Yup! I somehow missed in the 'vcpu_wake' the 'SCHED_OP' call.
Now off to figure out why it takes so long to get the SCHEDULE_SOFTIRQ
to get invoked on the CPU.

More debugging. Thanks for the pointers!
> 
> Jan
> 

  reply	other threads:[~2014-04-24 18:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 21:28 RUNSTATE_runnable delta time for idle_domain accounted to HVM guest Konrad Rzeszutek Wilk
2014-04-24  7:58 ` Jan Beulich
2014-04-24 18:02   ` Konrad Rzeszutek Wilk [this message]
2014-04-29  9:16 ` George Dunlap
2014-04-29 12:42   ` Konrad Rzeszutek Wilk
2014-05-06 17:36     ` Konrad Rzeszutek Wilk
2014-05-07  8:07       ` Jan Beulich
2014-05-07 13:33         ` Konrad Rzeszutek Wilk
2014-05-07 14:10           ` 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=20140424180259.GA2412@localhost.localdomain \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.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 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).