From: Catalin Marinas Subject: Re: [PATCH v5 03/20] arm64: Use physical counter for in-kernel reads when booted in EL2 Date: Fri, 27 Oct 2017 11:53:42 +0100 Message-ID: <20171027105341.rpomiwsospi76o4k@armageddon.cambridge.arm.com> References: <1509093281-15225-1-git-send-email-cdall@linaro.org> <1509093281-15225-4-git-send-email-cdall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DF4E849D1B for ; Fri, 27 Oct 2017 06:52:22 -0400 (EDT) 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 iGIYpt-OJhVF for ; Fri, 27 Oct 2017 06:52:21 -0400 (EDT) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id CC2E049D19 for ; Fri, 27 Oct 2017 06:52:21 -0400 (EDT) Content-Disposition: inline In-Reply-To: <1509093281-15225-4-git-send-email-cdall@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: Christoffer Dall Cc: kvm@vger.kernel.org, Marc Zyngier , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org List-Id: kvmarm@lists.cs.columbia.edu On Fri, Oct 27, 2017 at 10:34:24AM +0200, Christoffer Dall wrote: > Using the physical counter allows KVM to retain the offset between the > virtual and physical counter as long as it is actively running a VCPU. > > As soon as a VCPU is released, another thread is scheduled or we start > running userspace applications, we reset the offset to 0, so that > userspace accessing the virtual timer can still read the virtual counter > and get the same view of time as the kernel. > > This opens up potential improvements for KVM performance, but we have to > make a few adjustments to preserve system consistency. > > Currently get_cycles() is hardwired to arch_counter_get_cntvct() on > arm64, but as we move to using the physical timer for the in-kernel > time-keeping on systems that boot in EL2, we should use the same counter > for get_cycles() as for other in-kernel timekeeping operations. > > Similarly, implementations of arch_timer_set_next_event_phys() is > modified to use the counter specific to the timer being programmed. > > VHE kernels or kernels continuing to use the virtual timer are > unaffected. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Mark Rutland > Acked-by: Marc Zyngier > Signed-off-by: Christoffer Dall Acked-by: Catalin Marinas