From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E14EC433FE for ; Mon, 11 Oct 2021 15:33:42 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id D449F60EB4 for ; Mon, 11 Oct 2021 15:33:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D449F60EB4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 44E334B086; Mon, 11 Oct 2021 11:33:41 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pVIsctv0VXqd; Mon, 11 Oct 2021 11:33:39 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id CBB1C49FB7; Mon, 11 Oct 2021 11:33:39 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9E0A049FB7 for ; Mon, 11 Oct 2021 11:33:38 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4Mj-cJUc9usQ for ; Mon, 11 Oct 2021 11:33:37 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 246B440667 for ; Mon, 11 Oct 2021 11:33:37 -0400 (EDT) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3481760C49; Mon, 11 Oct 2021 15:33:35 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mZxIy-00G3oP-Qe; Mon, 11 Oct 2021 16:33:33 +0100 Date: Mon, 11 Oct 2021 16:33:31 +0100 Message-ID: <87lf2zpodw.wl-maz@kernel.org> From: Marc Zyngier To: Sean Christopherson Subject: Re: [PATCH v3 12/16] KVM: Move x86's perf guest info callbacks to generic KVM In-Reply-To: References: <20210922000533.713300-1-seanjc@google.com> <20210922000533.713300-13-seanjc@google.com> <87wnmjq4y3.wl-maz@kernel.org> 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/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: seanjc@google.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, will@kernel.org, mark.rutland@arm.com, guoren@kernel.org, nickhu@andestech.com, green.hu@gmail.com, deanbo422@gmail.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, pbonzini@redhat.com, boris.ostrovsky@oracle.com, jgross@suse.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, sstabellini@kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, artem.kashkanov@intel.com, like.xu.linux@gmail.com, lingshan.zhu@intel.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: Wanpeng Li , kvm@vger.kernel.org, Peter Zijlstra , Guo Ren , linux-riscv@lists.infradead.org, Vincent Chen , Jiri Olsa , kvmarm@lists.cs.columbia.edu, Stefano Stabellini , xen-devel@lists.xenproject.org, Will Deacon , Joerg Roedel , linux-csky@vger.kernel.org, Alexander Shishkin , Ingo Molnar , Palmer Dabbelt , Like Xu , Albert Ou , Zhu Lingshan , Arnaldo Carvalho de Melo , Greentime Hu , Paul Walmsley , Namhyung Kim , Boris Ostrovsky , Artem Kashkanov , linux-arm-kernel@lists.infradead.org, Jim Mattson , Juergen Gross , Nick Hu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Paolo Bonzini , Vitaly Kuznetsov X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Mon, 11 Oct 2021 15:46:25 +0100, Sean Christopherson wrote: > > On Mon, Oct 11, 2021, Marc Zyngier wrote: > > On Wed, 22 Sep 2021 01:05:29 +0100, Sean Christopherson wrote: > > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > > > index ed940aec89e0..828b6eaa2c56 100644 > > > --- a/arch/arm64/include/asm/kvm_host.h > > > +++ b/arch/arm64/include/asm/kvm_host.h > > > @@ -673,6 +673,14 @@ int io_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa); > > > void kvm_perf_init(void); > > > void kvm_perf_teardown(void); > > > > > > +#ifdef CONFIG_GUEST_PERF_EVENTS > > > +static inline bool kvm_arch_pmi_in_guest(struct kvm_vcpu *vcpu) > > > > Pardon my x86 ignorance, what is PMI? PMU Interrupt? > > Ya, Performance Monitoring Interrupt. I didn't realize the term wasn't > common perf terminology. Maybe kvm_arch_perf_events_in_guest() to be > less x86-centric? Up to you. I would be happy with just a comment. > > > > +{ > > > + /* Any callback while a vCPU is loaded is considered to be in guest. */ > > > + return !!vcpu; > > > +} > > > +#endif > > > > Do you really need this #ifdef? > > Nope, should compile fine without it, though simply dropping the #ifdef > would make make the semantics of the function wrong, even if nothing > consumes it. Tweak it to use IS_ENABLED()? > > return IS_ENABLED(CONFIG_GUEST_PERF_EVENTS) && !!vcpu; LGTM. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm