linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Borislav Petkov <borislav.petkov@amd.com>
Subject: Re: [PATCH v1 0/5] KVM in-guest performance monitoring
Date: Thu, 12 May 2011 16:38:17 +0300	[thread overview]
Message-ID: <4DCBE2C9.20709@redhat.com> (raw)
In-Reply-To: <20110512130644.GF8707@8bytes.org>

On 05/12/2011 04:06 PM, Joerg Roedel wrote:
> On Thu, May 12, 2011 at 12:51:11PM +0300, Avi Kivity wrote:
> >  On 05/12/2011 12:33 PM, Joerg Roedel wrote:
>
> >>  Gaah, I was just about to submit a talk about PMU virtualization for KVM
> >>  Forum :)
> >
> >  Speed matters.
>
> I'll take that as an argument for paravirt pmu, because that one is
> certainly faster than anything we can emulate on-top of perf_events ;-)

Correct, though some massaging of perf_events can make it faster.  Still 
we'll pay with more exits with the architectural PMU.

Note a v2 PMU can reduce the exit count since it has MSRs for 
programming many PMCs at once.

> >  Note, at this time the architectural PMU is only recognized on an Intel
> >  host.
> >
> >  Is the statement "if an AMD processor returns non-zero information in
> >  cpuid leaf 0xa, then that processor will be compatible with other
> >  vendors' processors reporting the same information" correct?
>
> AMD processors don't implement that cpuid leaf.

Right.  But if an AMD processor were to implement that leaf, it would be 
in a compatible manner, yes?

That allows us to


-    if (vendor == intel && leaf_0xa_indicates_arch_pmu)
+    if (leaf_0xa_indicates_arch_pmu)

> >  If so, we can move the detection of the architectural pmu outside the
> >  cpu vendor checks, and this code will work on both AMD and Intel
> >  processors (even if the host cpu doesn't have an architectural PMU).
>
> Thats already some kind of paravirtualization. Don't get me wrong, I see
> the point of emulating a real pmu in the guest. But on the other side I
> think a interface that works across cpu models fits better into the KVM
> design, because KVM (oposed to other hypervisors) trys to hide details
> of the host cpu as much as necessary to get migration working between
> different cpus.
> And since pmu are, as you said, very model-specific, some abstraction is
> needed.

The architectural PMU is not model specific.

> In the end probably both ways can be implemented in parallel:
>
> 	* re-implementing the host-pmu using perf_events for -cpu host
> 	  guests
> 	* a paravirt pmu for everybody that wants migration and more
> 	  accurate results


A paravirt PMU also has to be implemented on top of perf_events.  
Otherwise we can't share this resource.  So the only question is what 
the interface looks like.  The arch pmu is non-optimized, but well 
specified and somewhat supported in guests.  A paravirt pmu is not so 
well specified at this point but can be faster (less exits).

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


  reply	other threads:[~2011-05-12 13:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11 15:55 [PATCH v1 0/5] KVM in-guest performance monitoring Avi Kivity
2011-05-11 15:55 ` [PATCH v1 1/5] perf: add context parameter to perf_event overflow handler Avi Kivity
2011-06-03 14:41   ` Peter Zijlstra
2011-06-05  8:07     ` Avi Kivity
2011-05-11 15:55 ` [PATCH v1 2/5] x86, perf: add constraints for architectural PMU v1 Avi Kivity
2011-05-11 15:55 ` [PATCH v1 3/5] perf: export perf_event_refresh() to modules Avi Kivity
2011-05-11 15:55 ` [PATCH v1 4/5] KVM: Expose kvm_lapic_local_deliver() Avi Kivity
2011-05-11 15:55 ` [PATCH v1 5/5] KVM: Expose a version 1 architectural PMU to guests Avi Kivity
2011-05-17 19:41   ` Ingo Molnar
2011-05-18  9:03     ` Avi Kivity
2011-05-18 11:07       ` Ingo Molnar
2011-05-18 11:29         ` Peter Zijlstra
2011-05-18 11:57           ` Ingo Molnar
2011-05-18 11:32         ` Peter Zijlstra
2011-05-18 11:37           ` Avi Kivity
2011-05-18 12:35             ` Peter Zijlstra
2011-05-18 12:49               ` Avi Kivity
2011-06-03 14:41   ` Peter Zijlstra
2011-06-05  8:12     ` Avi Kivity
2011-06-03 14:41   ` Peter Zijlstra
2011-06-05  8:12     ` Avi Kivity
2011-05-12  9:33 ` [PATCH v1 0/5] KVM in-guest performance monitoring Joerg Roedel
2011-05-12  9:47   ` Jan Kiszka
2011-05-12  9:53     ` Avi Kivity
2011-05-12 13:11     ` Joerg Roedel
2011-05-12 13:23       ` Jan Kiszka
2011-05-12 13:43         ` Joerg Roedel
2011-05-12 13:31       ` Avi Kivity
2011-05-12 14:24         ` Joerg Roedel
2011-05-12 14:37           ` Avi Kivity
2011-05-12 14:45             ` Avi Kivity
2011-05-13 12:34             ` Joerg Roedel
2011-05-12  9:51   ` Avi Kivity
2011-05-12 13:06     ` Joerg Roedel
2011-05-12 13:38       ` Avi Kivity [this message]
2011-05-12 14:29         ` Joerg Roedel
2011-05-17  9:52 ` Avi Kivity
2011-06-01  9:45   ` Avi Kivity
2011-06-01 10:26     ` Peter Zijlstra
2011-06-01 11:26       ` Avi Kivity

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=4DCBE2C9.20709@redhat.com \
    --to=avi@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=borislav.petkov@amd.com \
    --cc=joro@8bytes.org \
    --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;
as well as URLs for NNTP newsgroup(s).