[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190408160433.GQ6139@lakrids.cambridge.arm.com>
Date: Mon, 8 Apr 2019 17:04:34 +0100
From: Mark Rutland <mark.rutland@....com>
To: Marc Zyngier <marc.zyngier@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Russell King <linux@....linux.org.uk>,
Will Deacon <will.deacon@....com>,
Catalin Marinas <catalin.marinas@....com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>,
Valentin Schneider <valentin.schneider@....com>
Subject: Re: [PATCH 5/7] clocksource/arm_arch_timer: Drop use of static key
in arch_timer_reg_read_stable
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 <marc.zyngier@....com>
Acked-by: Mark Rutland <mark.rutland@....com>
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
>
Powered by blists - more mailing lists