From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: KVM PMU virtualization Date: Fri, 26 Feb 2010 09:45:25 +0100 Message-ID: <20100226084525.GG15885@elte.hu> References: <4B86917C.4070102@redhat.com> <4B869ACE.30808@siemens.com> <20100225162631.GA21920@elte.hu> <1267152757.1726.79.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kiszka , Jes Sorensen , KVM General , Peter Zijlstra , Avi Kivity , Zachary Amsden , Gleb Natapov , ming.m.lin@intel.com To: "Zhang, Yanmin" Return-path: Received: from mx2.mail.elte.hu ([157.181.151.9]:41607 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935550Ab0BZIqC (ORCPT ); Fri, 26 Feb 2010 03:46:02 -0500 Content-Disposition: inline In-Reply-To: <1267152757.1726.79.camel@localhost> Sender: kvm-owner@vger.kernel.org List-ID: * Zhang, Yanmin wrote: > On Thu, 2010-02-25 at 17:26 +0100, Ingo Molnar wrote: > > * Jan Kiszka wrote: > > > > > Jes Sorensen wrote: > > > > Hi, > > > > > > > > It looks like several of us have been looking at how to use the PMU > > > > for virtualization. Rather than continuing to have discussions in > > > > smaller groups, I think it is a good idea we move it to the mailing > > > > lists to see what we can share and avoid duplicate efforts. > > > > > > > > There are really two separate things to handle: > > > > > > > > 1) Add support to perf to allow it to monitor a KVM guest from the > > > > host. > > > > > > > > 2) Allow guests access to the PMU (or an emulated PMU), making it > > > > possible to run perf on applications running within the guest. > > > > > > > > I know some of you have been looking at 1) and I am currently working > > > > on 2). I have been looking at various approaches, including whether it > > > > is feasible to share the PMU between the host and multiple guests. For > > > > now I am going to focus on allowing one guest to take control of the > > > > PMU, then later hopefully adding support for multiplexing it between > > > > multiple guests. > > > > > > Given that perf can apply the PMU to individual host tasks, I don't see > > > fundamental problems multiplexing it between individual guests (which can > > > then internally multiplex it again). > > > > In terms of how to expose it to guests, a 'soft PMU' might be a usable > > approach. Although to Linux guests you could expose much more > > functionality and an non-PMU-limited number of instrumentation events, via > > a more intelligent interface. > > > > But note that in terms of handling it on the host side the PMU approach is > > not acceptable: instead it should map to proper perf_events, not try to > > muck with the PMU itself. > > > > That, besides integrating properly with perf usage on the host, will also > > allow interesting 'PMU' features on guests: you could set up the host side > > to trace block IO requests (or VM exits) for example, and expose that as > > 'PMC > > #0' on the guest side. > > So virtualization becomes non-transparent to guest os? I know virtio is an > optimization on guest side. The 'soft PMU' is transparent. The 'count IO events' kind of feature could be transparent too: you could re-configure (on the host) a given 'hardware' event to really count some software event. That would make it compatible with whatever guest side tooling (without having to change that tooling) - while still allowing interesting new things to be measured. Thanks, Ingo