diff --git a/MAINTAINERS b/MAINTAINERS index 3a19da74d00c9d..21c590dd28b650 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11064,8 +11064,8 @@ M: Vincenzo Frascino L: linux-kernel@vger.kernel.org S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso -F: include/asm-generic/vdso/vsyscall.h F: include/linux/vdso_datastore.h +F: include/linux/vdso_time.h F: include/vdso/ F: kernel/time/namespace_vdso.c F: kernel/time/vsyscall.c diff --git a/arch/arm/include/asm/vdso/vsyscall.h b/arch/arm/include/asm/vdso/vsyscall.h index ff1c729af05f03..b97dda100e52c2 100644 --- a/arch/arm/include/asm/vdso/vsyscall.h +++ b/arch/arm/include/asm/vdso/vsyscall.h @@ -2,8 +2,6 @@ #ifndef __ASM_VDSO_VSYSCALL_H #define __ASM_VDSO_VSYSCALL_H -#ifndef __ASSEMBLY__ - #include #include @@ -14,9 +12,4 @@ void __arch_sync_vdso_time_data(struct vdso_time_data *vdata) } #define __arch_sync_vdso_time_data __arch_sync_vdso_time_data -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLY__ */ - #endif /* __ASM_VDSO_VSYSCALL_H */ diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index e306d0c5a21c4d..7be871f5eb9e10 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c @@ -23,7 +23,6 @@ #include #include #include -#include #define MAX_SYMNAME 64 diff --git a/arch/arm64/include/asm/vdso/getrandom.h b/arch/arm64/include/asm/vdso/getrandom.h index da1d58bbfabe85..d9b9104d4ea1eb 100644 --- a/arch/arm64/include/asm/vdso/getrandom.h +++ b/arch/arm64/include/asm/vdso/getrandom.h @@ -6,7 +6,6 @@ #ifndef __ASSEMBLER__ #include -#include #include /** diff --git a/arch/arm64/include/asm/vdso/vsyscall.h b/arch/arm64/include/asm/vdso/vsyscall.h index 3f3c8eb74e2e32..7c46c37fd36f0e 100644 --- a/arch/arm64/include/asm/vdso/vsyscall.h +++ b/arch/arm64/include/asm/vdso/vsyscall.h @@ -2,8 +2,6 @@ #ifndef __ASM_VDSO_VSYSCALL_H #define __ASM_VDSO_VSYSCALL_H -#ifndef __ASSEMBLER__ - #include #define VDSO_PRECISION_MASK ~(0xFF00ULL<<48) @@ -19,9 +17,4 @@ void __arch_update_vdso_clock(struct vdso_clock *vc) } #define __arch_update_vdso_clock __arch_update_vdso_clock -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLER__ */ - #endif /* __ASM_VDSO_VSYSCALL_H */ diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 592dd8668de463..50596dab23f990 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S index 52314be2919121..6334ca0a767341 100644 --- a/arch/arm64/kernel/vdso/vdso.lds.S +++ b/arch/arm64/kernel/vdso/vdso.lds.S @@ -11,7 +11,6 @@ #include #include #include -#include #include #include diff --git a/arch/loongarch/include/asm/vdso/vsyscall.h b/arch/loongarch/include/asm/vdso/vsyscall.h deleted file mode 100644 index 558eb9dfda5203..00000000000000 --- a/arch/loongarch/include/asm/vdso/vsyscall.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_VDSO_VSYSCALL_H -#define __ASM_VDSO_VSYSCALL_H - -#ifndef __ASSEMBLER__ - -#include - -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLER__ */ - -#endif /* __ASM_VDSO_VSYSCALL_H */ diff --git a/arch/loongarch/kernel/vdso.c b/arch/loongarch/kernel/vdso.c index 8ce8159c10b938..1edc8fb720dea8 100644 --- a/arch/loongarch/kernel/vdso.c +++ b/arch/loongarch/kernel/vdso.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include diff --git a/arch/mips/include/asm/vdso/vsyscall.h b/arch/mips/include/asm/vdso/vsyscall.h deleted file mode 100644 index 0f061a9babd133..00000000000000 --- a/arch/mips/include/asm/vdso/vsyscall.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_VDSO_VSYSCALL_H -#define __ASM_VDSO_VSYSCALL_H - -#include - -#ifndef __ASSEMBLER__ - -#include - -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLER__ */ - -#endif /* __ASM_VDSO_VSYSCALL_H */ diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index 8165dd3fc1f86a..8eb1760a8a9b1e 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c @@ -23,7 +23,6 @@ #include #include #include -#include static_assert(VDSO_NR_PAGES == __VDSO_PAGES); diff --git a/arch/powerpc/include/asm/vdso/vsyscall.h b/arch/powerpc/include/asm/vdso/vsyscall.h deleted file mode 100644 index bee18e8660a027..00000000000000 --- a/arch/powerpc/include/asm/vdso/vsyscall.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_POWERPC_VDSO_VSYSCALL_H -#define _ASM_POWERPC_VDSO_VSYSCALL_H - -#ifndef __ASSEMBLER__ - -#include - -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLER__ */ - -#endif /* _ASM_POWERPC_VDSO_VSYSCALL_H */ diff --git a/arch/riscv/include/asm/vdso/vsyscall.h b/arch/riscv/include/asm/vdso/vsyscall.h deleted file mode 100644 index 558eb9dfda5203..00000000000000 --- a/arch/riscv/include/asm/vdso/vsyscall.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_VDSO_VSYSCALL_H -#define __ASM_VDSO_VSYSCALL_H - -#ifndef __ASSEMBLER__ - -#include - -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLER__ */ - -#endif /* __ASM_VDSO_VSYSCALL_H */ diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 7818e1d32622dd..d427d2f02c6064 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #define EXT_KEY(isa_arg, ext, pv, missing) \ diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c index 9c2f5e44233899..5666cec180ac22 100644 --- a/arch/riscv/kernel/vdso.c +++ b/arch/riscv/kernel/vdso.c @@ -15,7 +15,6 @@ #include #include #include -#include #define VVAR_SIZE (VDSO_NR_PAGES << PAGE_SHIFT) diff --git a/arch/s390/include/asm/vdso/getrandom.h b/arch/s390/include/asm/vdso/getrandom.h index 6741a27199f8b5..ff5882f2fc70be 100644 --- a/arch/s390/include/asm/vdso/getrandom.h +++ b/arch/s390/include/asm/vdso/getrandom.h @@ -6,7 +6,6 @@ #ifndef __ASSEMBLER__ #include -#include #include #include #include diff --git a/arch/s390/include/asm/vdso/vsyscall.h b/arch/s390/include/asm/vdso/vsyscall.h deleted file mode 100644 index b00acec8ddbc7e..00000000000000 --- a/arch/s390/include/asm/vdso/vsyscall.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_VDSO_VSYSCALL_H -#define __ASM_VDSO_VSYSCALL_H - -#ifndef __ASSEMBLER__ - -#include -#include -#include - -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLER__ */ - -#endif /* __ASM_VDSO_VSYSCALL_H */ diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index 2b989bebd220ad..bca65bf1c8cb62 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -527,7 +527,7 @@ static int stp_sync_clock(void *data) cpu_relax(); rc = 0; if (stp_info.todoff || stp_info.tmd != 2) { - flags = vdso_update_begin(); + flags = vdso_time_update_begin(); rc = chsc_sstpc(stp_page, STP_OP_SYNC, 0, &clock_delta); if (rc == 0) { @@ -537,7 +537,7 @@ static int stp_sync_clock(void *data) if (rc == 0 && stp_info.tmd != 2) rc = -EAGAIN; } - vdso_update_end(flags); + vdso_time_update_end(flags); } sync->in_sync = rc ? -EAGAIN : 1; xchg(&first, 0); diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index 0fe616c49fccef..a905f989f9101f 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/arch/s390/kernel/vdso/vdso.lds.S b/arch/s390/kernel/vdso/vdso.lds.S index 841daeec4be266..6bcdb64315f28c 100644 --- a/arch/s390/kernel/vdso/vdso.lds.S +++ b/arch/s390/kernel/vdso/vdso.lds.S @@ -4,7 +4,6 @@ * library */ -#include #include #include #include diff --git a/arch/sparc/include/asm/vdso.h b/arch/sparc/include/asm/vdso.h index f08562d10215bd..b17c37c8075b99 100644 --- a/arch/sparc/include/asm/vdso.h +++ b/arch/sparc/include/asm/vdso.h @@ -5,6 +5,10 @@ #ifndef _ASM_SPARC_VDSO_H #define _ASM_SPARC_VDSO_H +#define __VDSO_PAGES 4 + +#ifndef __ASSEMBLER__ + struct vdso_image { void *data; unsigned long size; /* Always a multiple of PAGE_SIZE */ @@ -17,4 +21,6 @@ extern const struct vdso_image vdso_image_64_builtin; extern const struct vdso_image vdso_image_32_builtin; #endif +#endif /* __ASSEMBLER__ */ + #endif /* _ASM_SPARC_VDSO_H */ diff --git a/arch/sparc/include/asm/vdso/vsyscall.h b/arch/sparc/include/asm/vdso/vsyscall.h deleted file mode 100644 index 8bfe703fedc56f..00000000000000 --- a/arch/sparc/include/asm/vdso/vsyscall.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#ifndef _ASM_SPARC_VDSO_VSYSCALL_H -#define _ASM_SPARC_VDSO_VSYSCALL_H - -#define __VDSO_PAGES 4 - -#include - -#endif /* _ASM_SPARC_VDSO_VSYSCALL_H */ diff --git a/arch/sparc/vdso/vdso-layout.lds.S b/arch/sparc/vdso/vdso-layout.lds.S index 180e5d0ee07170..920396203a2ecf 100644 --- a/arch/sparc/vdso/vdso-layout.lds.S +++ b/arch/sparc/vdso/vdso-layout.lds.S @@ -6,7 +6,7 @@ #include #include -#include +#include SECTIONS { diff --git a/arch/sparc/vdso/vma.c b/arch/sparc/vdso/vma.c index 60029d60f4d3a1..ab6626c1ee614f 100644 --- a/arch/sparc/vdso/vma.c +++ b/arch/sparc/vdso/vma.c @@ -23,7 +23,6 @@ #include #include -#include unsigned int __read_mostly vdso_enabled = 1; diff --git a/arch/x86/entry/vdso/common/vdso-layout.lds.S b/arch/x86/entry/vdso/common/vdso-layout.lds.S index a1e30be3e83d41..f190efbc640e01 100644 --- a/arch/x86/entry/vdso/common/vdso-layout.lds.S +++ b/arch/x86/entry/vdso/common/vdso-layout.lds.S @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 */ #include -#include #include /* diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 18dfd80a81ef24..4bd3b22beea930 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -25,7 +25,6 @@ #include #include #include -#include #include static_assert(VDSO_NR_PAGES + VDSO_NR_VCLOCK_PAGES == __VDSO_PAGES); diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h index 4e735158c1b283..071e4a262b50b4 100644 --- a/arch/x86/include/asm/vdso.h +++ b/arch/x86/include/asm/vdso.h @@ -6,6 +6,13 @@ #include #include +#define __VDSO_PAGES 6 + +#define VDSO_NR_VCLOCK_PAGES 2 +#define VDSO_VCLOCK_PAGES_START(_b) ((_b) + (__VDSO_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE) +#define VDSO_PAGE_PVCLOCK_OFFSET 0 +#define VDSO_PAGE_HVCLOCK_OFFSET 1 + #ifndef __ASSEMBLER__ #include diff --git a/arch/x86/include/asm/vdso/vsyscall.h b/arch/x86/include/asm/vdso/vsyscall.h deleted file mode 100644 index 4aa311a923f233..00000000000000 --- a/arch/x86/include/asm/vdso/vsyscall.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_VDSO_VSYSCALL_H -#define __ASM_VDSO_VSYSCALL_H - -#define __VDSO_PAGES 6 - -#define VDSO_NR_VCLOCK_PAGES 2 -#define VDSO_VCLOCK_PAGES_START(_b) ((_b) + (__VDSO_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE) -#define VDSO_PAGE_PVCLOCK_OFFSET 0 -#define VDSO_PAGE_HVCLOCK_OFFSET 1 - -#ifndef __ASSEMBLER__ - -#include -#include - -/* The asm-generic header needs to be included after the definitions above */ -#include - -#endif /* !__ASSEMBLER__ */ - -#endif /* __ASM_VDSO_VSYSCALL_H */ diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild index 2bc00c67dc54b9..b7a388bef6ea0a 100644 --- a/include/asm-generic/Kbuild +++ b/include/asm-generic/Kbuild @@ -63,6 +63,7 @@ mandatory-y += trace_clock.h mandatory-y += uaccess.h mandatory-y += unwind_user.h mandatory-y += vdso/clocksource.h +mandatory-y += vdso/vsyscall.h mandatory-y += vermagic.h mandatory-y += vga.h mandatory-y += video.h diff --git a/include/asm-generic/vdso/vsyscall.h b/include/asm-generic/vdso/vsyscall.h index a6b03cfba0e245..e69de29bb2d1d6 100644 --- a/include/asm-generic/vdso/vsyscall.h +++ b/include/asm-generic/vdso/vsyscall.h @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_GENERIC_VSYSCALL_H -#define __ASM_GENERIC_VSYSCALL_H - -#ifndef __ASSEMBLER__ - -#ifndef __arch_get_vdso_u_time_data -static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void) -{ - return &vdso_u_time_data; -} -#endif - -#ifndef __arch_get_vdso_u_rng_data -static __always_inline const struct vdso_rng_data *__arch_get_vdso_u_rng_data(void) -{ - return &vdso_u_rng_data; -} -#endif - -#ifndef __arch_update_vdso_clock -static __always_inline void __arch_update_vdso_clock(struct vdso_clock *vc) -{ -} -#endif /* __arch_update_vdso_clock */ - -#ifndef __arch_sync_vdso_time_data -static __always_inline void __arch_sync_vdso_time_data(struct vdso_time_data *vdata) -{ -} -#endif /* __arch_sync_vdso_time_data */ - -#endif /* !__ASSEMBLER__ */ - -#endif /* __ASM_GENERIC_VSYSCALL_H */ diff --git a/include/linux/vdso_time.h b/include/linux/vdso_time.h new file mode 100644 index 00000000000000..6d81ee3a3c9c34 --- /dev/null +++ b/include/linux/vdso_time.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_VDSO_TIME_H +#define _LINUX_VDSO_TIME_H + +unsigned long vdso_time_update_begin(void); +void vdso_time_update_end(unsigned long flags); + +#endif /* _LINUX_VDSO_TIME_H */ diff --git a/include/vdso/vsyscall.h b/include/vdso/vsyscall.h index c5c2a2c078571d..af62bbf04eacda 100644 --- a/include/vdso/vsyscall.h +++ b/include/vdso/vsyscall.h @@ -2,13 +2,6 @@ #ifndef __VDSO_VSYSCALL_H #define __VDSO_VSYSCALL_H -#ifndef __ASSEMBLER__ - #include -unsigned long vdso_update_begin(void); -void vdso_update_end(unsigned long flags); - -#endif /* !__ASSEMBLER__ */ - #endif /* __VDSO_VSYSCALL_H */ diff --git a/kernel/time/vsyscall.c b/kernel/time/vsyscall.c index aa59919b8f2c23..193a02d78b117a 100644 --- a/kernel/time/vsyscall.c +++ b/kernel/time/vsyscall.c @@ -9,12 +9,25 @@ #include #include +#include #include #include #include #include "timekeeping_internal.h" +#ifndef __arch_update_vdso_clock +static __always_inline void __arch_update_vdso_clock(struct vdso_clock *vc) +{ +} +#endif /* __arch_update_vdso_clock */ + +#ifndef __arch_sync_vdso_time_data +static __always_inline void __arch_sync_vdso_time_data(struct vdso_time_data *vdata) +{ +} +#endif /* __arch_sync_vdso_time_data */ + static inline void fill_clock_configuration(struct vdso_clock *vc, const struct tk_read_base *base) { vc->cycle_last = base->cycle_last; @@ -177,7 +190,7 @@ void vdso_time_update_aux(struct timekeeper *tk) #endif /** - * vdso_update_begin - Start of a VDSO update section + * vdso_time_update_begin - Start of a VDSO update section * * Allows architecture code to safely update the architecture specific VDSO * data. Disables interrupts, acquires timekeeper lock to serialize against @@ -188,7 +201,7 @@ void vdso_time_update_aux(struct timekeeper *tk) * Returns: Saved interrupt flags which need to be handed in to * vdso_update_end(). */ -unsigned long vdso_update_begin(void) +unsigned long vdso_time_update_begin(void) { struct vdso_time_data *vdata = vdso_k_time_data; unsigned long flags = timekeeper_lock_irqsave(); @@ -198,14 +211,14 @@ unsigned long vdso_update_begin(void) } /** - * vdso_update_end - End of a VDSO update section - * @flags: Interrupt flags as returned from vdso_update_begin() + * vdso_time_update_end - End of a VDSO update section + * @flags: Interrupt flags as returned from vdso_time_update_begin() * - * Pairs with vdso_update_begin(). Marks vdso data consistent, invokes data + * Pairs with vdso_time_update_begin(). Marks vdso data consistent, invokes data * synchronization if the architecture requires it, drops timekeeper lock * and restores interrupt flags. */ -void vdso_update_end(unsigned long flags) +void vdso_time_update_end(unsigned long flags) { struct vdso_time_data *vdata = vdso_k_time_data; diff --git a/lib/vdso/getrandom.c b/lib/vdso/getrandom.c index 2851afa9154ff7..e0fa10bbefc9c0 100644 --- a/lib/vdso/getrandom.c +++ b/lib/vdso/getrandom.c @@ -16,8 +16,12 @@ #include #include -/* Bring in default accessors */ -#include +#ifndef __arch_get_vdso_u_rng_data +static __always_inline const struct vdso_rng_data *__arch_get_vdso_u_rng_data(void) +{ + return &vdso_u_rng_data; +} +#endif #define MEMCPY_AND_ZERO_SRC(type, dst, src, len) do { \ while (len >= sizeof(type)) { \ diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index f7a591aba59f11..728fed1ae52f51 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -27,9 +27,6 @@ #include -/* Bring in default accessors */ -#include - #ifndef vdso_calc_ns #ifdef VDSO_DELTA_NOMASK @@ -93,6 +90,13 @@ static inline bool vdso_cycles_ok(u64 cycles) } #endif +#ifndef __arch_get_vdso_u_time_data +static __always_inline const struct vdso_time_data *__arch_get_vdso_u_time_data(void) +{ + return &vdso_u_time_data; +} +#endif + static __always_inline bool vdso_clockid_valid(clockid_t clock) { /* Check for negative values or invalid clocks */