Received: by 10.223.185.116 with SMTP id b49csp1676274wrg; Thu, 22 Feb 2018 00:59:15 -0800 (PST) X-Google-Smtp-Source: AH8x224Om4IQ6nI6X/7o97xG8iWcwMW5CR6uBEJuGdl/nkfI+kUMBpSqNpDMgvOf1HQ5CVURYLnH X-Received: by 2002:a17:902:b28a:: with SMTP id u10-v6mr427577plr.292.1519289955268; Thu, 22 Feb 2018 00:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519289955; cv=none; d=google.com; s=arc-20160816; b=vnOmlnctVAZMbxW19vNLZwN2mI7ygzmT00UrZDrQFoU5Mj1CwwMWrqK2b0DD/Zqfe/ A7azR2zUW+wizeCsNbVeNx2TV9LZME3AzJO9hijL/SkotIYuLWAjrRpONuNl8y9jTpBT UYmhn1VmOomGDYXb+qHkxAqFxOjkCjd2wg3UbquFvnPsA3uuO4qQy8PL7IzOipHqBWWz CApHqhoOUstX1beQbNR+jYjjEwrrGnLApz2bN0/oOkZOQfPVZaDHJQf0ACIiJUttmifQ 8cvpSg8zZ0ukq4vIO/C8L4+RvkxBbMfYvbko6fUZDcODf8F/tHvuvBScEGW36lTzuT6m qjqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=lZHf9LeCsmDBOCqlESFkyg8894ukmNWTbtnj6G6fyFY=; b=Pi/Zr7Hu+fGR0v4aC4/T5JexgXZxvUVu67iX/o9OSjgq6aATlnJD/WMCzMaRV/pV0Z 2IgfP+yxQSHVDAlUnZKPZORLb0S052tc5h+hJQQ+hgGIX2D/HudFbjYHPheJvemXL8sn kkL1jtbxwZHqCqCqFFlBdsjteH1ASoW059+tFLQ0uJyQdHV5d6mEfOcp4ZMBloUMdcEK AFVy/eRxLcATuY8LsRIUj2Fi+Boql+iWz83ng7UFC9BzocBRHVaZpj9LhM9O/uS2nCUE Cw2VpFodAX6tt5TttR73BITJWrYBntsey2sAuOVoO/gMRl34HXo9kiG5kMxVOZX3I85b IYZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9-v6si579444pln.818.2018.02.22.00.58.58; Thu, 22 Feb 2018 00:59:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752839AbeBVI6X (ORCPT + 99 others); Thu, 22 Feb 2018 03:58:23 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37276 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752553AbeBVI6W (ORCPT ); Thu, 22 Feb 2018 03:58:22 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D530A80D; Thu, 22 Feb 2018 00:58:21 -0800 (PST) Received: from big-swifty.misterjones.org (big-swifty.cambridge.arm.com [10.1.32.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A3983F487; Thu, 22 Feb 2018 00:58:16 -0800 (PST) Date: Thu, 22 Feb 2018 08:58:10 +0000 Message-ID: <86tvu9jt99.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Christoffer Dall Cc: Shanker Donthineni , linux-kernel , linux-arm-kernel , kvmarm , Vikram Sethi Subject: Re: [PATCH] KVM: arm/arm64: No need to zero CNTVOFF in kvm_timer_vcpu_put() for VHE In-Reply-To: <20180222084231.GA29376@cbox> References: <1519054687-14405-1-git-send-email-shankerd@codeaurora.org> <20180222084231.GA29376@cbox> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-2022-JP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Feb 2018 08:42:31 +0000, Christoffer Dall wrote: > > Hi Shanker, > > On Mon, Feb 19, 2018 at 09:38:07AM -0600, Shanker Donthineni wrote: > > In AArch64/AArch32, the virtual counter uses a fixed virtual offset > > of zero in the following situations as per ARMv8 specifications: > > > > 1) HCR_EL2.E2H is 1, and CNTVCT_EL0/CNTVCT are read from EL2. > > 2) HCR_EL2.{E2H, TGE} is {1, 1}, and either: > > ― CNTVCT_EL0 is read from Non-secure EL0 or EL2. > > ― CNTVCT is read from Non-secure EL0. > > > > So, no need to zero CNTVOFF_EL2/CNTVOFF for VHE case. > > > > Signed-off-by: Shanker Donthineni > > --- > > virt/kvm/arm/arch_timer.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c > > index 70268c0..86eca324 100644 > > --- a/virt/kvm/arm/arch_timer.c > > +++ b/virt/kvm/arm/arch_timer.c > > @@ -541,9 +541,11 @@ void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu) > > * The kernel may decide to run userspace after calling vcpu_put, so > > * we reset cntvoff to 0 to ensure a consistent read between user > > * accesses to the virtual counter and kernel access to the physical > > - * counter. > > + * counter of non-VHE case. For VHE, the virtual counter uses a fixed > > + * virtual offset of zero, so no need to zero CNTVOFF_EL2 register. > > */ > > - set_cntvoff(0); > > + if (!has_vhe()) > > + set_cntvoff(0); > > } > > > > /* > > I'm okay with this change. I don't think there's a huge gain here > though. > > Marc, any thoughts or concerns? None. I don't think this brings any visible performance gain, but hey, why not. Acked-by: Marc Zyngier M. -- Jazz is not dead, it just smell funny.