From: Ingo Molnar <mingo@elte.hu>
To: "Laurent Vivier" <Laurent.Vivier@bull.net>,
"Jeremy Fitzhardinge" <jeremy@goop.org>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Avi Kivity" <avi@redhat.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
linux-kernel <linux-kernel@vger.kernel.org>,
virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 2/4] Introduce a new fields "gtime" and "cgtime" in task_struct and signal_struct
Date: Wed, 5 Aug 2009 08:59:19 +0200 [thread overview]
Message-ID: <20090805065919.GA6305@elte.hu> (raw)
In-Reply-To: <46C99392.3050205@bull.net>
* Laurent Vivier <Laurent.Vivier@bull.net> wrote:
> [PATCH 2/4] like for cpustat, introduce the "gtime" (guest time of
> the task) and "cgtime" (guest time of the task children) fields
> for the tasks. Modify signal_struct and task_struct. Modify
> /proc/<pid>/stat to display these new fields.
> --- kvm.orig/include/linux/sched.h 2007-08-20 11:11:30.000000000 +0200
> +++ kvm/include/linux/sched.h 2007-08-20 13:00:02.000000000 +0200
> @@ -515,6 +515,10 @@ struct signal_struct {
> * in __exit_signal, except for the group leader.
> */
> cputime_t utime, stime, cutime, cstime;
> +#ifdef CONFIG_GUEST_ACCOUNTING
> + cputime_t gtime;
> + cputime_t cgtime;
> +#endif
A handful of general (and less general) observations about these
patches:
1- The code is very ugly due to being an #ifdef fest. Please
always try to avoid them.
2- cputime_t is very coarse on x86: measured in jiffies. This means
that with a default HZ of 250 we'll have units of 4 msecs.
That's almost useless to rely on in new instrumentation: an irq
can come in and out without accounting noticing it, etc. If we
do some new statistics then it should be a lot better than
jiffies granular.
3- stime of vcpu tasks/threads already approximates 'guest time'
adequately. (as Jeremy observed it as well) Yes, it mixes 'true
guest mode' and 'host mode' system time, but then again due to
the jiffies granularity we have a _far_ bigger skew going on
already.
4- namespace collision: 'gtime' is already used as 'group time' in
a few places. One of the two things needs to be renamed.
5- tracepoints and perfcounters could be used to measure guest time
precisely, in a low-overhead mode.
These issues need to be addressed in a meaningful way. #2 probably
means a revamping of cputime_t handling on x86 - of not just the
gtime. But #3 is worth keeping in mind as well.
I think #5 is the most capable solution by a wide margin - we need
just a single tracepoint to emit 'nsecs spent in guest mode'
information and that's it. It would be a far smaller patch.
The tracepoint might even sample the guest RIP and hence could be
used as a VM-exit profiler and 'perf record -e kvm:vm_exit + perf
report' could be used to examine/profile/trace guest exit reasons.
Ingo
next prev parent reply other threads:[~2009-08-05 7:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-20 13:13 [PATCH 2/4] Introduce a new fields "gtime" and "cgtime" in task_struct and signal_struct Laurent Vivier
2007-08-20 13:13 ` Laurent Vivier
2007-08-20 13:52 ` [kvm-devel] " Christian Borntraeger
2007-08-20 13:52 ` Christian Borntraeger
2007-08-20 14:17 ` [kvm-devel] " Laurent Vivier
2007-08-20 14:17 ` Laurent Vivier
2007-08-20 14:17 ` Laurent Vivier
2007-08-20 13:52 ` [kvm-devel] " Christian Borntraeger
2009-08-05 6:59 ` Ingo Molnar
2009-08-05 6:59 ` Ingo Molnar [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-08-20 13:13 Laurent Vivier
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=20090805065919.GA6305@elte.hu \
--to=mingo@elte.hu \
--cc=Laurent.Vivier@bull.net \
--cc=a.p.zijlstra@chello.nl \
--cc=avi@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jeremy@goop.org \
--cc=kvm-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.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 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.