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 5A8ACC433F5 for ; Fri, 19 Nov 2021 12:00:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F4A3615A4 for ; Fri, 19 Nov 2021 12:00:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234673AbhKSMDo (ORCPT ); Fri, 19 Nov 2021 07:03:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:54092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234628AbhKSMD2 (ORCPT ); Fri, 19 Nov 2021 07:03:28 -0500 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 87199615A4; Fri, 19 Nov 2021 12:00:26 +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 1mo2Z6-006XMj-CA; Fri, 19 Nov 2021 12:00:24 +0000 Date: Fri, 19 Nov 2021 12:00:23 +0000 Message-ID: <87h7c873u0.wl-maz@kernel.org> From: Marc Zyngier To: Marcelo Tosatti , Nicolas Saenz Julienne Cc: linux-arm-kernel@lists.infradead.org, rostedt@goodmis.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, mingo@redhat.com, nilal@redhat.com Subject: Re: [RFC PATCH 1/2] arm64/tracing: add cntvct based trace clock In-Reply-To: <20211119112624.GA51423@fuller.cnet> References: <20211119102117.22304-1-nsaenzju@redhat.com> <20211119102117.22304-2-nsaenzju@redhat.com> <20211119112624.GA51423@fuller.cnet> 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") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: mtosatti@redhat.com, nsaenzju@redhat.com, linux-arm-kernel@lists.infradead.org, rostedt@goodmis.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, mingo@redhat.com, nilal@redhat.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 19 Nov 2021 11:26:24 +0000, Marcelo Tosatti wrote: > > On Fri, Nov 19, 2021 at 11:21:17AM +0100, Nicolas Saenz Julienne wrote: > > Add a new arm64-specific trace clock using the cntvct register, similar > > to x64-tsc. This gives us: > > - A clock that is relatively fast (1GHz on armv8.6, 1-50MHz otherwise), > > monotonic, and resilient to low power modes. > > - It can be used to correlate events across cpus as well as across > > hypervisor and guests. > > > > By using arch_timer_read_counter() we make sure that armv8.6 cpus use > > the less expensive CNTVCTSS_EL0, which cannot be accessed speculatively. > > Can this register be read by userspace ? (otherwise it won't be possible > to correlate userspace events). Yes. That's part of the userspace ABI. Although this particular accessor is only available from ARMv8.6 and is advertised via a hwcap to userspace. For currently existing implementations, userspace will use the CNTVCT_EL0 accessor, which requires extra synchronisation as it can be speculated. M. -- Without deviation from the norm, progress is not possible.