* [PATCH 1/7] kbuild: support generated asm-headers in subdirectories
2026-07-09 11:32 [PATCH 0/7] vDSO: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
@ 2026-07-09 11:32 ` Thomas Weißschuh
2026-07-09 11:32 ` [PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY Thomas Weißschuh
` (5 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
Extend the asm-header stub generation to also handle subdirectories.
An upcoming vdso/ header refactoring requires this.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
| 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
--git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
index 8a4856e74180..772b53ffdeb4 100644
--- a/scripts/Makefile.asm-headers
+++ b/scripts/Makefile.asm-headers
@@ -48,14 +48,13 @@ syscall-y := $(addprefix $(obj)/, $(syscall-y))
generated-y := $(addprefix $(obj)/, $(generated-y))
# Remove stale wrappers when the corresponding files are removed from generic-y
-old-headers := $(wildcard $(obj)/*.h)
+old-headers := $(shell test -d $(obj) && find $(obj) -name *.h)
unwanted := $(filter-out $(generic-y) $(generated-y) $(syscall-y),$(old-headers))
-quiet_cmd_wrap = WRAP $@
- cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
+filechk_wrap = echo "\#include <asm-generic/$*.h>"
quiet_cmd_remove = REMOVE $(unwanted)
- cmd_remove = rm -f $(unwanted)
+ cmd_remove = rm -f $(unwanted); find $(obj) -type -d -empty -delete
quiet_cmd_syshdr = SYSHDR $@
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) \
@@ -74,8 +73,8 @@ all: $(generic-y) $(syscall-y)
$(if $(unwanted),$(call cmd,remove))
@:
-$(obj)/%.h: $(srctree)/$(generic)/%.h
- $(call cmd,wrap)
+$(obj)/%.h: $(srctree)/$(generic)/%.h FORCE
+ $(call filechk,wrap)
$(obj)/unistd_%.h: $(syscalltbl) $(syshdr) FORCE
$(call if_changed,syshdr)
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
2026-07-09 11:32 [PATCH 0/7] vDSO: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
2026-07-09 11:32 ` [PATCH 1/7] kbuild: support generated asm-headers in subdirectories Thomas Weißschuh
@ 2026-07-09 11:32 ` Thomas Weißschuh
2026-07-15 7:29 ` Thomas Gleixner
2026-07-09 11:32 ` [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
` (4 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
Some code, for example clocksource drivers, may want to use the vDSO
clockmode constants even when CONFIG_GENERIC_GETTIMEOFDAY=n.
But the symbols are completely hidden in that case, making ugly
ifdeffery necessary.
Provide unlinkable dummy definitions. These can be used with
IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY).
As not all architectures provide asm/vdso/clocksource.h,
provide an empty stub in asm-generic for it.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
include/asm-generic/Kbuild | 1 +
include/asm-generic/vdso/clocksource.h | 0
include/vdso/clocksource.h | 7 +++++--
3 files changed, 6 insertions(+), 2 deletions(-)
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
enum vdso_clock_mode {
VDSO_CLOCKMODE_NONE,
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
2026-07-09 11:32 ` [PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY Thomas Weißschuh
@ 2026-07-15 7:29 ` Thomas Gleixner
2026-07-15 7:35 ` Thomas Weißschuh
0 siblings, 1 reply; 16+ messages in thread
From: Thomas Gleixner @ 2026-07-15 7:29 UTC (permalink / raw)
To: Thomas Weißschuh, Arnd Bergmann, Andy Lutomirski,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
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.
None of this makes sense to me.
Thanks,
tglx
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY
2026-07-15 7:29 ` Thomas Gleixner
@ 2026-07-15 7:35 ` Thomas Weißschuh
0 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-15 7:35 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Arnd Bergmann, Andy Lutomirski, Vincenzo Frascino,
Nathan Chancellor, Nicolas Schier, Thomas Bogendoerfer,
Daniel Lezcano, Mark Rutland, Marc Zyngier, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Huacai Chen,
WANG Xuerui, linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-09 11:32 [PATCH 0/7] vDSO: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
2026-07-09 11:32 ` [PATCH 1/7] kbuild: support generated asm-headers in subdirectories Thomas Weißschuh
2026-07-09 11:32 ` [PATCH 2/7] vDSO: Make clockmode constants available without CONFIG_GENERIC_GETTIMEOFDAY Thomas Weißschuh
@ 2026-07-09 11:32 ` Thomas Weißschuh
2026-07-15 8:25 ` Thomas Gleixner
2026-07-09 11:32 ` [PATCH 4/7] clocksource/drivers/mips-gic-timer: " Thomas Weißschuh
` (3 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
Now that there is a dummy declaration of VDSO_CLOCKMODE_R4K, even if no
vDSO is built, the ugly ifdeffery can be replaced with a cleaner
IS_ENABLED() check.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/mips/kernel/csrc-r4k.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index 241a934543a8..63aca74ab299 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -126,14 +126,12 @@ int __init init_r4k_clocksource(void)
clocksource_mips.rating = 200;
clocksource_mips.rating += clamp(mips_hpt_frequency / 10000000, 0, 99);
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
/*
* R2 onwards makes the count accessible to user mode so it can be used
* by the VDSO (HWREna is configured by configure_hwrena()).
*/
- if (cpu_has_mips_r2_r6 && rdhwr_count_usable())
+ if (IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) && cpu_has_mips_r2_r6 && rdhwr_count_usable())
clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K;
-#endif
clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-09 11:32 ` [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
@ 2026-07-15 8:25 ` Thomas Gleixner
2026-07-15 8:43 ` Thomas Weißschuh
0 siblings, 1 reply; 16+ messages in thread
From: Thomas Gleixner @ 2026-07-15 8:25 UTC (permalink / raw)
To: Thomas Weißschuh, Arnd Bergmann, Andy Lutomirski,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
On Thu, Jul 09 2026 at 13:32, Thomas Weißschuh wrote:
> Now that there is a dummy declaration of VDSO_CLOCKMODE_R4K, even if no
> vDSO is built, the ugly ifdeffery can be replaced with a cleaner
> IS_ENABLED() check.
Duh. This stuff is really obfuscated. I just realized that the previous
one actually expands the architecture defines to non-defined integer
variable declarations.
Smart, but seriously?
I just double checked and it turns out that none of this ifdeffery is
required. If CONFIG_GENERIC_GETTIMEOFDAY is disabled, then it does not
matter at all whether the actual ARCH_CLOCK_VDSO_MODE is set in
clocksource::vdso_mode or not.
Nothing uses the vdso mode field outside of update_vsyscall and that's
compiled out when CONFIG_GENERIC_GETTIMEOFDAY=n.
So all what's required is:
--- a/include/vdso/clocksource.h
+++ b/include/vdso/clocksource.h
@@ -3,14 +3,11 @@
#define __VDSO_CLOCKSOURCE_H
#include <vdso/limits.h>
-
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
#include <asm/vdso/clocksource.h>
-#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
enum vdso_clock_mode {
VDSO_CLOCKMODE_NONE,
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
+#ifdef VDSO_ARCH_CLOCKMODES
VDSO_ARCH_CLOCKMODES,
#endif
VDSO_CLOCKMODE_MAX,
and then you can just unconditionally set clocksource::vdso_clock_mode
in all drivers.
No?
Thanks,
tglx
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-15 8:25 ` Thomas Gleixner
@ 2026-07-15 8:43 ` Thomas Weißschuh
2026-07-15 9:03 ` Thomas Gleixner
2026-07-15 10:13 ` Arnd Bergmann
0 siblings, 2 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-15 8:43 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Arnd Bergmann, Andy Lutomirski, Vincenzo Frascino,
Nathan Chancellor, Nicolas Schier, Thomas Bogendoerfer,
Daniel Lezcano, Mark Rutland, Marc Zyngier, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Huacai Chen,
WANG Xuerui, linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch
On Wed, Jul 15, 2026 at 10:25:19AM +0200, Thomas Gleixner wrote:
> On Thu, Jul 09 2026 at 13:32, Thomas Weißschuh wrote:
> > Now that there is a dummy declaration of VDSO_CLOCKMODE_R4K, even if no
> > vDSO is built, the ugly ifdeffery can be replaced with a cleaner
> > IS_ENABLED() check.
>
> Duh. This stuff is really obfuscated. I just realized that the previous
> one actually expands the architecture defines to non-defined integer
> variable declarations.
>
> Smart, but seriously?
>
> I just double checked and it turns out that none of this ifdeffery is
> required. If CONFIG_GENERIC_GETTIMEOFDAY is disabled, then it does not
> matter at all whether the actual ARCH_CLOCK_VDSO_MODE is set in
> clocksource::vdso_mode or not.
>
> Nothing uses the vdso mode field outside of update_vsyscall and that's
> compiled out when CONFIG_GENERIC_GETTIMEOFDAY=n.
__clocksource_register_scale() does.
> So all what's required is:
>
> --- a/include/vdso/clocksource.h
> +++ b/include/vdso/clocksource.h
> @@ -3,14 +3,11 @@
> #define __VDSO_CLOCKSOURCE_H
>
> #include <vdso/limits.h>
> -
> -#ifdef CONFIG_GENERIC_GETTIMEOFDAY
> #include <asm/vdso/clocksource.h>
> -#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
> enum vdso_clock_mode {
> VDSO_CLOCKMODE_NONE,
> -#ifdef CONFIG_GENERIC_GETTIMEOFDAY
> +#ifdef VDSO_ARCH_CLOCKMODES
> VDSO_ARCH_CLOCKMODES,
> #endif
> VDSO_CLOCKMODE_MAX,
>
> and then you can just unconditionally set clocksource::vdso_clock_mode
> in all drivers.
>
> No?
It will weaken the sanity check in __clocksouce_register_scale() if
CONFIG_GENERIC_GETTIMEOFDAY=n. I am not sure what that sanity check
is supposed to protect against, so I left it as is.
If we can weaken the check, or maybe even remove it,
I'm all for your simpler aproach.
Thomas
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-15 8:43 ` Thomas Weißschuh
@ 2026-07-15 9:03 ` Thomas Gleixner
2026-07-15 10:13 ` Arnd Bergmann
1 sibling, 0 replies; 16+ messages in thread
From: Thomas Gleixner @ 2026-07-15 9:03 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Arnd Bergmann, Andy Lutomirski, Vincenzo Frascino,
Nathan Chancellor, Nicolas Schier, Thomas Bogendoerfer,
Daniel Lezcano, Mark Rutland, Marc Zyngier, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Huacai Chen,
WANG Xuerui, linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch
On Wed, Jul 15 2026 at 10:43, Thomas Weißschuh wrote:
> On Wed, Jul 15, 2026 at 10:25:19AM +0200, Thomas Gleixner wrote:
>> and then you can just unconditionally set clocksource::vdso_clock_mode
>> in all drivers.
>>
>> No?
>
> It will weaken the sanity check in __clocksouce_register_scale() if
> CONFIG_GENERIC_GETTIMEOFDAY=n. I am not sure what that sanity check
> is supposed to protect against, so I left it as is.
> If we can weaken the check, or maybe even remove it,
> I'm all for your simpler aproach.
The sanity check is there to catch random numbers being assigned. I
does not weaken when it's actually unused :)
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-15 8:43 ` Thomas Weißschuh
2026-07-15 9:03 ` Thomas Gleixner
@ 2026-07-15 10:13 ` Arnd Bergmann
2026-07-15 11:06 ` Thomas Weißschuh
1 sibling, 1 reply; 16+ messages in thread
From: Arnd Bergmann @ 2026-07-15 10:13 UTC (permalink / raw)
To: Thomas Weißschuh, Thomas Gleixner
Cc: Andy Lutomirski, Vincenzo Frascino, Nathan Chancellor,
Nicolas Schier, Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland,
Marc Zyngier, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Huacai Chen, WANG Xuerui, Linux-Arch,
linux-kernel, linux-kbuild, linux-mips, linux-arm-kernel,
linux-riscv, loongarch
On Wed, Jul 15, 2026, at 10:43, Thomas Weißschuh wrote:
> On Wed, Jul 15, 2026 at 10:25:19AM +0200, Thomas Gleixner wrote:
>> -#ifdef CONFIG_GENERIC_GETTIMEOFDAY
>> #include <asm/vdso/clocksource.h>
>> -#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
>> enum vdso_clock_mode {
>> VDSO_CLOCKMODE_NONE,
>> -#ifdef CONFIG_GENERIC_GETTIMEOFDAY
>> +#ifdef VDSO_ARCH_CLOCKMODES
>> VDSO_ARCH_CLOCKMODES,
>> #endif
>> VDSO_CLOCKMODE_MAX,
>>
>> and then you can just unconditionally set clocksource::vdso_clock_mode
>> in all drivers.
>>
>> No?
>
> It will weaken the sanity check in __clocksouce_register_scale() if
> CONFIG_GENERIC_GETTIMEOFDAY=n. I am not sure what that sanity check
> is supposed to protect against, so I left it as is.
Is there still a reason to even allow CONFIG_GENERIC_GETTIMEOFDAY=n
when generic VDSO is enabled? I see that loongarch32 and
riscv32 are still missing the vdso time support, but that may
be more a sign that nobody cares enough about performance
on those targets.
In particular, riscv64 doesn't even build the vdso32 code for
compat tasks, which indicates that userspace doesn't actually
need vdso. On loongarch32, the commit adding the vdso said
GENERIC_GETTIMEOFDAY 'will be supported in future'.
On everything else, GENERIC_GETTIMEOFDAY and HAVE_GENERIC_VDSO
are already synonyms.
Arnd
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-15 10:13 ` Arnd Bergmann
@ 2026-07-15 11:06 ` Thomas Weißschuh
0 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-15 11:06 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Thomas Gleixner, Andy Lutomirski, Vincenzo Frascino,
Nathan Chancellor, Nicolas Schier, Thomas Bogendoerfer,
Daniel Lezcano, Mark Rutland, Marc Zyngier, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Huacai Chen,
WANG Xuerui, Linux-Arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch
On Wed, Jul 15, 2026 at 12:13:06PM +0200, Arnd Bergmann wrote:
> On Wed, Jul 15, 2026, at 10:43, Thomas Weißschuh wrote:
> > On Wed, Jul 15, 2026 at 10:25:19AM +0200, Thomas Gleixner wrote:
>
> >> -#ifdef CONFIG_GENERIC_GETTIMEOFDAY
> >> #include <asm/vdso/clocksource.h>
> >> -#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
> >> enum vdso_clock_mode {
> >> VDSO_CLOCKMODE_NONE,
> >> -#ifdef CONFIG_GENERIC_GETTIMEOFDAY
> >> +#ifdef VDSO_ARCH_CLOCKMODES
> >> VDSO_ARCH_CLOCKMODES,
> >> #endif
> >> VDSO_CLOCKMODE_MAX,
> >>
> >> and then you can just unconditionally set clocksource::vdso_clock_mode
> >> in all drivers.
> >>
> >> No?
> >
> > It will weaken the sanity check in __clocksouce_register_scale() if
> > CONFIG_GENERIC_GETTIMEOFDAY=n. I am not sure what that sanity check
> > is supposed to protect against, so I left it as is.
See [0], where HAVE_GENERIC_VDSO is now VDSO_DATASTORE.
The naming "generic vDSO" does not make much sense anymore.
There are different pieces which are used in various combinations.
> Is there still a reason to even allow CONFIG_GENERIC_GETTIMEOFDAY=n
> when generic VDSO is enabled? I see that loongarch32 and
> riscv32 are still missing the vdso time support, but that may
> be more a sign that nobody cares enough about performance
> on those targets.
> In particular, riscv64 doesn't even build the vdso32 code for
> compat tasks, which indicates that userspace doesn't actually
> need vdso.
It doesn't build the time bits. But it has the hwprobe bits,
which do need the datastore (which is effectively HAVE_GENERIC_VDSO).
> On loongarch32, the commit adding the vdso said
> GENERIC_GETTIMEOFDAY 'will be supported in future'.
I have no idea if this port is even functional right now.
So far I was unable to run it in QEMU.
> On everything else, GENERIC_GETTIMEOFDAY and HAVE_GENERIC_VDSO
> are already synonyms.
[0] https://lore.kernel.org/lkml/20260709-vdso-have_generic_vdso-v1-0-d2e1061f268b@linutronix.de/
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 4/7] clocksource/drivers/mips-gic-timer: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-09 11:32 [PATCH 0/7] vDSO: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
` (2 preceding siblings ...)
2026-07-09 11:32 ` [PATCH 3/7] MIPS: csrc-r4k: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
@ 2026-07-09 11:32 ` Thomas Weißschuh
2026-07-09 11:32 ` [PATCH 5/7] clocksource/drivers/arm_arch_timer: " Thomas Weißschuh
` (2 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
Now that there is a dummy declaration of VDSO_CLOCKMODE_GIC, even if no
vDSO is built, the ugly ifdeffery can be replaced with a cleaner
IS_ENABLED() check.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
drivers/clocksource/mips-gic-timer.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index a1669266c94d..0dd30ba3cce7 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -198,9 +198,8 @@ static struct clocksource gic_clocksource = {
.name = "GIC",
.read = gic_hpt_read,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
- .vdso_clock_mode = VDSO_CLOCKMODE_GIC,
-#endif
+ .vdso_clock_mode = IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) ?
+ VDSO_CLOCKMODE_GIC : VDSO_CLOCKMODE_NONE,
};
static void gic_clocksource_unstable(char *reason)
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 5/7] clocksource/drivers/arm_arch_timer: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-09 11:32 [PATCH 0/7] vDSO: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
` (3 preceding siblings ...)
2026-07-09 11:32 ` [PATCH 4/7] clocksource/drivers/mips-gic-timer: " Thomas Weißschuh
@ 2026-07-09 11:32 ` Thomas Weißschuh
2026-07-13 15:23 ` Marc Zyngier
2026-07-09 11:32 ` [PATCH 6/7] clocksource/drivers/timer-riscv: " Thomas Weißschuh
2026-07-09 11:32 ` [PATCH 7/7] LoongArch: " Thomas Weißschuh
6 siblings, 1 reply; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
Now that there is a dummy declaration of VDSO_CLOCKMODE_ARCHTIMER,
even if no vDSO is built, the ugly ifdeffery can be replaced with
a cleaner IS_ENABLED() check.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
drivers/clocksource/arm_arch_timer.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 4adf756423de..d67125a8730a 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -56,11 +56,8 @@ static struct clock_event_device __percpu *arch_timer_evt;
static enum arch_timer_ppi_nr arch_timer_uses_ppi __ro_after_init = ARCH_TIMER_VIRT_PPI;
static bool arch_timer_c3stop __ro_after_init;
static bool arch_counter_suspend_stop __ro_after_init;
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
-static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_ARCHTIMER;
-#else
-static enum vdso_clock_mode vdso_default = VDSO_CLOCKMODE_NONE;
-#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
+static enum vdso_clock_mode vdso_default = IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) ?
+ VDSO_CLOCKMODE_ARCHTIMER : VDSO_CLOCKMODE_NONE;
static cpumask_t evtstrm_available = CPU_MASK_NONE;
static bool evtstrm_enable __ro_after_init = IS_ENABLED(CONFIG_ARM_ARCH_TIMER_EVTSTREAM);
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH 5/7] clocksource/drivers/arm_arch_timer: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-09 11:32 ` [PATCH 5/7] clocksource/drivers/arm_arch_timer: " Thomas Weißschuh
@ 2026-07-13 15:23 ` Marc Zyngier
0 siblings, 0 replies; 16+ messages in thread
From: Marc Zyngier @ 2026-07-13 15:23 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Huacai Chen,
WANG Xuerui, linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch
On Thu, 09 Jul 2026 12:32:41 +0100,
Thomas Weißschuh <thomas.weissschuh@linutronix.de> wrote:
>
> Now that there is a dummy declaration of VDSO_CLOCKMODE_ARCHTIMER,
> even if no vDSO is built, the ugly ifdeffery can be replaced with
> a cleaner IS_ENABLED() check.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Jazz isn't dead. It just smells funny.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 6/7] clocksource/drivers/timer-riscv: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-09 11:32 [PATCH 0/7] vDSO: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
` (4 preceding siblings ...)
2026-07-09 11:32 ` [PATCH 5/7] clocksource/drivers/arm_arch_timer: " Thomas Weißschuh
@ 2026-07-09 11:32 ` Thomas Weißschuh
2026-07-09 11:32 ` [PATCH 7/7] LoongArch: " Thomas Weißschuh
6 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
Now that there is a dummy declaration of VDSO_CLOCKMODE_ARCHTIMER,
even if no vDSO is built, the ugly ifdeffery can be replaced with
a cleaner IS_ENABLED() check.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
drivers/clocksource/timer-riscv.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
index cfc4d83c42c0..82bd380b3dda 100644
--- a/drivers/clocksource/timer-riscv.c
+++ b/drivers/clocksource/timer-riscv.c
@@ -98,11 +98,8 @@ static struct clocksource riscv_clocksource = {
.mask = CLOCKSOURCE_MASK(64),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
.read = riscv_clocksource_rdtime,
-#if IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)
- .vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER,
-#else
- .vdso_clock_mode = VDSO_CLOCKMODE_NONE,
-#endif
+ .vdso_clock_mode = IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) ?
+ VDSO_CLOCKMODE_ARCHTIMER : VDSO_CLOCKMODE_NONE,
};
static int riscv_timer_starting_cpu(unsigned int cpu)
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH 7/7] LoongArch: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED()
2026-07-09 11:32 [PATCH 0/7] vDSO: Replace CONFIG_GENERIC_GETTIMEOFDAY ifdeffery with IS_ENABLED() Thomas Weißschuh
` (5 preceding siblings ...)
2026-07-09 11:32 ` [PATCH 6/7] clocksource/drivers/timer-riscv: " Thomas Weißschuh
@ 2026-07-09 11:32 ` Thomas Weißschuh
6 siblings, 0 replies; 16+ messages in thread
From: Thomas Weißschuh @ 2026-07-09 11:32 UTC (permalink / raw)
To: Arnd Bergmann, Andy Lutomirski, Thomas Gleixner,
Vincenzo Frascino, Nathan Chancellor, Nicolas Schier,
Thomas Bogendoerfer, Daniel Lezcano, Mark Rutland, Marc Zyngier,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Huacai Chen, WANG Xuerui
Cc: linux-arch, linux-kernel, linux-kbuild, linux-mips,
linux-arm-kernel, linux-riscv, loongarch, Thomas Weißschuh
Now that there is a dummy declaration of VDSO_CLOCKMODE_CPU, even if no
vDSO is built, the ugly ifdeffery can be replaced with a cleaner
IS_ENABLED() check.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/loongarch/kernel/time.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c
index dbaaabcaf6f0..dfc04d9f342e 100644
--- a/arch/loongarch/kernel/time.c
+++ b/arch/loongarch/kernel/time.c
@@ -212,9 +212,8 @@ static struct clocksource clocksource_const = {
.read = read_const_counter,
.mask = CLOCKSOURCE_MASK(64),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
- .vdso_clock_mode = VDSO_CLOCKMODE_CPU,
-#endif
+ .vdso_clock_mode = IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) ?
+ VDSO_CLOCKMODE_CPU : VDSO_CLOCKMODE_NONE,
};
int __init constant_clocksource_init(void)
--
2.55.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 16+ messages in thread