Re: [PATCH RFC] arm64: vdso: Use __arch_counter_get_cntvct()

From: Marc Zyngier
Date: Thu Apr 03 2025 - 13:59:50 EST


On Thu, 03 Apr 2025 13:14:49 +0100,
Breno Leitao <leitao@xxxxxxxxxx> wrote:
>
> Since you created *all* this noise regarding instruction ordering, can
> I pick your brain in the same topic? :-P
>
> If my machine has Speculation Barrier (sb)[1] support, is it a good
> replacement for `isb` ? Do you happen to know?

Probably not. SB prevent speculation past it, while ISB is here to
enforce ordering. We're pretty happy to let the CPU speculate the
counter, as long as it does it the order we have defined.

On some implementation, this can be have a similar effect (drain the
fetch queue, restart). But the intent clearly isn't the same, and some
implementations may do things differently.

In any case, what you want is CNTVCTSS_EL0 (part of FEAT_ECV), which
does away with all barriers.

M.

--
Jazz isn't dead. It just smells funny.