From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: KVM PMU virtualization Date: Thu, 25 Feb 2010 18:34:23 +0100 Message-ID: <20100225173423.GB4246@8bytes.org> References: <4B86917C.4070102@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: KVM General , Peter Zijlstra , Avi Kivity , Zachary Amsden , Gleb Natapov , Ingo Molnar , ming.m.lin@intel.com, "Zhang, Yanmin" To: Jes Sorensen Return-path: Received: from 8bytes.org ([88.198.83.132]:55299 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933076Ab0BYReZ (ORCPT ); Thu, 25 Feb 2010 12:34:25 -0500 Content-Disposition: inline In-Reply-To: <4B86917C.4070102@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. > 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