Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A025C636CC for ; Wed, 8 Feb 2023 11:25:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbjBHLZG (ORCPT ); Wed, 8 Feb 2023 06:25:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230503AbjBHLY5 (ORCPT ); Wed, 8 Feb 2023 06:24:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF968F9; Wed, 8 Feb 2023 03:24:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7C73B61156; Wed, 8 Feb 2023 11:24:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6AF1C433D2; Wed, 8 Feb 2023 11:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675855495; bh=wsd1S5kOu4Opqg5TZyZpc4u1xf28GoANoypPqb/j024=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jOnVSS1ZAfBcPLH4eEhAWHHxZEUnlmuTa8O2ug/bOvrb3pEEUd1dyrloNXZwhNaoJ hG40ih4ERo7hGsDK2KcpXhmGHhcsI7ZR556JncaUxizvMHhgI3eWiYv7AAuDprYnWq JDuArNISeHBw2PwXDZxrg4YxX3PJBYsnWlYCs1dA0cckcdt+1wGIKrUPLM/3Ju6iUc cysrUMMefKmdmUaa+GJcScL2ovIvQV7KPJiL0w/oe7SjjBQicNh4NAusoIiscu2Lu9 l4e5nN+quZnFkKWCfqqNCrHMO7X16j+/LBhOhLmmCjXX9Dh3hOVzqwYnY1nJWXKBkk /YnXIdk19cLBw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pPiZJ-008dpq-Id; Wed, 08 Feb 2023 11:24:53 +0000 Date: Wed, 08 Feb 2023 11:24:53 +0000 Message-ID: <86lel8z9fe.wl-maz@kernel.org> From: Marc Zyngier To: Zaid Al-Bassam Cc: Jesus Sanchez-Palencia , Russell King , Catalin Marinas , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH 4/8] perf: pmuv3: Add wrappers for KVM accesses In-Reply-To: <20230126204444.2204061-5-zalbassam@google.com> References: <20230126204444.2204061-1-zalbassam@google.com> <20230126204444.2204061-5-zalbassam@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: zalbassam@google.com, jesussanp@google.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 26 Jan 2023 20:44:40 +0000, Zaid Al-Bassam wrote: > > KVM host support is available only on arm64. This patch adds wrappers > to the KVM host function references in the arm_pmuv3.c, so that it is > up to architecture to populate these wrappers if supported. > > Signed-off-by: Zaid Al-Bassam > --- > arch/arm64/include/asm/arm_pmuv3.h | 16 ++++++++++++++++ > drivers/perf/arm_pmuv3.c | 11 +++++------ > 2 files changed, 21 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/include/asm/arm_pmuv3.h b/arch/arm64/include/asm/arm_pmuv3.h > index f41a354d1022..9f2a48f5340c 100644 > --- a/arch/arm64/include/asm/arm_pmuv3.h > +++ b/arch/arm64/include/asm/arm_pmuv3.h > @@ -20,6 +20,7 @@ > > #include > #include > +#include "linux" includes must be placed before the "asm" ones. > > /* > * This code is really good > @@ -191,4 +192,19 @@ static inline u32 read_pmceid1(void) > return read_sysreg(pmceid1_el0); > } > > +static inline void armv8pmu_kvm_set_events(u32 set, struct perf_event_attr *attr) > +{ > + kvm_set_pmu_events(set, attr); > +} > + > +static inline void armv8pmu_kvm_clr_events(u32 clr) > +{ > + kvm_clr_pmu_events(clr); > +} > + > +static inline bool armv8pmu_kvm_counter_deferred(struct perf_event_attr *attr) > +{ > + return kvm_pmu_counter_deferred(attr); > +} > + > #endif > diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c > index 505f0758260c..d7063dd52827 100644 > --- a/drivers/perf/arm_pmuv3.c > +++ b/drivers/perf/arm_pmuv3.c > @@ -16,7 +16,6 @@ > > #include > #include > -#include > #include > #include > #include > @@ -607,10 +606,10 @@ static inline void armv8pmu_enable_event_counter(struct perf_event *event) > struct perf_event_attr *attr = &event->attr; > u32 mask = armv8pmu_event_cnten_mask(event); > > - kvm_set_pmu_events(mask, attr); > + armv8pmu_kvm_set_events(mask, attr); Why the change of name? given that you will implement empty helpers in the AArch32 code, you might as well keep the names and reduce the churn. At the end of the day, the only thing you need to do in this patch is to move the "#include " from this file into the arch-specific file. Nothing else. Thanks, M. -- Without deviation from the norm, progress is not possible.