From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966067AbcBDTWd (ORCPT ); Thu, 4 Feb 2016 14:22:33 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37418 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965910AbcBDTWc (ORCPT ); Thu, 4 Feb 2016 14:22:32 -0500 Date: Thu, 4 Feb 2016 20:23:01 +0100 From: Christoffer Dall To: Marc Zyngier Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH v3 20/23] arm64: perf: Count EL2 events if the kernel is running in HYP Message-ID: <20160204192301.GG13974@cbox> References: <1454522416-6874-1-git-send-email-marc.zyngier@arm.com> <1454522416-6874-21-git-send-email-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454522416-6874-21-git-send-email-marc.zyngier@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2016 at 06:00:13PM +0000, Marc Zyngier wrote: > When the kernel is running in HYP (with VHE), it is necessary to > include EL2 events if the user requests counting kernel or > hypervisor events. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kernel/perf_event.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c > index f7ab14c..6013a38 100644 > --- a/arch/arm64/kernel/perf_event.c > +++ b/arch/arm64/kernel/perf_event.c > @@ -20,6 +20,7 @@ > */ > > #include > +#include > > #include > #include > @@ -693,10 +694,15 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event, > return -EPERM; > if (attr->exclude_user) > config_base |= ARMV8_EXCLUDE_EL0; > - if (attr->exclude_kernel) > - config_base |= ARMV8_EXCLUDE_EL1; > - if (!attr->exclude_hv) > - config_base |= ARMV8_INCLUDE_EL2; > + if (is_kernel_in_hyp_mode()) { > + if (!attr->exclude_kernel || !attr->exclude_hv) > + config_base |= ARMV8_INCLUDE_EL2; is exclude_hv a perf generic construct? is it really correct to count everything the host kernel does (even unrelated to running VMs) when counting hypervisor events? Other than my ignorance in this area, this patch looks fine to me. Thanks, -Christoffer > + } else { > + if (attr->exclude_kernel) > + config_base |= ARMV8_EXCLUDE_EL1; > + if (!attr->exclude_hv) > + config_base |= ARMV8_INCLUDE_EL2; > + } > > /* > * Install the filter into config_base as this is used to > -- > 2.1.4 >