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 88F69C433EF for ; Mon, 11 Oct 2021 15:34:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 50FC560E52 for ; Mon, 11 Oct 2021 15:34:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 50FC560E52 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EZNmTDONXGzVHoS+apt6DVrlvw8nfVuqCKK7mq0CvLk=; b=KGl97gjkF4+/n/ 9MANznYJKBOZy2b1DaolfvDZEymwY47P+SnJpe+Yij5jSh6CVdWwiwyVDmX/YjSyVYylaNEq62TYd Lv/giwWj80t2NjwZskO2P3Pf6XPWhpnD7IGMsyqxcLvM7z+VLXFY9xYiFf1C1EVphB/4Ajtg00H3e 87gd8ZKDjXqhq8hSLdBt3E9jSHFUdXFdf0O+t/ouGhYPfkxZ1CpqNYiJ70N3p1+eHf1f6CZCIFO3d LBdV2UZLXcMKsh51rd3svITDpXMOrxow6TeZszn1qAfflU8AZ6oBUop7GsZITSk3vuBaEyfS2cfNY Y6Ap+c+bwMmMwhBnk0NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZxJD-009vb3-NY; Mon, 11 Oct 2021 15:33:47 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZxJ1-009vZL-JN; Mon, 11 Oct 2021 15:33:36 +0000 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 Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Will Deacon , Mark Rutland , Guo Ren , Nick Hu , Greentime Hu , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Boris Ostrovsky , Juergen Gross , Alexander Shishkin , Jiri Olsa , Namhyung Kim , James Morse , Alexandru Elisei , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Stefano Stabellini , 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 , Like Xu , Zhu Lingshan 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211011_083335_695051_909D2FF8 X-CRM114-Status: GOOD ( 22.34 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv