From: Fang Xieyan <fangxy@xiaopeng.com>
To: Andy Lutomirski <luto@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
x86@kernel.org
Cc: "Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Huacai Chen" <chenhuacai@kernel.org>,
"WANG Xuerui" <kernel@xen0n.name>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2/5] x86/vdso: Drop redundant kernel header includes
Date: Tue, 1 Dec 2026 19:55:20 +0800 [thread overview]
Message-ID: <20261201115523.75606-3-fangxy@xiaopeng.com> (raw)
In-Reply-To: <20261201115523.75606-1-fangxy@xiaopeng.com>
Preparation for switching the sanctioned include/vdso headers over to a
self-contained <vdso/types.h>.
The x86 vDSO sources include <linux/time.h>, <linux/kernel.h> and
<linux/types.h> even though everything they need comes from the vdso
headers they also include. Drop those redundant includes.
<linux/kernel.h> in vgetcpu.c was not purely redundant: the
<asm/segment.h> it also includes uses X86_FEATURE_RDPID in
vdso_read_cpunode() and relies on its includer to provide
<asm/cpufeatures.h>, so replace it with that header there.
Likewise drop the redundant <uapi/linux/time.h> includes from vgtod.h
and asm/vdso/gettimeofday.h: the clock IDs are already provided via
vdso/datapage.h and the includes that follow them.
One include had to be made explicit rather than dropped: on 32-bit
builds asm/div64.h provides an mul_u32_u32() implementation that must
take precedence over the generic fallback in vdso/math64.h. Previously
<linux/time.h> pulled asm/div64.h in before lib/vdso/gettimeofday.c
reaches vdso/math64.h, so the x86 implementation won. Include
<asm/div64.h> directly in vclock_gettime.c to keep that ordering
instead of relying on the kernel header chain.
No functional change intended.
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
---
Build-tested on x86_64 defconfig (CONFIG_IA32_EMULATION=y, with
CONFIG_X86_X32_ABI) and native i386 defconfig at this commit: bzImage
builds with 0 errors, keeping the series bisectable. On i386, the
resulting vdso32 vclock_gettime.o is size-identical to the unpatched
baseline with matching per-function sizes, and the -E -dD dump of the
translation unit shows the mul_u32_u32() macro being defined right at
the asm/div64.h implementation, confirming the x86 one is in effect.
arch/x86/entry/vdso/common/vclock_gettime.c | 10 +++++++---
arch/x86/entry/vdso/common/vgetcpu.c | 2 +-
arch/x86/entry/vdso/vdso64/vgetrandom.c | 2 --
arch/x86/include/asm/vdso/gettimeofday.h | 1 -
arch/x86/include/asm/vgtod.h | 2 --
5 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/arch/x86/entry/vdso/common/vclock_gettime.c b/arch/x86/entry/vdso/common/vclock_gettime.c
index 304dbd1f9db4..edef05f26d59 100644
--- a/arch/x86/entry/vdso/common/vclock_gettime.c
+++ b/arch/x86/entry/vdso/common/vclock_gettime.c
@@ -8,10 +8,14 @@
* 32 Bit compat layer by Stefani Seibold <stefani@seibold.net>
* sponsored by Rohde & Schwarz GmbH & Co. KG Munich/Germany
*/
-#include <linux/time.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
#include <vdso/gettime.h>
+/*
+ * Include asm/div64.h before the generic mul_u32_u32() fallback that
+ * vdso/math64.h provides on 32-bit builds, so the x86 implementation
+ * keeps taking effect; dropping <linux/time.h> used to lose that
+ * include ordering.
+ */
+#include <asm/div64.h>
#include "lib/vdso/gettimeofday.c"
diff --git a/arch/x86/entry/vdso/common/vgetcpu.c b/arch/x86/entry/vdso/common/vgetcpu.c
index 6381b472b7c5..6990491e0e48 100644
--- a/arch/x86/entry/vdso/common/vgetcpu.c
+++ b/arch/x86/entry/vdso/common/vgetcpu.c
@@ -5,7 +5,7 @@
* Fast user context implementation of getcpu()
*/
-#include <linux/kernel.h>
+#include <asm/cpufeatures.h>
#include <asm/segment.h>
#include <vdso/processor.h>
diff --git a/arch/x86/entry/vdso/vdso64/vgetrandom.c b/arch/x86/entry/vdso/vdso64/vgetrandom.c
index 6a95d36b12d9..b7154e1b7c60 100644
--- a/arch/x86/entry/vdso/vdso64/vgetrandom.c
+++ b/arch/x86/entry/vdso/vdso64/vgetrandom.c
@@ -2,8 +2,6 @@
/*
* Copyright (C) 2022-2024 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <linux/types.h>
-
#include "lib/vdso/getrandom.c"
ssize_t __vdso_getrandom(void *buffer, size_t len, unsigned int flags, void *opaque_state, size_t opaque_len)
diff --git a/arch/x86/include/asm/vdso/gettimeofday.h b/arch/x86/include/asm/vdso/gettimeofday.h
index 3cf214cc4a75..73794aecefdc 100644
--- a/arch/x86/include/asm/vdso/gettimeofday.h
+++ b/arch/x86/include/asm/vdso/gettimeofday.h
@@ -12,7 +12,6 @@
#ifndef __ASSEMBLER__
-#include <uapi/linux/time.h>
#include <asm/vgtod.h>
#include <asm/unistd.h>
#include <asm/msr.h>
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index a0ce291abcae..5db3e1bc8b76 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -12,8 +12,6 @@
#include <vdso/datapage.h>
#include <vdso/helpers.h>
-#include <uapi/linux/time.h>
-
#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
#endif /* _ASM_X86_VGTOD_H */
--
2.50.1
next prev parent reply other threads:[~2026-12-01 11:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 11:55 [RFC PATCH 0/5] vdso: Provide a sanitized subset of UAPI types for vDSO code Fang Xieyan
2026-12-01 11:55 ` [RFC PATCH 1/5] vdso: Provide a sanitized subset of UAPI types Fang Xieyan
2026-12-01 11:55 ` Fang Xieyan [this message]
2026-12-01 11:55 ` [RFC PATCH 3/5] vdso: Switch the sanctioned headers to vdso/types.h Fang Xieyan
2026-12-01 11:55 ` [RFC PATCH 4/5] riscv: Drop redundant internal header includes from the vDSO sources Fang Xieyan
2026-12-01 11:55 ` [RFC PATCH 5/5] loongarch: " Fang Xieyan
-- strict thread matches above, loose matches on Subject: below --
2026-12-01 10:24 [RFC PATCH 0/5] vdso: Provide a sanitized subset of UAPI types for vDSO code Fang Xieyan
2026-12-01 10:24 ` [RFC PATCH 2/5] x86/vdso: Drop redundant kernel header includes Fang Xieyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201115523.75606-3-fangxy@xiaopeng.com \
--to=fangxy@xiaopeng.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=chenhuacai@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=kernel@xen0n.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@weissschuh.net \
--cc=loongarch@lists.linux.dev \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=tglx@kernel.org \
--cc=vincenzo.frascino@arm.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®