From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: KVM PMU virtualization Date: Mon, 01 Mar 2010 18:17:40 +0100 Message-ID: <1267463860.1579.25.camel@laptop> References: <4B87987A.2020302@redhat.com> <20100226104437.GB7463@elte.hu> <4B87AF44.9090702@redhat.com> <20100226114217.GI7463@elte.hu> <4B87C354.9020209@redhat.com> <20100226130656.GA2518@elte.hu> <4B87CCF5.6000209@redhat.com> <20100226134400.GB23422@elte.hu> <20100228161142.GA19879@8bytes.org> <20100301084450.GF19395@elte.hu> <20100301111108.GE19879@8bytes.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Ingo Molnar , Avi Kivity , Jes Sorensen , KVM General , Zachary Amsden , Gleb Natapov , ming.m.lin@intel.com, "Zhang, Yanmin" , Thomas Gleixner , "H. Peter Anvin" , Arjan van de Ven , Fr??d??ric Weisbecker , Arnaldo Carvalho de Melo To: Joerg Roedel Return-path: Received: from bombadil.infradead.org ([18.85.46.34]:37125 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751232Ab0CASRo (ORCPT ); Mon, 1 Mar 2010 13:17:44 -0500 In-Reply-To: <20100301111108.GE19879@8bytes.org> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 2010-03-01 at 12:11 +0100, Joerg Roedel wrote: > > 1. Enhance perf to count pmu events only when cpu is in guest mode. No enhancements needed, only hardware support for Intel doesn't provide this iirc. > 2. For every emulated performance counter the guest activates kvm > allocates a perf_event and configures it for the guest (we may allow > kvm to specify the counter index, the guest would be able to use > rdpmc unintercepted then). Event filtering is also done in this step. rdpmc can never be used unintercepted, for perf might be multiplexing the actual hw. > 3. Before vmrun the guest activates all its counters, Right, this is could be used to approximate the guest only counting. I'm not sure how the OS and USR bits interact with guest stuff - if the PMU isn't aware of the virtualized priv levels then those will not work as expected. > this can fail if > the host uses them or the requested pmc index is not available for some > reason. perf doesn't know about pmc indexes at the interface level, nor is that needed I think. > 4. Some additional magic to reinject pmu events into the guest Right, that is needed, and might be 'interesting' since we get them from NMI context.