From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yan, Zheng" Subject: Re: perf uncore & lkvm woes Date: Tue, 21 Aug 2012 09:11:11 +0800 Message-ID: <5032E02F.7060104@linux.intel.com> References: <1345101585.31459.112.camel@twins> <502CA368.8050404@linux.intel.com> <502CB1F6.4010204@redhat.com> <502CD444.5020807@redhat.com> <1345115846.29668.16.camel@twins> <502CD891.5030102@redhat.com> <502DA115.1090907@linux.intel.com> <1345186574.29668.56.camel@twins> <5030B82C.5000106@redhat.com> <5031B9C9.5020401@linux.intel.com> <5031FA2C.2060306@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Peter Zijlstra , Pekka Enberg , Sasha Levin , Asias He , Cyrill Gorcunov , Ingo Molnar , KVM General , Gleb Natapov To: Avi Kivity Return-path: Received: from mga11.intel.com ([192.55.52.93]:47826 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755063Ab2HUBLO (ORCPT ); Mon, 20 Aug 2012 21:11:14 -0400 In-Reply-To: <5031FA2C.2060306@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/20/2012 04:49 PM, Avi Kivity wrote: > On 08/20/2012 07:15 AM, Yan, Zheng wrote: >> On 08/19/2012 05:55 PM, Avi Kivity wrote: >>> On 08/17/2012 09:56 AM, Peter Zijlstra wrote: >>>> On Fri, 2012-08-17 at 09:40 +0800, Yan, Zheng wrote: >>>>> >>>>> Peter, do I need to submit a patch disables uncore on virtualized CPU? >>>>> >>>> I think Avi prefers the method where KVM 'fakes' the MSRs and we have to >>>> detect if the MSRs actually work or not. >>> >>> s/we have/we don't have/. >>> >>>> >>>> If you're willing to have a go at that, please do so. If you're not sure >>>> how to do the KVM part, I'm sure Avi and/or Gleb can help you out. >>> >>> Certainly, please see kvm_pmu_get_msr() and kvm_pmu_set_msr(). >>> >>> The approach is that if an msr write can be emulated correctly (for >>> example, it disables a counter) then we let it proceed; if it cannot be >>> emulated correctly (for example it enables a counter that we cannot >>> emulate), then we ignore it, but print out a message that tells the user >>> that we're faking something that may cause the guest to malfunction. >>> >> >> There is only one kvm_pmu structure in struct kvm_vcpu_arch, but the uncore >> driver may define dozens of PMUs. Besides the uncore PMUs make extensive use >> of extra registers, I don't think we can store these information in kvm_pmu >> structure. > > We don't need to store any information, just respond to those MSRs (and > ignore them). The problem is that there are hundreds of MSRs, but only a few of them are defined in the header file of uncore driver. The uncore driver computes addresses of the rest MSRs by using uncore box index and counter index. Regards Yan, Zheng > >> The uncore pmu collects system-wide events on a given socket, it may not be >> possible to be simulated by virtualized CPU. I think it's better to just >> disable uncore on virtualized CPU. > > That only works for Linux guests. >