Re: [PATCH 0/2] alpha: Use rpcc as the clocksource on SMP and without WTINT
From: Magnus Lindholm
Date: Sat Dec 05 2026 - 19:33:13 EST
Hi Matt,
On Sat, Dec 5, 2026 at 6:33 AM Matt Turner <mattst88@xxxxxxxxx> wrote:
>
> Alpha registers the rpcc clocksource only on uniprocessor machines and
> only without CONFIG_ALPHA_WTINT, which most SMP configurations enable.
> Every SMP machine other than QEMU therefore runs on the jiffies
> clocksource.
>
> Patch 1 makes the WTINT restriction a runtime decision. Not all PALcode
> implements WTINT; where it does not, do_entIF() already turns the call
> into a no-op, so the counter never stops and rpcc is safe to use. The
> Marvel firmware's Tru64 PALcode is one of these.
>
> Patch 2 lifts the uniprocessor restriction by measuring a per-CPU offset
> between the CPUs' cycle counters, as proposed for parisc's cr16 [1].
> Firmware zeroes each counter separately when the CPU starts and only
> PALcode can write it, so the counters cannot be aligned directly.
>
> Tested on an ES47 (Marvel) with two 1.3 GHz EV7s, CONFIG_ALPHA_WTINT=y:
>
> rpcc: CPU1 offset 607373602 cycles (reference CPU0, round trip 963 cycles)
> clocksource: Switched to clocksource rpcc
>
> Two threads pinned to different CPUs, passing CLOCK_MONOTONIC readings
> back and forth, saw no backward step in 3 million round trips, both
> right after boot and after 21 minutes.
>
> A draft that remeasured the offsets every minute saw them move by at
> most 275 cycles over 20 minutes, with no trend, so the series measures
> only once, at boot.
>
> If the parisc patch lands too, the measurement could move into common
> code; I'm happy to do that as a follow-up.
>
> [1] https://patch.msgid.link/20261204-parisc-cr16-smp-v2-1-1e37fc62aae2@xxxxxxxxx
>
> ---
> Matt Turner (2):
> alpha: Use rpcc when WTINT is configured but not implemented
> alpha: Synchronize rpcc across CPUs on SMP
>
> arch/alpha/include/asm/hwrpb.h | 1 +
> arch/alpha/kernel/proto.h | 1 +
> arch/alpha/kernel/time.c | 235 ++++++++++++++++++++++++++++++++++++++---
> arch/alpha/kernel/traps.c | 4 +
> 4 files changed, 227 insertions(+), 14 deletions(-)
> ---
> base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48
> change-id: 20261204-alpha-rpcc-smp-5929dd41d2a7
>
> Best regards,
> --
> Matt Turner <mattst88@xxxxxxxxx>
>
When you spin v2, could you base it on my for-next? The generic-entry
changes there moved the WTINT handling into handle_entIF(), so 1/2
needs a small context fix in traps.c. With that resolved, 2/2 applies
cleanly.
Thanks,
Magnus