From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Zhang, Yanmin" Subject: Re: KVM PMU virtualization Date: Fri, 26 Feb 2010 10:55:17 +0800 Message-ID: <1267152917.1726.82.camel@localhost> References: <4B86917C.4070102@redhat.com> <20100225173423.GB4246@8bytes.org> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: Jes Sorensen , KVM General , Peter Zijlstra , Avi Kivity , Zachary Amsden , Gleb Natapov , Ingo Molnar , ming.m.lin@intel.com To: Joerg Roedel Return-path: Received: from mga12.intel.com ([143.182.124.36]:29207 "EHLO azsmga102.ch.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934984Ab0BZCw7 (ORCPT ); Thu, 25 Feb 2010 21:52:59 -0500 In-Reply-To: <20100225173423.GB4246@8bytes.org> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2010-02-25 at 18:34 +0100, Joerg Roedel wrote: > On Thu, Feb 25, 2010 at 04:04:28PM +0100, Jes Sorensen wrote: > > > 1) Add support to perf to allow it to monitor a KVM guest from the > > host. > > This shouldn't be a big problem. The PMU of AMD Fam10 processors can be > configured to count only when in guest mode. Perf needs to be aware of > that and fetch the rip from a different place when monitoring a guest. The idea is we want to measure both host and guest at the same time, and compare all the hot functions fairly. > > > 2) Allow guests access to the PMU (or an emulated PMU), making it > > possible to run perf on applications running within the guest. > > The biggest problem I see here is teaching the guest about the available > events. The available event sets are dependent on the processor family > (at least on AMD). > A simple approach would be shadowing the perf msrs which is a simple > thing to do. More problematic is the reinjection of performance > interrupts and performance nmis. > > I personally don't like a self-defined event-set as the only solution > because that would probably only work with linux and perf. I think we > should have a way (additionally to a soft-event interface) which allows > to expose the host pmu events to the guest. > > Joerg >