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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7035FC433F5 for ; Tue, 10 May 2022 09:22:22 +0000 (UTC) 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=9PprKEDIAFn4ATgC1BufKFXpewi4yTliCKE6ScQ3cVg=; b=e4WlapdbChtnuH s4Fpg2IDKtgShVxbYyqzCvXlffkYYzJ0e0A+lUaYDDbheSoJGwz3BP1Ae2PXonQykc6BMuaMD/fPJ gl6XccCxXI2l1VLENDxkM0sTVKkPRj5wXx7npmyWNfCHGYPqUE6XPnHjArpTqRn61xdvBMK1d7NqS nYD8Ist/mf+DROYlFqn3wAT6LBxYDsPUC93OVFPyrfO6Eofd8BIpH9nJbXVA3tyLAS1wFnZloIPJl PC7vX/4HS+ugrTUCzfdBdH8NlRgJNU7d2GuGEfMDraxIKVSqRw2slBSW0lQD5N2/zykP807ezc4cU sDxPuywfxomcN6kd0bdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noM3U-000nPh-6V; Tue, 10 May 2022 09:21:20 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1noM3R-000nOc-Eg for linux-arm-kernel@lists.infradead.org; Tue, 10 May 2022 09:21:18 +0000 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 49A3B61531; Tue, 10 May 2022 09:21:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15260C385A6; Tue, 10 May 2022 09:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652174474; bh=zyT51MdEMrJVGCWKPkUy7fNaqcBozn7mLc2V0Ns9XjE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZUcQzv6w6aWW5b40TX+ShW6Mp6sBjOzXF7EtE4gqkYqrfEWzGd9Ry2hjpYioPfZNx jF8CJdettTJfSKV0Nujie4E93j439RIPqgkQkLnORpUltZwlA5epC8JI60n1yeQrir d6iQO5W/uAcmzwkcvEG0hWP1AbQIV4iLKF6EcaH8GHsVSTx+1R7bI23FoybMD1wKGc W5W0qBWcKDRJRkj8PavCAMgE3B6IpcBomGEd6804fwYpYxkBoECgpC/0gacNxotvs8 59IqRY8PgoEgdoEBfg6iin6IKNrJR2SOsyiyk4+ln/lq3+a3IthvLCwJ8b4BlV+oa+ oDR82ltBr6n7g== 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 1noM3L-00ABwL-7x; Tue, 10 May 2022 10:21:11 +0100 Date: Tue, 10 May 2022 10:21:00 +0100 Message-ID: <87bkw57ngj.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Oliver Upton , kvmarm@lists.cs.columbia.edu, kernel-team@android.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 3/4] KVM: arm64: Pass pmu events to hyp via vcpu In-Reply-To: References: <20220509120330.3043773-1-tabba@google.com> <20220509120330.3043773-4-tabba@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/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: tabba@google.com, oupton@google.com, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org 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-20220510_022117_611289_DF76BB56 X-CRM114-Status: GOOD ( 41.61 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 10 May 2022 07:43:45 +0100, Fuad Tabba wrote: > > Hi Oliver, > > > On Mon, May 9, 2022 at 9:21 PM Oliver Upton wrote: > > > > On Mon, May 09, 2022 at 12:03:29PM +0000, Fuad Tabba wrote: > > > Instead of the host accessing hyp data directly, pass the pmu > > > events of the current cpu to hyp via the vcpu. > > > > > > This adds 64 bits (in two fields) to the vcpu that need to be > > > synced before every vcpu run in nvhe and protected modes. > > > However, it isolates the hypervisor from the host, which allows > > > us to use pmu in protected mode in a subsequent patch. > > > > > > No visible side effects in behavior intended. > > > > > > Signed-off-by: Fuad Tabba > > > --- > > > arch/arm64/include/asm/kvm_host.h | 8 ++------ > > > arch/arm64/kvm/arm.c | 15 +++++++++++++++ > > > arch/arm64/kvm/hyp/nvhe/switch.c | 20 ++++++-------------- > > > arch/arm64/kvm/pmu.c | 12 ++++-------- > > > include/kvm/arm_pmu.h | 6 ++++++ > > > 5 files changed, 33 insertions(+), 28 deletions(-) > > > > > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > > > index dfd360404dd8..90476e713643 100644 > > > --- a/arch/arm64/include/asm/kvm_host.h > > > +++ b/arch/arm64/include/asm/kvm_host.h > > > @@ -273,14 +273,8 @@ struct kvm_cpu_context { > > > struct kvm_vcpu *__hyp_running_vcpu; > > > }; > > > > > > -struct kvm_pmu_events { > > > - u32 events_host; > > > - u32 events_guest; > > > -}; > > > - > > > > Looks like you're moving this to arm_pmu.h as well. Probably a better > > home for it, but unclear why it is done in this patch. > > Like you said, I thought it was a better home, and it's not needed > here anymore. I could maybe move it to the repacking patch and make it > as a general "cleanup" patch, if you think that would be clearer. > > > > > struct kvm_host_data { > > > struct kvm_cpu_context host_ctxt; > > > - struct kvm_pmu_events pmu_events; > > > }; > > > > > > > Are we going to need this struct any more since it now has a single > > member? > > I thought about removing it, but it would cause a bit of code churn. > That said, I could remove it in a new patch that I have as the last > one, and leave it to the maintainer to decide whether to take it. Unless there is a compelling reason for getting rid of kvm_host_data, I'd keep it. Because next thing you know, we'll need another bit in there, and we'll reintroduce it. This costs us nothing, so let's not worry about it. > > > > > > struct kvm_host_psci_config { > > > @@ -763,6 +757,7 @@ void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome); > > > struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr); > > > > > > DECLARE_KVM_HYP_PER_CPU(struct kvm_host_data, kvm_host_data); > > > +DECLARE_PER_CPU(struct kvm_pmu_events, kvm_pmu_events); > > > > Why do you need this declaration? I don't see the percpu data being > > accessed outside of pmu.c. > > You're right. At one previous iteration I did need it, which is why > it's here, but not anymore. Will remove it. And then make the definition static? Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel