Re: [PATCH 1/2] vdso: sparc: stub out custom vdso implementation

From: Thomas Gleixner
Date: Mon Jul 21 2025 - 17:13:02 EST


On Fri, Jul 11 2025 at 12:31, Arnd Bergmann wrote:
> It is probably not all that hard to convert the VDSO to use the
> generic implementation if you remove the runtime patching between
> TICK and STICK mode. From the code and the documentation, it
> seems that any JPS1 compatible CPU (or newer) uses STICK,
> this would be UltraSPARC III (Cheetah), SPARC64 V (Zeus)
> and all UltraSPARC T. If you want to give it a try to do the
> conversion to the generic VDSO, I could respin my patch to only
> remove the older TICK version and the runtime patching but leave
> the STICK one. I don't think it's worth my time trying to convert
> STICK myself since I have no way of testing it.

Getting rid of the run-time patching is really trivial. The clocksource
setup initializes clocksource::archdata::vdso_clockmode already
correctly with VCLOCK_NONE, VCLOCK_TICK and VCLOCK_STICK.

So all you need is:

static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_time_data *vd)
{
if (likely(clock_mode == VDSO_CLOCKMODE_STICK))
return vread_stick();

if (clock_mode == VDSO_CLOCKMODE_TICK))
return vread_tick();

return U64_MAX;
}

Plus a 32-bit specific version of vdso_shift_ns(), which means just
renaming the 32-bit variant of __shr64() and removing the then pointless
notrace annotation.

This should just work out of the box and the performance regression will
be minimal if even measurable.

Thanks,

tglx