kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Avi Kivity <avi@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Joerg Roedel <joro@8bytes.org>, KVM General <kvm@vger.kernel.org>,
	Zachary Amsden <zamsden@redhat.com>,
	Gleb Natapov <gleb@redhat.com>,
	ming.m.lin@intel.com, "Zhang,
	Yanmin" <yanmin_zhang@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Fr??d??ric Weisbecker <fweisbec@gmail.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: KVM PMU virtualization
Date: Fri, 26 Feb 2010 14:51:04 +0100	[thread overview]
Message-ID: <4B87D1C8.5090901@redhat.com> (raw)
In-Reply-To: <1267190907.22519.601.camel@laptop>

On 02/26/10 14:28, Peter Zijlstra wrote:
> On Fri, 2010-02-26 at 13:51 +0200, Avi Kivity wrote:
>
>> It would be the other way round - the host would steal the pmu from the
>> guest.  Later we can try to time-slice and extrapolate, though that's
>> not going to be easy.
>
> Right, so perf already does the time slicing and interpolating thing, so
> a soft-pmu gets that for free.

What I don't like here is that without rewriting the guest OS, there
will be two layers of time-slicing and extrapolation. That is going to
make the reported numbers close to useless.

> Anyway, this discussion seems somewhat in a stale-mate position.
>
> The KVM folks basically demand a full PMU MSR shadow with PMI
> passthrough so that their $legacy shit works without modification.
>
> My question with that is how $legacy muck can ever know how the current
> PMU works, you can't even properly emulate a core2 pmu on a nehalem
> because intel keeps messing with the event codes for every new model.
>
> So basically for this to work means the guest can't run legacy stuff
> anyway, but needs to run very up-to-date software, so we might as well
> create a soft-pmu/paravirt interface now and have all up-to-date
> software support that for the next generation.

That is the problem. Today there is a large install base out there of
core2 users who wish to measure their stuff on the hardware they have.
The same will be true for Nehalem based stuff, when whatever replaces
Nehalem comes out makes that incompatible.

Since we are unable to emulate Core2 on Nehalem, and almost certainly
will be unable to emulate Nehalem on it's successor, we are stuck with
this.

A para-virt interface is a nice idea, but since we cannot emulate an
old CPU properly it still means there isn't much we can do as we're
stuck with the same limitations. I simply see the value of introducing
a para-virt interface for this.

> Furthermore, when KVM doesn't virtualize the physical system topology,
> some PMU features cannot even be sanely used from a vcpu.

That is definitely an issue, and there is nothing we can really do about
that. Having two guests running in parallel under KVM means that they
are going to see more cache misses than they would if they ran barebone
on the hardware.

However even with all of this, we have to keep in mind who is going to
use the performance monitoring in a guest. It is going to be application
writers, mostly people writing analytical/scientific applications. They
rarely have control over the OS they are running on, but are given
systems and told to work on what they are given. Driver upgrades and
things like that don't come quickly. However they also tend to
understand limitations like these and will be able to still benefit from
perf on a system like that.

> So while currently a root user can already tie up all of the pmu using
> perf, simply using that to hand the full pmu off to the guest still
> leaves lots of issues.

Well isn't that the case with the current setup anyway? If enough user
apps start requesting PMU resources, the hw is going to run out of
counters very quickly anyway.

