Re: [PATCH v3 5/5] clocksource: mips-gic-timer: Use local counter on synced multi-cluster systems

From: Thomas Bogendoerfer

Date: Mon Sep 28 2026 - 06:27:28 EST


On Mon, Sep 07, 2026 at 02:46:39PM +0200, Benoît Monin wrote:
> [...]
> +static void gic_clocksource_promote(struct work_struct *work)
> +{
> + if (gic_clock_unstable || gic_clocksource.read == &gic_hpt_read)
> + return;
> +
> + if (clocksource_unregister(&gic_clocksource) < 0)
> + return;
> +
> + gic_clocksource.read = &gic_hpt_read;
> +#ifdef CONFIG_GENERIC_GETTIMEOFDAY
> + gic_clocksource.vdso_clock_mode = VDSO_CLOCKMODE_GIC;
> +#endif
> +
> + if (clocksource_register_hz(&gic_clocksource, gic_frequency) < 0)
> + return;
> +
> + if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) {
> + sched_clock_register(mips_cm_is64 ?
> + gic_read_count_64 : gic_read_count_2x32,
> + gic_count_width, gic_frequency);
> + }

this feels like a lot of work for just replacing the read method.

Why not introduce a flag in gic_hpt_read(), which indicates whether
it can read the counter directly or need to do it via
gpt_hpt_read_multicluster() ?

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]