vdso: Move the kernel-side time update helpers to a new header

The vdso/ header namespace is meant for symbols which are usable from
vDSO userspace code. However vdso_update_begin() and vdso_update_end()
are only usable from the kernel.

Move them into a new header in the linux/ namespace. Also rename them to
make clear that they are only for time-related data.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260909-vdso-asm-generic-vsyscall-h-v1-1-63ae856cc659@linutronix.de
This commit is contained in:
Thomas Weißschuh 2026-09-09 10:51:14 +02:00 committed by Thomas Gleixner
parent 72d3fcf802
commit 35f0a96848
5 changed files with 20 additions and 12 deletions

View File

@ -11064,6 +11064,7 @@ 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

View File

@ -39,6 +39,7 @@
#include <linux/gfp.h>
#include <linux/kprobes.h>
#include <linux/uaccess.h>
#include <linux/vdso_time.h>
#include <vdso/vsyscall.h>
#include <vdso/clocksource.h>
#include <vdso/helpers.h>
@ -527,7 +528,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 +538,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);

View File

@ -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 */

View File

@ -6,9 +6,6 @@
#include <asm/vdso/vsyscall.h>
unsigned long vdso_update_begin(void);
void vdso_update_end(unsigned long flags);
#endif /* !__ASSEMBLER__ */
#endif /* __VDSO_VSYSCALL_H */

View File

@ -9,6 +9,7 @@
#include <linux/hrtimer.h>
#include <linux/timekeeper_internal.h>
#include <linux/vdso_time.h>
#include <vdso/datapage.h>
#include <vdso/helpers.h>
#include <vdso/vsyscall.h>
@ -177,7 +178,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
@ -186,9 +187,9 @@ void vdso_time_update_aux(struct timekeeper *tk)
* inconsistent data.
*
* Returns: Saved interrupt flags which need to be handed in to
* vdso_update_end().
* vdso_time_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 +199,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;