public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>, Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	KVM list <kvm@vger.kernel.org>
Subject: [REGRESSION] High, likely incorrect process cpu usage counters with kvm and 2.6.2[67]
Date: Sun, 31 Aug 2008 18:43:21 +0300	[thread overview]
Message-ID: <48BABC19.1060509@qumranet.com> (raw)

Running an idle Windows VM on Linux 2.6.26+ with kvm, one sees high 
values for the kvm process in top (30%-70% cpu), where one would 
normally expect 0%-1%.  Surprisingly, the per-cpu system counters show 
almost 100% idle, leading me to believe this is an accounting error and 
that the process does not actually consume this much cpu.

I bisected this to a scheduler change, namely

commit 3e51f33fcc7f55e6df25d15b55ed10c8b4da84cd
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date:   Sat May 3 18:29:28 2008 +0200

    sched: add optional support for CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
   
    this replaces the rq->clock stuff (and possibly cpu_clock()).
   
     - architectures that have an 'imperfect' hardware clock can set
       CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
   
     - the 'jiffie' window might be superfulous when we update tick_gtod
       before the __update_sched_clock() call in sched_clock_tick()
   
     - cpu_clock() might be implemented as:
   
         sched_clock_cpu(smp_processor_id())
   
       if the accuracy proves good enough - how far can TSC drift in a
       single jiffie when considering the filtering and idle hooks?
   
    [ mingo@elte.hu: various fixes and cleanups ]
   
    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

Which is a bit too complex for me to work out.

Further information:
- the kvm thread which has the incorrect counter is the one that 
actually executes guest code
- this thread mostly sleeps in schedule(), as one would expect
- it is periodically woken up by a timer; perhaps the problem is that 
the process is sampled using the same timer, so it always shows as 
running (though I'd expect it to report 100% cpu in that case).

Any help will be appreciated (or provided).

-- 
error compiling committee.c: too many arguments to function


             reply	other threads:[~2008-08-31 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-31 15:43 Avi Kivity [this message]
2008-08-31 18:09 ` [REGRESSION] High, likely incorrect process cpu usage counters with kvm and 2.6.2[67] Parag Warudkar
2008-09-01  9:16   ` Avi Kivity
2008-09-01 14:58 ` [PATCH] sched_clock: fix NOHZ interaction Peter Zijlstra
2008-09-01 16:17   ` Avi Kivity
2008-09-05 16:13     ` Ingo Molnar

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=48BABC19.1060509@qumranet.com \
    --to=avi@qumranet.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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