The real issue here IMHO is whether or not is it possible to use a PMU
to count anything on different CPU? If that is really possible, sharing
the PMU is not an option :(

All that said, what we really want is for Intel+AMD to come up with
proper hw PMU virtualization support that makes it easy to rotate the
full PMU in and out for a guest. Then this whole discussion will become
a non issue.

Cheers,
Jes

  parent reply	other threads:[~2010-02-26 13:54 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-25 15:04 KVM PMU virtualization Jes Sorensen
2010-02-25 15:44 ` Jan Kiszka
2010-02-25 16:26   ` Ingo Molnar
2010-02-26  2:52     ` Zhang, Yanmin
2010-02-26  8:45       ` Ingo Molnar
2010-02-26 11:03     ` Jes Sorensen
2010-02-25 17:34 ` Joerg Roedel
2010-02-26  2:55   ` Zhang, Yanmin
2010-02-26  8:51     ` Joerg Roedel
2010-02-26  9:17       ` Ingo Molnar
2010-02-26 10:42         ` Joerg Roedel
2010-02-26 10:56           ` Ingo Molnar
2010-03-02  7:09         ` Zhang, Yanmin
2010-03-02  9:36           ` Ingo Molnar
2010-03-03  3:32             ` Zhang, Yanmin
2010-03-03  9:27               ` Zhang, Yanmin
2010-03-03 10:13                 ` Peter Zijlstra
2010-03-04  0:52                   ` Zhang, Yanmin
2010-03-03 10:15                 ` Peter Zijlstra
2010-03-04  1:00                   ` Zhang, Yanmin
2010-03-10  9:29                     ` Zhang, Yanmin
2010-03-02  9:57           ` Peter Zijlstra
2010-02-26  8:42   ` Ingo Molnar
2010-02-26  9:46     ` Avi Kivity
2010-02-26 10:39       ` Joerg Roedel
2010-02-26 10:46         ` Ingo Molnar
2010-02-26 10:51           ` Avi Kivity
2010-02-26 11:06           ` Joerg Roedel
2010-02-26 11:18             ` Jes Sorensen
2010-02-26 11:24               ` Ingo Molnar
2010-02-26 11:25                 ` Jes Sorensen
2010-02-26 11:20             ` Ingo Molnar
2010-02-26 10:44       ` Ingo Molnar
2010-02-26 11:16         ` Avi Kivity
2010-02-26 11:26           ` Ingo Molnar
2010-02-26 11:47             ` Avi Kivity
2010-02-26 11:23         ` Jes Sorensen
2010-02-26 11:42           ` Ingo Molnar
2010-02-26 11:51             ` Avi Kivity
2010-02-26 12:07               ` Ingo Molnar
2010-02-26 12:20                 ` Avi Kivity
2010-02-26 12:38                   ` Ingo Molnar
2010-02-26 13:04                     ` Avi Kivity
2010-02-26 13:13                       ` Jes Sorensen
2010-02-26 13:27                         ` Ingo Molnar
2010-02-26 13:33                           ` Avi Kivity
2010-02-26 14:07                           ` Jes Sorensen
2010-02-26 14:11                             ` Avi Kivity
2010-02-26 13:18                       ` Ingo Molnar
2010-02-26 13:34                         ` Jes Sorensen
2010-02-26 12:56                   ` Jes Sorensen
2010-02-26 13:31                   ` Ingo Molnar
2010-02-26 13:37                     ` Jes Sorensen
2010-02-26 13:55                       ` Avi Kivity
2010-02-26 14:27                         ` Peter Zijlstra
2010-02-26 14:54                           ` Avi Kivity
2010-02-26 15:08                             ` Peter Zijlstra
2010-02-26 15:11                               ` Avi Kivity
2010-02-26 15:18                                 ` Peter Zijlstra
2010-02-26 15:55                                 ` Peter Zijlstra
2010-02-26 16:06                                   ` Avi Kivity
2010-03-01 19:03                                   ` Zachary Amsden
2010-03-01 18:54                       ` Zachary Amsden
2010-02-26 13:40                     ` Avi Kivity
2010-02-26 14:01                       ` Ingo Molnar
2010-02-26 14:22                         ` Avi Kivity
2010-02-26 14:37                           ` Ingo Molnar
2010-02-26 16:03                             ` Avi Kivity
2010-02-26 16:07                               ` Avi Kivity
2010-02-26 13:28               ` Peter Zijlstra
2010-02-26 13:44                 ` Avi Kivity
2010-02-26 13:51                 ` Jes Sorensen [this message]
2010-02-26 14:42                   ` Peter Zijlstra
2010-03-08 18:14                     ` Avi Kivity
2010-02-26 12:49             ` Jes Sorensen
2010-02-26 13:06               ` Ingo Molnar
2010-02-26 13:30                 ` Avi Kivity
2010-02-26 13:32                   ` Jes Sorensen
2010-02-26 13:44                   ` Ingo Molnar
2010-02-26 13:53                     ` Avi Kivity
2010-02-26 14:12                       ` Ingo Molnar
2010-02-26 14:53                         ` Avi Kivity
2010-02-26 15:14                           ` Peter Zijlstra
2010-02-28 16:34                             ` Joerg Roedel
2010-02-28 16:31                         ` Joerg Roedel
2010-02-28 16:11                     ` Joerg Roedel
2010-03-01  8:39                       ` Ingo Molnar
2010-03-01  8:58                         ` Joerg Roedel
2010-03-01  9:04                           ` Ingo Molnar
2010-03-01  8:44                       ` Ingo Molnar
2010-03-01 11:11                         ` Joerg Roedel
2010-03-01 17:17                           ` Peter Zijlstra
2010-03-01 18:36                             ` Joerg Roedel
2010-03-08 10:15                             ` Avi Kivity
2010-02-26 14:49                   ` Peter Zijlstra
2010-02-26 14:50                   ` Peter Zijlstra
2010-02-26 13:31                 ` Jes Sorensen
2010-03-01 17:22             ` Zachary Amsden
2010-02-26 11:01   ` Jes Sorensen

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=4B87D1C8.5090901@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=acme@redhat.com \
    --cc=arjan@infradead.org \
    --cc=avi@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=gleb@redhat.com \
    --cc=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=yanmin_zhang@linux.intel.com \
    --cc=zamsden@redhat.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).