From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH 6/9] perf: expose perf capability to other modules. Date: Tue, 01 Nov 2011 10:20:04 -0600 Message-ID: <4EB01C34.9060106@gmail.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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, avi@redhat.com, mtosatti@redhat.com, linux-kernel@redhat.com, mingo@elte.hu, a.p.zijlstra@chello.nl, acme@ghostprotocols.net, Frederic Weisbecker To: Gleb Natapov Return-path: Received: from mail-gx0-f174.google.com ([209.85.161.174]:40074 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753690Ab1KAQUJ (ORCPT ); Tue, 1 Nov 2011 12:20:09 -0400 Received: by ggnb1 with SMTP id b1so7197321ggn.19 for ; Tue, 01 Nov 2011 09:20:09 -0700 (PDT) In-Reply-To: <20111101161352.GA16539@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. David