Commit ac1a42f4 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Thomas Gleixner
Browse files

vdso: Remove remnants of architecture-specific time storage



All users of the time releated parts of the vDSO are now using the generic
storage implementation. Remove the therefore unnecessary compatibility
accessor functions and symbols.

Co-developed-by: default avatarNam Cao <namcao@linutronix.de>
Signed-off-by: default avatarNam Cao <namcao@linutronix.de>
Signed-off-by: default avatarThomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-18-13a4669dfc8c@linutronix.de
parent 998a8a26
Loading
Loading
Loading
Loading
+4 −16
Original line number Diff line number Diff line
@@ -20,31 +20,19 @@ static __always_inline const struct vdso_rng_data *__arch_get_vdso_u_rng_data(vo
}
#endif

#else  /* !CONFIG_GENERIC_VDSO_DATA_STORE */

#ifndef __arch_get_k_vdso_data
static __always_inline struct vdso_data *__arch_get_k_vdso_data(void)
{
	return NULL;
}
#endif /* __arch_get_k_vdso_data */
#define vdso_k_time_data __arch_get_k_vdso_data()

#define __arch_get_vdso_u_time_data __arch_get_vdso_data

#endif /* CONFIG_GENERIC_VDSO_DATA_STORE */

#ifndef __arch_update_vsyscall
static __always_inline void __arch_update_vsyscall(struct vdso_data *vdata)
static __always_inline void __arch_update_vsyscall(struct vdso_time_data *vdata)
{
}
#endif /* __arch_update_vsyscall */

#ifndef __arch_sync_vdso_data
static __always_inline void __arch_sync_vdso_data(struct vdso_data *vdata)
#ifndef __arch_sync_vdso_time_data
static __always_inline void __arch_sync_vdso_time_data(struct vdso_time_data *vdata)
{
}
#endif /* __arch_sync_vdso_data */
#endif /* __arch_sync_vdso_time_data */

#endif /* !__ASSEMBLY__ */

+0 −3
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
#include <linux/ns_common.h>
#include <linux/err.h>
#include <linux/time64.h>
#include <vdso/datapage.h>

struct user_namespace;
extern struct user_namespace init_user_ns;
@@ -166,6 +165,4 @@ static inline ktime_t timens_ktime_to_host(clockid_t clockid, ktime_t tim)
}
#endif

struct vdso_data *arch_get_vdso_data(void *vvar_page);

#endif /* _LINUX_TIMENS_H */
+1 −18
Original line number Diff line number Diff line
@@ -128,8 +128,6 @@ struct vdso_time_data {
	struct arch_vdso_time_data arch_data;
};

#define vdso_data vdso_time_data

/**
 * struct vdso_rng_data - vdso RNG state information
 * @generation:	counter representing the number of RNG reseeds
@@ -149,10 +147,7 @@ struct vdso_rng_data {
 * With the hidden visibility, the compiler simply generates a PC-relative
 * relocation, and this is what we need.
 */
