All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Hecht <dhecht@vmware.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH 1/2] cpu steal time accounting
Date: Thu, 23 Feb 2006 11:43:03 -0800	[thread overview]
Message-ID: <43FE1047.305@vmware.com> (raw)
In-Reply-To: <8ae84a6b234b27d104c214e2a401e291@cl.cam.ac.uk>

Keir Fraser wrote:
> 
> On 23 Feb 2006, at 08:48, Keir Fraser wrote:
> 
>>> One nice side effect of having this feature is that the explicit stolen
>>> time counter (or available time counter) can be dropped entirely from
>>> the interface, since its value can be inferred from the real time
>>> counter and available time counter (or stolen time counter).
>>
>> I don't understand the last paragraph here. It's not true that, for 
>> example,
>>  available_time = real_time - stolen_time
>> right?
> 
> Ah, okay, I see that in fact it is. :-)
>

Yeah, by definition, available_time is (real_time - stolen_time).

> Why not just have a halted_time instead? I think that's what we'd go for 
> in Xen.
> 

I assume you mean have halted_time in addition to vcpu_time, since you'd 
still need vcpu_time to determine stolen_time for the case a running 
vcpu is made to involuntarily wait.

Essentially, by adding halted_time, the Xen and VMI interfaces would be 
very similar in this regard.  We'd have:

xen_system_time                 <==> vmi_real_time
xen_vcpu_time + xen_halted_time <==> vmi_available_time
xen_stolen_time                 <==> vmi_stolen_time

The reason the vmi does not further partition vmi_available_time into 
vcpu_time and halted_time is because the guest is able to correctly do 
this partitioning, if it chooses to do so.  It can be done with:

halt_start = vmi_available_time counter;
Halt;
When the vcpu starts running again,
   halt_end = vmi_available_time counter;

We know during this time, vcpu_time == 0.  halted_time == (halt_end - 
halt_start).  And, when executing outside this region, any 
vmi_available_time that passes is vcpu_time.

So, rather than potentially complicating the interface, the vmi leaves 
the partitioning of vmi_available_time into vcpu_time and halted_time up 
to the guest.  Besides, perhaps there are other ways the guest may want 
to partition vmi_available_time other than into vcpu_time/halted_time, 
so why not leave this up to the guest OS?

Also, unless halted_time/vcpu_time is defined very carefully and 
precisely, having it as part of the interface can become confusing in 
the case the hypervisor wants to implement "halt" using a busy wait, or 
when the paravirtualized kernel is run on native hardware.  In these 
cases, the vcpu is still hogging a pcpu, so it might be unclear whether 
to consider that time vcpu_time or halted_time.

If vcpu_time is defined to be time in which a pcpu is dedicated to the 
vcpu (even if the vcpu executed the "halt" interface and is busy 
waiting), then halted_time would be defined to be time in which no pcpu 
is dedicated to the vcpu but the vcpu is not involuntarily waiting (i.e. 
the remaining time that is not stolen).  But, why expose this hypervisor 
implementation detail through the interface?

On the other hand, if vcpu_time is defined to be the time in which a 
pcpu is dedicated to the vcpu *and* the vcpu is not halted, then 
halted_time is defined to be the time the vcpu is halted (no matter how 
the hypervisor implements the halt -- a pcpu may still be dedicated to 
the vcpu).  But, in this case, why not leave the partitioning of 
available_time into vcpu_time/halted_time up to the guest OS?

Just trying to say that partitioning available_time into vcpu_time and 
halted_time may just add confusion and make the interface more 
complicated without making the interface any more powerful.

Dan

  reply	other threads:[~2006-02-23 19:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <43FCCB2C.5000408@vmware.com>
2006-02-22 23:58 ` [PATCH 1/2] cpu steal time accounting Dan Hecht
2006-02-23  8:40   ` Keir Fraser
2006-02-23 18:17     ` Dan Hecht
2006-02-23  8:48   ` Keir Fraser
2006-02-23 10:04     ` Keir Fraser
2006-02-23 19:43       ` Dan Hecht [this message]
2006-02-23 13:18     ` Rik van Riel
2006-02-21 14:06 Tian, Kevin
  -- strict thread matches above, loose matches on Subject: below --
2006-02-21  9:05 Tian, Kevin
2006-02-21 12:56 ` Rik van Riel
2006-02-21  0:51 Rik van Riel
2006-02-21 17:42 ` Keir Fraser
2006-02-21 19:32   ` Rik van Riel
2006-02-21 21:24     ` Diwaker Gupta
2006-02-22  9:00     ` Keir Fraser
2006-02-22 14:27       ` Rik van Riel
2006-02-22 17:08         ` Keir Fraser
2006-02-22 17:11           ` Rik van Riel
2006-02-22 17:45             ` Keir Fraser
2006-02-24 19:04               ` Rik van Riel

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=43FE1047.305@vmware.com \
    --to=dhecht@vmware.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --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 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.