mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Thomas Gleixner <tglx@kernel.org>,
	Ben Horgan <ben.horgan@arm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: Re: [PATCH v3 7/8] clocksource/drivers/arm_arch_timer: Expose a direct accessor for the virtual counter
Date: Tue, 29 Sep 2026 15:28:47 +0100	[thread overview]
Message-ID: <868q4k3zds.wl-maz@kernel.org> (raw)
In-Reply-To: <aru1QvpaQ8A-OnQq@willie-the-truck>

On Tue, 29 Sep 2026 13:55:30 +0100,
Will Deacon <will@kernel.org> wrote:
> 
> On Sun, Aug 02, 2026 at 05:53:26PM +0100, Marc Zyngier wrote:
> > We allow access to the architected counter via arch_timer_read_counter().
> > However, this accessor can either be the virtual or the physical
> > view of the counter, depending on how the kernel has been booted.
> > 
> > At the same time, we have some architectural features (such as WFIT,
> > WFET) that rely on the virtual counter, and nothing else.
> > 
> > If implementations were perfect, we'd rely on reading CNTVCT_EL0,
> > and be done with it. However, we have a bunch of broken implementations
> > in the wild, which rely on preemption being disabled and other
> > costly workarounds.
> > 
> > In order to provide decent performance on non-broken HW while still
> > supporting the legacy horrors, expose arch_timer_read_vcounter() as
> > a new helper that hides this complexity. Obviously, this is simply
> > a global alias of arch_counter_get_cntvct().
> > 
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >  drivers/clocksource/arm_arch_timer.c | 2 ++
> >  include/clocksource/arm_arch_timer.h | 1 +
> >  2 files changed, 3 insertions(+)
> > 
> > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
> > index b3b31d4f4815f..9c7501ce57073 100644
> > --- a/drivers/clocksource/arm_arch_timer.c
> > +++ b/drivers/clocksource/arm_arch_timer.c
> > @@ -128,6 +128,8 @@ static notrace u64 arch_counter_get_cntvct(void)
> >  	return __arch_counter_get_cntvct();
> >  }
> >  
> > +u64 arch_timer_read_vcounter(void) __attribute__((alias("arch_counter_get_cntvct")));
> 
> nit: compiler-attributes.h provides __alias to make this a tiny bit cleaner.
> 
> That said, why did you decide on the alias rather than just having this
> as a wrapper function?

No idea. Laziness, probably.

But I've paged most of this stuff out, and I'm not sure it even serves
a purpose, given that we've lived for about a decade with the problem
it tries to solve.

Consider it an abandoned series.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2026-09-29 14:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 16:53 [PATCH v3 0/8] arm64: arch_timer: Improve errata handling Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 1/8] clocksource/drivers/arm_arch_timer: Add read_sched_clock_is_arch_counter() predicate Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 2/8] clocksource/drivers/arm_arch_timer: Add a static key indicating the need for a runtime workaround Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 3/8] clocksource/drivers/arm_arch_timer: Convert counter accessors to a static key alternative Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 4/8] clocksource/drivers/arm_arch_timer: Drop the arch_counter_get_cnt{p,v}ct_stable() accessors Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 5/8] clocksource/drivers/arm_arch_timer: Turn arch_timer_read_counter into a function Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 6/8] clocksource/drivers/arm_arch_timer: Add command-line control over the counter errata management Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 7/8] clocksource/drivers/arm_arch_timer: Expose a direct accessor for the virtual counter Marc Zyngier
2026-09-29 12:55   ` Will Deacon
2026-09-29 14:28     ` Marc Zyngier [this message]
2026-09-29 14:35       ` Will Deacon
2026-09-29 14:49         ` Marc Zyngier
2026-08-02 16:53 ` [PATCH v3 8/8] arm64: Convert __delay_cycles() to arch_timer_read_vcounter() Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=868q4k3zds.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=ben.horgan@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®