From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Zhang, Yanmin" Subject: Re: KVM PMU virtualization Date: Fri, 26 Feb 2010 10:52:37 +0800 Message-ID: <1267152757.1726.79.camel@localhost> References: <4B86917C.4070102@redhat.com> <4B869ACE.30808@siemens.com> <20100225162631.GA21920@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: Jan Kiszka , Jes Sorensen , KVM General , Peter Zijlstra , Avi Kivity , Zachary Amsden , Gleb Natapov , ming.m.lin@intel.com To: Ingo Molnar Return-path: Received: from mga09.intel.com ([134.134.136.24]:61569 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935057Ab0BZCuS (ORCPT ); Thu, 25 Feb 2010 21:50:18 -0500 In-Reply-To: <20100225162631.GA21920@elte.hu> Sender: kvm-owner@vger.kernel.org List-ID: 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.