Re: [PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
From: Thomas Weißschuh
Date: Wed Jul 15 2026 - 03:37:20 EST
On Wed, Jul 15, 2026 at 09:29:26AM +0200, Thomas Gleixner wrote:
> On Thu, Jul 09 2026 at 13:32, Thomas Weißschuh wrote:
> > diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
> > index 15df9dcb42a5..2bc00c67dc54 100644
> > --- a/include/asm-generic/Kbuild
> > +++ b/include/asm-generic/Kbuild
> > @@ -62,6 +62,7 @@ mandatory-y += topology.h
> > mandatory-y += trace_clock.h
> > mandatory-y += uaccess.h
> > mandatory-y += unwind_user.h
> > +mandatory-y += vdso/clocksource.h
> > mandatory-y += vermagic.h
> > mandatory-y += vga.h
> > mandatory-y += video.h
> > diff --git a/include/asm-generic/vdso/clocksource.h b/include/asm-generic/vdso/clocksource.h
> > new file mode 100644
> > index 000000000000..e69de29bb2d1
> > diff --git a/include/vdso/clocksource.h b/include/vdso/clocksource.h
> > index c682e7c60273..63ee8c4ea15c 100644
> > --- a/include/vdso/clocksource.h
> > +++ b/include/vdso/clocksource.h
> > @@ -4,9 +4,12 @@
> >
> > #include <vdso/limits.h>
> >
> > -#ifdef CONFIG_GENERIC_GETTIMEOFDAY
> > #include <asm/vdso/clocksource.h>
> > -#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
> > +
> > +#if !IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) && defined(VDSO_ARCH_CLOCKMODES)
> > +/* Unlinkable dummy stubs */
> > +extern int VDSO_ARCH_CLOCKMODES;
> > +#endif
>
> I'm utterly confused by this. What's this unlinkable stub for?
> The only usage of VDSO_ARCH_CLOCKMODES is in enum vdso_clock_modes where
> it is guarded with CONFIG_GENERIC_GETTIMEOFDAY.
>
> And your change log says:
>
> > Provide unlinkable dummy definitions. These can be used with
> > IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY).
>
> which is even more confusing because that's related to the actual
> architecture specific defines and not to VDSO_ARCH_CLOCKMODES.
This is not a single stub for VDSO_ARCH_CLOCKMODES, but stubs for *each* of the
architecture-provided VDSO_CLOCKMODE_* constants.
E.g. on x86 it expands to:
extern int VDSO_CLOCKMODE_TSC, VDSO_CLOCKMODE_PVCLOCK, VDSO_CLOCKMODE_HVCLOCK;
> None of this makes sense to me.
I'll try to find a better explanation.
Thomas