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 5651BC04AA5 for ; Thu, 25 Aug 2022 13:25:30 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tQCsP44MR9sM8TK5Y987ZUZ6fb7No5XlP7Xk+bcpqck=; b=h/mgJZ/rrDUXrr BqEq9LVvTiXbsguL91v1YuluyyGZkSvphEZBz1EZ2xFH0F6TbEP7o0/HRZATPnrzOx2GejO48gkrk S1v88huot385Wc0VymHIWvCi6odJinIL6EZDBGQj4mQpj7dNhdKK0bQUqVKKWRWSzFCTJmkuUVQsf 68liUbUmMQsPT7E7fhYjfGMAkqcQUToCOgcz92VIeryAaiYrfPaT2J/o9S4o1SWFze8BPx8ekJiUL bmXIhPprc20weby4kS1L8k/4FPSkUEp0vZThpCovmo/39ICQy3JGzEYkcrXNUzf/3vta6KFDCojmC spOkMs31aXAYsEX8FEyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRCqW-00ElsO-Rk; Thu, 25 Aug 2022 13:24:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRCqT-00ElqZ-34 for linux-arm-kernel@lists.infradead.org; Thu, 25 Aug 2022 13:24:31 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6CCD9D6E; Thu, 25 Aug 2022 06:24:31 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.47.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A3DEF3F71A; Thu, 25 Aug 2022 06:24:25 -0700 (PDT) Date: Thu, 25 Aug 2022 14:24:22 +0100 From: Mark Rutland To: Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com, andre.przywara@arm.com, catalin.marinas@arm.com, vincenzo.frascino@arm.com, will@kernel.org Subject: Re: [PATCH v1 3/3] arm64: vdso: use SYS_CNTVCTSS_EL0 for gettimeofday Message-ID: References: <20220825102025.53916-1-joey.gouly@arm.com> <20220825102025.53916-4-joey.gouly@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220825102025.53916-4-joey.gouly@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220825_062429_224170_B6D87533 X-CRM114-Status: GOOD ( 18.25 ) 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 Thu, Aug 25, 2022 at 11:20:25AM +0100, Joey Gouly wrote: > If FEAT_ECV is implemented, the self-synchronized counter CNTVCTSS_EL0 can > be used, removing the need for an ISB. > > Signed-off-by: Joey Gouly > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Vincenzo Frascino > Cc: Mark Rutland > Cc: Andre Przywara > --- > arch/arm64/include/asm/vdso/gettimeofday.h | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h > index 4f7a629df81f..d8aff747019c 100644 > --- a/arch/arm64/include/asm/vdso/gettimeofday.h > +++ b/arch/arm64/include/asm/vdso/gettimeofday.h > @@ -9,6 +9,8 @@ > > #include > #include > +#include > +#include Nit: please sort this alphabetically. > > #define VDSO_HAS_CLOCK_GETRES 1 > > @@ -78,11 +80,15 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode, > return 0; > > /* > - * This isb() is required to prevent that the counter value > + * If FEAT_ECV is available, use the self-synchronizing counter. > + * Otherwise the isb is required to prevent that the counter value > * is speculated. > - */ > - isb(); > - asm volatile("mrs %0, cntvct_el0" : "=r" (res) :: "memory"); > + */ > + asm volatile(ALTERNATIVE("isb\nmrs %0, cntvct_el0", > + "nop\n" __mrs_s("%0", SYS_CNTVCTSS_EL0), > + ARM64_HAS_ECV) > + : "=r" (res) :: "memory"); > + For legibility (and ease of future modification), could we please format this with the fields all aligned, e.g. asm volatile( ALTERNATIVE("isb\n" "mrs %0, cntvct_el0", "nop\n" __mrs_s("%0", SYS_CNTVCTSS_EL0), ARM64_HAS_ECV) : "=r" (res) : : "memory"); Regardless: Acked-by: Mark Rutland Thanks, Mark. > arch_counter_enforce_ordering(res); > > return res; > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel