Re: [PATCH v3 5/5] clocksource: mips-gic-timer: Use local counter on synced multi-cluster systems
From: Benoît Monin
Date: Mon Sep 28 2026 - 10:58:01 EST
On Monday, 28 September 2026 at 12:26:28 CEST, Thomas Bogendoerfer 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() ?
Yes, this way I can avoid the clocksource_unregister()/register(). I'll do
that.
Best regards,
--
Benoît Monin, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com