#ifndef CONFIG_GENERIC_VDSO_DATA_STORE
extern struct vdso_time_data _vdso_data[CS_BASES] __attribute__((visibility("hidden")));
extern struct vdso_time_data _timens_data[CS_BASES] __attribute__((visibility("hidden")));
#else
#ifdef CONFIG_GENERIC_VDSO_DATA_STORE
extern struct vdso_time_data vdso_u_time_data[CS_BASES] __attribute__((visibility("hidden")));
extern struct vdso_rng_data vdso_u_rng_data __attribute__((visibility("hidden")));
extern struct vdso_arch_data vdso_u_arch_data __attribute__((visibility("hidden")));
@@ -160,17 +155,6 @@ extern struct vdso_arch_data vdso_u_arch_data __attribute__((visibility("hidden"
extern struct vdso_time_data *vdso_k_time_data;
extern struct vdso_rng_data *vdso_k_rng_data;
extern struct vdso_arch_data *vdso_k_arch_data;
#endif

/**
 * union vdso_data_store - Generic vDSO data page
 */
union vdso_data_store {
	struct vdso_time_data	data[CS_BASES];
	u8			page[1U << CONFIG_PAGE_SHIFT];
};

#ifdef CONFIG_GENERIC_VDSO_DATA_STORE

#define VDSO_ARCH_DATA_SIZE ALIGN(sizeof(struct vdso_arch_data), PAGE_SIZE)
#define VDSO_ARCH_DATA_PAGES (VDSO_ARCH_DATA_SIZE >> PAGE_SHIFT)
@@ -189,7 +173,6 @@ enum vdso_pages {
/*
 * The generic vDSO implementation requires that gettimeofday.h
 * provides:
 * - __arch_get_vdso_data(): to get the vdso datapage.
 * - __arch_get_hw_counter(): to get the hw counter based on the
 *   clock_mode.
 * - gettimeofday_fallback(): fallback for gettimeofday.
+4 −4
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
#include <asm/barrier.h>
#include <vdso/datapage.h>

static __always_inline u32 vdso_read_begin(const struct vdso_data *vd)
static __always_inline u32 vdso_read_begin(const struct vdso_time_data *vd)
{
	u32 seq;

@@ -18,7 +18,7 @@ static __always_inline u32 vdso_read_begin(const struct vdso_data *vd)
	return seq;
}

static __always_inline u32 vdso_read_retry(const struct vdso_data *vd,
static __always_inline u32 vdso_read_retry(const struct vdso_time_data *vd,
					   u32 start)
{
	u32 seq;
@@ -28,7 +28,7 @@ static __always_inline u32 vdso_read_retry(const struct vdso_data *vd,
	return seq != start;
}

static __always_inline void vdso_write_begin(struct vdso_data *vd)
static __always_inline void vdso_write_begin(struct vdso_time_data *vd)
{
	/*
	 * WRITE_ONCE() is required otherwise the compiler can validly tear
@@ -40,7 +40,7 @@ static __always_inline void vdso_write_begin(struct vdso_data *vd)
	smp_wmb();
}

static __always_inline void vdso_write_end(struct vdso_data *vd)
static __always_inline void vdso_write_end(struct vdso_time_data *vd)
{
	smp_wmb();
	/*
+6 −6
Original line number Diff line number Diff line
@@ -165,18 +165,18 @@ static struct timens_offset offset_from_ts(struct timespec64 off)
 *     HVCLOCK
 *     VVAR
 *
 * The check for vdso_data->clock_mode is in the unlikely path of
 * The check for vdso_time_data->clock_mode is in the unlikely path of
 * the seq begin magic. So for the non-timens case most of the time
 * 'seq' is even, so the branch is not taken.
 *
 * If 'seq' is odd, i.e. a concurrent update is in progress, the extra check
 * for vdso_data->clock_mode is a non-issue. The task is spin waiting for the
 * for vdso_time_data->clock_mode is a non-issue. The task is spin waiting for the
 * update to finish and for 'seq' to become even anyway.
 *
 * Timens page has vdso_data->clock_mode set to VDSO_CLOCKMODE_TIMENS which
 * Timens page has vdso_time_data->clock_mode set to VDSO_CLOCKMODE_TIMENS which
 * enforces the time namespace handling path.
 */
static void timens_setup_vdso_data(struct vdso_data *vdata,
static void timens_setup_vdso_data(struct vdso_time_data *vdata,
				   struct time_namespace *ns)
{
	struct timens_offset *offset = vdata->offset;
@@ -219,7 +219,7 @@ static DEFINE_MUTEX(offset_lock);
static void timens_set_vvar_page(struct task_struct *task,
				struct time_namespace *ns)
{
	struct vdso_data *vdata;
	struct vdso_time_data *vdata;
	unsigned int i;

	if (ns == &init_time_ns)
@@ -235,7 +235,7 @@ static void timens_set_vvar_page(struct task_struct *task,
		goto out;

	ns->frozen_offsets = true;
	vdata = arch_get_vdso_data(page_address(ns->vvar_page));
	vdata = page_address(ns->vvar_page);

	for (i = 0; i < CS_BASES; i++)
		timens_setup_vdso_data(&vdata[i], ns);
Loading