diff options
author | Anna-Maria Behnsen <anna-maria@linutronix.de> | 2025-03-03 12:11:21 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2025-03-08 14:37:41 +0100 |
commit | 886653e36639177dd3ec2e7a4f0dc843d7def3f4 (patch) | |
tree | 08a989abd381a2f875d9d1bda5d6802aa8997b78 /include/vdso | |
parent | 97a5a90ca234eaa3de8a6aa44d43de2827393019 (diff) |
vdso: Rework struct vdso_time_data and introduce struct vdso_clock
To support multiple PTP clocks, the VDSO data structure needs to be
reworked. All clock specific data will end up in struct vdso_clock and in
struct vdso_time_data there will be an array of VDSO clocks.
Now that all preparatory changes are in place:
Split the clock related struct members into a separate struct
vdso_clock. Make sure all users are aware, that vdso_time_data is no longer
initialized as an array and vdso_clock is now the array inside
vdso_data. Remove the vdso_clock define, which mapped it to vdso_time_data
for the transition.
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250303-vdso-clock-v1-19-c1b5c69a166f@linutronix.de
Diffstat (limited to 'include/vdso')
-rw-r--r-- | include/vdso/datapage.h | 55 | ||||
-rw-r--r-- | include/vdso/helpers.h | 4 |
2 files changed, 34 insertions, 25 deletions
diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h index bcd19c223783..1864e76e8f69 100644 --- a/include/vdso/datapage.h +++ b/include/vdso/datapage.h @@ -69,9 +69,7 @@ struct vdso_timestamp { }; /** - * struct vdso_time_data - vdso datapage representation - * @arch_data: architecture specific data (optional, defaults - * to an empty struct) + * struct vdso_clock - vdso per clocksource datapage representation * @seq: timebase sequence counter * @clock_mode: clock mode * @cycle_last: timebase at clocksource init @@ -81,17 +79,9 @@ struct vdso_timestamp { * @shift: clocksource shift * @basetime[clock_id]: basetime per clock_id * @offset[clock_id]: time namespace offset per clock_id - * @tz_minuteswest: minutes west of Greenwich - * @tz_dsttime: type of DST correction - * @hrtimer_res: hrtimer resolution - * @__unused: unused * - * vdso_time_data will be accessed by 64 bit and compat code at the same time - * so we should be careful before modifying this structure. - * - * The ordering of the struct members is optimized to have fast access to the - * often required struct members which are related to CLOCK_REALTIME and - * CLOCK_MONOTONIC. This information is stored in the first cache lines. + * See also struct vdso_time_data for basic access and ordering information as + * struct vdso_clock is used there. * * @basetime is used to store the base time for the system wide time getter * VVAR page. @@ -104,9 +94,7 @@ struct vdso_timestamp { * For clocks which are not affected by time namespace adjustment the * offset must be zero. */ -struct vdso_time_data { - struct arch_vdso_time_data arch_data; - +struct vdso_clock { u32 seq; s32 clock_mode; @@ -122,14 +110,35 @@ struct vdso_time_data { struct vdso_timestamp basetime[VDSO_BASES]; struct timens_offset offset[VDSO_BASES]; }; +}; - s32 tz_minuteswest; - s32 tz_dsttime; - u32 hrtimer_res; - u32 __unused; -} ____cacheline_aligned; +/** + * struct vdso_time_data - vdso datapage representation + * @arch_data: architecture specific data (optional, defaults + * to an empty struct) + * @clock_data: clocksource related data (array) + * @tz_minuteswest: minutes west of Greenwich + * @tz_dsttime: type of DST correction + * @hrtimer_res: hrtimer resolution + * @__unused: unused + * + * vdso_time_data will be accessed by 64 bit and compat code at the same time + * so we should be careful before modifying this structure. + * + * The ordering of the struct members is optimized to have fast acces to the + * often required struct members which are related to CLOCK_REALTIME and + * CLOCK_MONOTONIC. This information is stored in the first cache lines. + */ +struct vdso_time_data { + struct arch_vdso_time_data arch_data; -#define vdso_clock vdso_time_data + struct vdso_clock clock_data[CS_BASES]; + + s32 tz_minuteswest; + s32 tz_dsttime; + u32 hrtimer_res; + u32 __unused; +} ____cacheline_aligned; /** * struct vdso_rng_data - vdso RNG state information @@ -151,7 +160,7 @@ struct vdso_rng_data { * relocation, and this is what we need. */ #ifdef CONFIG_GENERIC_VDSO_DATA_STORE -extern struct vdso_time_data vdso_u_time_data[CS_BASES] __attribute__((visibility("hidden"))); +extern struct vdso_time_data vdso_u_time_data __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"))); diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h index 28f0707a46c6..0a98fed550ba 100644 --- a/include/vdso/helpers.h +++ b/include/vdso/helpers.h @@ -30,7 +30,7 @@ static __always_inline u32 vdso_read_retry(const struct vdso_clock *vc, static __always_inline void vdso_write_begin(struct vdso_time_data *vd) { - struct vdso_clock *vc = vd; + struct vdso_clock *vc = vd->clock_data; /* * WRITE_ONCE() is required otherwise the compiler can validly tear @@ -44,7 +44,7 @@ static __always_inline void vdso_write_begin(struct vdso_time_data *vd) static __always_inline void vdso_write_end(struct vdso_time_data *vd) { - struct vdso_clock *vc = vd; + struct vdso_clock *vc = vd->clock_data; smp_wmb(); /* |