* [patch 0/2] x86/vdso: Address sparse warnings
@ 2026-01-17 21:58 Thomas Gleixner
2026-01-17 21:58 ` [patch 1/2] x86/vdso: Tweak CHECKFLAGS for 32-bit VDSO build Thomas Gleixner
2026-01-17 21:58 ` [patch 2/2] x86/vdso: Prevent empty switch case warning Thomas Gleixner
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Gleixner @ 2026-01-17 21:58 UTC (permalink / raw)
To: LKML; +Cc: x86, Thomas Weißschuh
Sparse is unhappy when building the 32-bit VDSO for a 64-bit kernel and
complains about an empty switch statement when all config knobs which guard
the cases are disabled.
The following series cures both.
Thanks,
tglx
---
Makefile | 4 ++++
vma.c | 2 ++
2 files changed, 6 insertions(+)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 1/2] x86/vdso: Tweak CHECKFLAGS for 32-bit VDSO build
2026-01-17 21:58 [patch 0/2] x86/vdso: Address sparse warnings Thomas Gleixner
@ 2026-01-17 21:58 ` Thomas Gleixner
2026-01-19 7:18 ` Thomas Weißschuh
2026-01-17 21:58 ` [patch 2/2] x86/vdso: Prevent empty switch case warning Thomas Gleixner
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2026-01-17 21:58 UTC (permalink / raw)
To: LKML; +Cc: x86, Thomas Weißschuh
Sparse complains about a too large shift in the VDSO32 source file:
arch/x86/entry/vdso/vdso32/vclock_gettime.c: note: in included file (through /home/tglx/work/kernel/tip/tip/arch/x86/entry/vdso/vdso32/../vclock_gettime.c):
arch/x86/entry/vdso/vdso32/../../../../../lib/vdso/gettimeofday.c:454:26: warning: shift too big (40) for type unsigned long
That's because sparse is invoked with -D__x86_64__ -m64 on the command
line, which causes it to use __BITS_PER_LONG = 64. That causes __GENMASK()
to use a way too big shift value.
Give the CHECKFLAGS which are handed to sparse a similar treatment as
KBUILD_CFLAGS get for the 32-bit VDSO build.
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
---
arch/x86/entry/vdso/Makefile | 4 ++++
1 file changed, 4 insertions(+)
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -144,6 +144,10 @@ endif
$(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
+CHECKFLAGS_32 := $(subst -m64,-m32,$(CHECKFLAGS))
+CHECKFLAGS_32 := $(subst -D__x86_64__,-D__i386__,$(CHECKFLAGS_32))
+$(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
+
$(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE
$(call if_changed,vdso_and_check)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 2/2] x86/vdso: Prevent empty switch case warning
2026-01-17 21:58 [patch 0/2] x86/vdso: Address sparse warnings Thomas Gleixner
2026-01-17 21:58 ` [patch 1/2] x86/vdso: Tweak CHECKFLAGS for 32-bit VDSO build Thomas Gleixner
@ 2026-01-17 21:58 ` Thomas Gleixner
2026-01-19 7:16 ` Thomas Weißschuh
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2026-01-17 21:58 UTC (permalink / raw)
To: LKML; +Cc: x86, Thomas Weißschuh
Sparse complains rightfully when CONFIG_PARAVIRT_CLOCK and
CONFIG_HYPERV_TIMER are both not set:
arch/x86/entry/vdso/vma.c:94:9: warning: switch with no cases
Add a default case to fix that.
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
---
arch/x86/entry/vdso/vma.c | 2 ++
1 file changed, 2 insertions(+)
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -114,6 +114,8 @@ static vm_fault_t vvar_vclock_fault(cons
break;
}
#endif /* CONFIG_HYPERV_TIMER */
+ default:
+ break;
}
return VM_FAULT_SIGBUS;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 2/2] x86/vdso: Prevent empty switch case warning
2026-01-17 21:58 ` [patch 2/2] x86/vdso: Prevent empty switch case warning Thomas Gleixner
@ 2026-01-19 7:16 ` Thomas Weißschuh
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Weißschuh @ 2026-01-19 7:16 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: LKML, x86
Hi,
On Sat, Jan 17, 2026 at 10:58:27PM +0100, Thomas Gleixner wrote:
> Sparse complains rightfully when CONFIG_PARAVIRT_CLOCK and
> CONFIG_HYPERV_TIMER are both not set:
>
> arch/x86/entry/vdso/vma.c:94:9: warning: switch with no cases
>
> Add a default case to fix that.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> ---
> arch/x86/entry/vdso/vma.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> --- a/arch/x86/entry/vdso/vma.c
> +++ b/arch/x86/entry/vdso/vma.c
> @@ -114,6 +114,8 @@ static vm_fault_t vvar_vclock_fault(cons
> break;
> }
> #endif /* CONFIG_HYPERV_TIMER */
> + default:
> + break;
This makes the code uglier only to pacify sparse.
It turns out all the necessary stub functions are in place to just
delete the ifdefs altogether. Maybe replace them with IS_ENABLED()
to make it clearer to reader what is going on.
> }
>
> return VM_FAULT_SIGBUS;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 1/2] x86/vdso: Tweak CHECKFLAGS for 32-bit VDSO build
2026-01-17 21:58 ` [patch 1/2] x86/vdso: Tweak CHECKFLAGS for 32-bit VDSO build Thomas Gleixner
@ 2026-01-19 7:18 ` Thomas Weißschuh
2026-01-22 14:06 ` Thomas Gleixner
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Weißschuh @ 2026-01-19 7:18 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: LKML, x86
On Sat, Jan 17, 2026 at 10:58:25PM +0100, Thomas Gleixner wrote:
> Sparse complains about a too large shift in the VDSO32 source file:
>
> arch/x86/entry/vdso/vdso32/vclock_gettime.c: note: in included file (through /home/tglx/work/kernel/tip/tip/arch/x86/entry/vdso/vdso32/../vclock_gettime.c):
> arch/x86/entry/vdso/vdso32/../../../../../lib/vdso/gettimeofday.c:454:26: warning: shift too big (40) for type unsigned long
>
> That's because sparse is invoked with -D__x86_64__ -m64 on the command
> line, which causes it to use __BITS_PER_LONG = 64. That causes __GENMASK()
> to use a way too big shift value.
>
> Give the CHECKFLAGS which are handed to sparse a similar treatment as
> KBUILD_CFLAGS get for the 32-bit VDSO build.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> arch/x86/entry/vdso/Makefile | 4 ++++
> 1 file changed, 4 insertions(+)
>
> --- a/arch/x86/entry/vdso/Makefile
> +++ b/arch/x86/entry/vdso/Makefile
> @@ -144,6 +144,10 @@ endif
>
> $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
>
> +CHECKFLAGS_32 := $(subst -m64,-m32,$(CHECKFLAGS))
> +CHECKFLAGS_32 := $(subst -D__x86_64__,-D__i386__,$(CHECKFLAGS_32))
> +$(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
It would be nice if we had a strict variant of $(subst ...) which errors
out if nothing is substituted.
> +
> $(obj)/vdso32.so.dbg: $(obj)/vdso32/vdso32.lds $(vobjs32) FORCE
> $(call if_changed,vdso_and_check)
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 1/2] x86/vdso: Tweak CHECKFLAGS for 32-bit VDSO build
2026-01-19 7:18 ` Thomas Weißschuh
@ 2026-01-22 14:06 ` Thomas Gleixner
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2026-01-22 14:06 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: LKML, x86
On Mon, Jan 19 2026 at 08:18, Thomas Weißschuh wrote:
> On Sat, Jan 17, 2026 at 10:58:25PM +0100, Thomas Gleixner wrote:
>> $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
>>
>> +CHECKFLAGS_32 := $(subst -m64,-m32,$(CHECKFLAGS))
>> +CHECKFLAGS_32 := $(subst -D__x86_64__,-D__i386__,$(CHECKFLAGS_32))
>> +$(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
>
> It would be nice if we had a strict variant of $(subst ...) which errors
> out if nothing is substituted.
Which would fail a arch=i386 build then, no? :)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-01-22 14:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-17 21:58 [patch 0/2] x86/vdso: Address sparse warnings Thomas Gleixner
2026-01-17 21:58 ` [patch 1/2] x86/vdso: Tweak CHECKFLAGS for 32-bit VDSO build Thomas Gleixner
2026-01-19 7:18 ` Thomas Weißschuh
2026-01-22 14:06 ` Thomas Gleixner
2026-01-17 21:58 ` [patch 2/2] x86/vdso: Prevent empty switch case warning Thomas Gleixner
2026-01-19 7:16 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox