From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 6/9] perf: expose perf capability to other modules. Date: Tue, 1 Nov 2011 18:41:41 +0200 Message-ID: <20111101164141.GD16539@redhat.com> References: <1319993624-20247-1-git-send-email-gleb@redhat.com> <1319993624-20247-7-git-send-email-gleb@redhat.com> <4EB014FF.5000509@gmail.com> <20111101161352.GA16539@redhat.com> <4EB01C34.9060106@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com, mingo@elte.hu, a.p.zijlstra@chello.nl, acme@ghostprotocols.net, Frederic Weisbecker To: David Ahern Return-path: Received: from mx1.redhat.com ([209.132.183.28]:14413 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753684Ab1KASFW (ORCPT ); Tue, 1 Nov 2011 14:05:22 -0400 Content-Disposition: inline In-Reply-To: <4EB01C34.9060106@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Nov 01, 2011 at 10:20:04AM -0600, David Ahern wrote: > > > On 11/01/2011 10:13 AM, Gleb Natapov wrote: > > On Tue, Nov 01, 2011 at 09:49:19AM -0600, David Ahern wrote: > >> On 10/30/2011 10:53 AM, Gleb Natapov wrote: > >>> KVM needs to know perf capability to decide which PMU it can expose to a > >>> guest. > >>> > >>> Signed-off-by: Gleb Natapov > >>> --- > >>> arch/x86/include/asm/perf_event.h | 11 +++++++++++ > >>> arch/x86/kernel/cpu/perf_event.c | 11 +++++++++++ > >>> arch/x86/kernel/cpu/perf_event.h | 2 ++ > >>> arch/x86/kernel/cpu/perf_event_intel.c | 3 +++ > >>> 4 files changed, 27 insertions(+), 0 deletions(-) > >>> > >>> diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h > >>> index f61c62f..7d7e57f 100644 > >>> --- a/arch/x86/include/asm/perf_event.h > >>> +++ b/arch/x86/include/asm/perf_event.h > >>> @@ -201,7 +201,18 @@ struct perf_guest_switch_msr { > >>> u64 host, guest; > >>> }; > >>> > >>> +struct x86_pmu_capability { > >>> + int version; > >>> + int num_counters_gp; > >>> + int num_counters_fixed; > >>> + int bit_width_gp; > >>> + int bit_width_fixed; > >>> + unsigned int events_mask; > >>> + int events_mask_len; > >>> +}; > >>> + > >>> extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr); > >>> +extern void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap); > >>> #else > >>> static inline perf_guest_switch_msr *perf_guest_get_msrs(int *nr) > >>> { > >> > >> What about version of perf_get_x86_pmu_capability for CONFIG_PERF_EVENTS > >> not enabled in host kernel? Next patch for KVM assumes the function is > >> defined. > >> > > As far as I understand it is not possible to build x86 without > > CONFIG_PERF_EVENTS right now. Actually kvm pmu code depends on > > CONFIG_PERF_EVENTS been enabled. I can easily provide the stub if > > needed though. > > Right. Originally it could be enabled/disabled. Right now it cannot be, > but I believe Frederic is working on making it configurable again. > OK, I'll provide stub function in the next version, but I will not be able to test it :) -- Gleb.