xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com, Joe Jin <joe.jin@oracle.com>,
	Zhenzhong Duan <zhenzhong.duan@oracle.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH] remove blocked time accounting from	 xen "clockchip"
Date: Wed, 09 Nov 2011 18:47:26 +0100	[thread overview]
Message-ID: <4EBABCAE.40704@redhat.com> (raw)
In-Reply-To: <4EBA8FAA020000780005FD5F@nat28.tlf.novell.com>

[-- Attachment #1: Type: text/plain, Size: 2398 bytes --]

On 11/09/11 14:35, Jan Beulich wrote:
>>>> On 18.10.11 at 22:42, Laszlo Ersek<lersek@redhat.com>  wrote:
>> ... because the "clock_event_device framework" already accounts for idle
>> time through the "event_handler" function pointer in
>> xen_timer_interrupt().
>>
>> The patch is intended as the completion of [1]. It should fix the double
>> idle times seen in PV guests' /proc/stat [2]. It should be orthogonal to
>> stolen time accounting (the removed code seems to be isolated).
>
> After some more looking around I still think it's incorrect, albeit for
> a different reason: What tick_nohz_restart_sched_tick() accounts
> as idle time is *all* time that passed while in cpu_idle(). What gets
> accounted in do_stolen_accounting() (without your patch) is
> different:
> - time the vCPU was in RUNSTATE_blocked gets accounted as idle
> - time the vCPU was in RUNSTATE_runnable and RUNSTATE_offline
>    gets accounted as stolen.
>
> That is, on an overcommitted system (and without your patch) I
> would expect you to not see the (full) double idle increment for a not
> fully idle and not fully loaded vCPU.

I tried to verify this with an experiment. Please examine if the 
experiment is bogus or not.

On a four-PCPU host (hyperthreading off, RHEL-5.7+ hypervisor & dom0) I 
started three virtual machines:

VM1: four VCPUs, four processes running a busy loop each, independently.
VM2: ditto
VM3: single VCPU running the attached program (which otherwise puts 1/2 
load on a single CPU, virtual or physical.) OS is RHEL-6.1.

In VM3, I also ran this script:

$ grep cpu0 /proc/stat; sleep 20; grep cpu0 /proc/stat
cpu0 10421 0 510 119943 608 0 1 122 0
cpu0 11420 0 510 121942 608 0 1 126 0

The difference in the fourth numerical column is still 1999, even though 
only 10 seconds of those 20 were spent idly.

Does the experiment miss the point (or do I), or does this disprove the 
idea?

(Interestingly, according to virt-manager, the load distribution between 
the VMs looked like:

VM1: 7/16 = 43.75%
VM2: 7/16 = 43.75%
VM3: 2/16 = 1/8 = 12.50%

as if VM3's load had been first extracted and the rest split between VM1 
and VM2. When I stop VM1 and VM2, VM3 stays at 12.5%. Under the above 
load, I would have expected:

VM1: 8/17 ~= 47.06%
VM2: 8/17 ~= 47.06%
VM3: 1/17 ~= 5.88%

ie. "eight and half" VCPUs sharing the host evenly. Could this have any 
relevance?)

Thank you
Laszlo

[-- Attachment #2: 50.c --]
[-- Type: text/plain, Size: 775 bytes --]

#define _XOPEN_SOURCE 500 /* SUSv2 */

#include <signal.h>       /* sigaction() */
#include <sys/time.h>     /* setitimer() */
#include <assert.h>       /* assert() */
#include <unistd.h>       /* pause() */

static volatile sig_atomic_t flag;

static void
ring(int sig)
{
  flag = !flag;
}

int
main(void)
{
  struct sigaction act;
  int tmp;
  struct itimerval itmv;
  
  act.sa_handler = &ring;
  tmp = sigemptyset(&act.sa_mask); assert(0 == tmp);
  act.sa_flags = 0;
  tmp = sigaction(SIGALRM, &act, 0); assert(0 == tmp);

  itmv.it_value.tv_sec = itmv.it_interval.tv_sec = 0;
  itmv.it_value.tv_usec = itmv.it_interval.tv_usec = 100 * 1000;
  tmp = setitimer(ITIMER_REAL, &itmv, 0); assert(0 == tmp);

  for (;;) {
    while (0 == flag)
      ;
    (void)pause();
  }
}

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2011-11-09 17:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18 20:42 [PATCH] remove blocked time accounting from xen "clockchip" Laszlo Ersek
2011-10-19  7:51 ` Jan Beulich
2011-10-19 14:54   ` Laszlo Ersek
2011-10-20 14:35   ` Laszlo Ersek
2011-10-20 15:02     ` Laszlo Ersek
2011-10-26 20:52       ` Konrad Rzeszutek Wilk
2011-11-09 13:35 ` Jan Beulich
2011-11-09 17:47   ` Laszlo Ersek [this message]
2011-11-10  8:32     ` Jan Beulich
2011-11-10 18:05   ` Jeremy Fitzhardinge
2012-01-19 19:42     ` Konrad Rzeszutek Wilk
2012-01-20  9:57       ` Jan Beulich
2012-01-20 16:00         ` Konrad Rzeszutek Wilk
2012-01-23 22:07         ` Konrad Rzeszutek Wilk
2011-12-21  8:32 ` Jan Beulich
2011-12-21 13:53   ` Laszlo Ersek
2011-12-21 14:58     ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2011-12-22  8:49 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=4EBABCAE.40704@redhat.com \
    --to=lersek@redhat.com \
    --cc=JBeulich@suse.com \
    --cc=jeremy@goop.org \
    --cc=joe.jin@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=zhenzhong.duan@oracle.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).