Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3081797yba; Mon, 8 Apr 2019 10:41:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZz2NA4/HCgedkRA4RC/rlnz+tjfjsrlBCBrZOLRmZ/qXtH8SbESf4q4T9qJYs6irCkroA X-Received: by 2002:a17:902:d70c:: with SMTP id w12mr31966277ply.198.1554745261676; Mon, 08 Apr 2019 10:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554745261; cv=none; d=google.com; s=arc-20160816; b=MesvErgjOudL06kv0oDTvaXicGnnFd9+ujEPb4Xwbw9TYiNxqxcZE0y15XDIyzzgbB X5osqEJw2LtNkQyQEQUJb7WZeHFfMWi/fBp5JwXN9JVR9wC26fHZVmdVq3i2kDeYHm6N lRg0/p/3AELCoHqBOx5H82l4E6u3g9ddzfg+SX9TWsM2Ne3s57bSc5Vw2PTtMRiFgs10 XcDgPihYG34ZaX/7jdck0ViE+Sq1HdNI4P8u/qY14Doa2l/SRvQNVRxJvIzX+sI+AyU/ q7lrVmgL8qzwhKp2e2+jscLVGBmo9j+WHTpn6Q74IwFJtn0MvWPRjwgocy9er4FiS3K2 xSXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=TaTSrPppjIM6k9dWYcFM+vGJhx+WSjNmZbC9E1XSLuE=; b=hRmyM7mdlmrjh6dA3GKDamOC6tDOF8q7iyQa26E3KULo8NXmKtEwCwEkybdGSfVNzd UmZudZg+M5vWHE5sP0WkK08dZeVYCCMTmNRaiyu6FWDfFDVTd1xH3mBhYPK1qalNB1+k nw2K4HpWg0f4DqKTYs0HgbX++axzfF74/G8neZDk4V9rg0w6rnWW8lpurSlLgKIKpBCK VLinLb4MYUhZSgm9DNUVZJ/M3LGl+WCo2PRh2Wq9ida0QPCHS8krlXP20W89bvQDuCE6 m6u+YBMyV2+Tc1rxQizy2BRMIkYzdooWLkjvgJnoYLXw++DIGILRjE5w1ec+MeydE8oI BvjQ== 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 u79si23793256pfa.6.2019.04.08.10.40.46; Mon, 08 Apr 2019 10:41:01 -0700 (PDT) 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 S1728712AbfDHQEj (ORCPT + 99 others); Mon, 8 Apr 2019 12:04:39 -0400 Received: from foss.arm.com ([217.140.101.70]:51160 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727580AbfDHQEi (ORCPT ); Mon, 8 Apr 2019 12:04:38 -0400 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 6388AA78; Mon, 8 Apr 2019 09:04:38 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 963D83F557; Mon, 8 Apr 2019 09:04:36 -0700 (PDT) Date: Mon, 8 Apr 2019 17:04:34 +0100 From: Mark Rutland To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Russell King , Will Deacon , Catalin Marinas , Daniel Lezcano , Wim Van Sebroeck , Guenter Roeck , Valentin Schneider Subject: Re: [PATCH 5/7] clocksource/arm_arch_timer: Drop use of static key in arch_timer_reg_read_stable Message-ID: <20190408160433.GQ6139@lakrids.cambridge.arm.com> References: <20190408154907.223536-1-marc.zyngier@arm.com> <20190408154907.223536-6-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190408154907.223536-6-marc.zyngier@arm.com> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 08, 2019 at 04:49:05PM +0100, Marc Zyngier wrote: > Let's start with the removal of the arch_timer_read_ool_enabled > static key in arch_timer_reg_read_stable. IT is not a fast path, Nit: s/IT/It/ > and we can simplify things a bit. > > Signed-off-by: Marc Zyngier Acked-by: Mark Rutland Mark. > --- > arch/arm64/include/asm/arch_timer.h | 42 +++++++++++++++++++---------- > 1 file changed, 28 insertions(+), 14 deletions(-) > > diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h > index c3762ffcc933..4a06d46def7e 100644 > --- a/arch/arm64/include/asm/arch_timer.h > +++ b/arch/arm64/include/asm/arch_timer.h > @@ -77,23 +77,37 @@ struct arch_timer_erratum_workaround { > DECLARE_PER_CPU(const struct arch_timer_erratum_workaround *, > timer_unstable_counter_workaround); > > +/* inline sysreg accessors that make erratum_handler() work */ > +static inline notrace u32 arch_timer_read_cntp_tval_el0(void) > +{ > + return read_sysreg(cntp_tval_el0); > +} > + > +static inline notrace u32 arch_timer_read_cntv_tval_el0(void) > +{ > + return read_sysreg(cntv_tval_el0); > +} > + > +static inline notrace u64 arch_timer_read_cntpct_el0(void) > +{ > + return read_sysreg(cntpct_el0); > +} > + > +static inline notrace u64 arch_timer_read_cntvct_el0(void) > +{ > + return read_sysreg(cntvct_el0); > +} > + > #define arch_timer_reg_read_stable(reg) \ > -({ \ > - u64 _val; \ > - if (needs_unstable_timer_counter_workaround()) { \ > - const struct arch_timer_erratum_workaround *wa; \ > + ({ \ > + u64 _val; \ > + \ > preempt_disable_notrace(); \ > - wa = __this_cpu_read(timer_unstable_counter_workaround); \ > - if (wa && wa->read_##reg) \ > - _val = wa->read_##reg(); \ > - else \ > - _val = read_sysreg(reg); \ > + _val = erratum_handler(read_ ## reg)(); \ > preempt_enable_notrace(); \ > - } else { \ > - _val = read_sysreg(reg); \ > - } \ > - _val; \ > -}) > + \ > + _val; \ > + }) > > /* > * These register accessors are marked inline so the compiler can > -- > 2.20.1 >