Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

time/namespace: Prepare introduction of 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 array of VDSO clocks. At the moment,
vdso_clock is simply a define which maps vdso_clock to vdso_time_data.

To prepare for the rework of the data structures, replace the struct
vdso_time_data pointer with a struct vdso_clock pointer where applicable.

No functional change.

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-14-c1b5c69a166f@linutronix.de

authored by

Anna-Maria Behnsen and committed by
Thomas Gleixner
5911e16c 02352208

+10 -8
+10 -8
kernel/time/namespace.c
··· 165 165 * HVCLOCK 166 166 * VVAR 167 167 * 168 - * The check for vdso_time_data->clock_mode is in the unlikely path of 168 + * The check for vdso_clock->clock_mode is in the unlikely path of 169 169 * the seq begin magic. So for the non-timens case most of the time 170 170 * 'seq' is even, so the branch is not taken. 171 171 * 172 172 * If 'seq' is odd, i.e. a concurrent update is in progress, the extra check 173 - * for vdso_time_data->clock_mode is a non-issue. The task is spin waiting for the 173 + * for vdso_clock->clock_mode is a non-issue. The task is spin waiting for the 174 174 * update to finish and for 'seq' to become even anyway. 175 175 * 176 - * Timens page has vdso_time_data->clock_mode set to VDSO_CLOCKMODE_TIMENS which 176 + * Timens page has vdso_clock->clock_mode set to VDSO_CLOCKMODE_TIMENS which 177 177 * enforces the time namespace handling path. 178 178 */ 179 - static void timens_setup_vdso_clock_data(struct vdso_time_data *vdata, 179 + static void timens_setup_vdso_clock_data(struct vdso_clock *vc, 180 180 struct time_namespace *ns) 181 181 { 182 - struct timens_offset *offset = vdata->offset; 182 + struct timens_offset *offset = vc->offset; 183 183 struct timens_offset monotonic = offset_from_ts(ns->offsets.monotonic); 184 184 struct timens_offset boottime = offset_from_ts(ns->offsets.boottime); 185 185 186 - vdata->seq = 1; 187 - vdata->clock_mode = VDSO_CLOCKMODE_TIMENS; 186 + vc->seq = 1; 187 + vc->clock_mode = VDSO_CLOCKMODE_TIMENS; 188 188 offset[CLOCK_MONOTONIC] = monotonic; 189 189 offset[CLOCK_MONOTONIC_RAW] = monotonic; 190 190 offset[CLOCK_MONOTONIC_COARSE] = monotonic; ··· 220 220 struct time_namespace *ns) 221 221 { 222 222 struct vdso_time_data *vdata; 223 + struct vdso_clock *vc; 223 224 unsigned int i; 224 225 225 226 if (ns == &init_time_ns) ··· 237 236 238 237 ns->frozen_offsets = true; 239 238 vdata = page_address(ns->vvar_page); 239 + vc = vdata; 240 240 241 241 for (i = 0; i < CS_BASES; i++) 242 - timens_setup_vdso_clock_data(&vdata[i], ns); 242 + timens_setup_vdso_clock_data(&vc[i], ns); 243 243 244 244 out: 245 245 mutex_unlock(&offset_lock);