Skip to content

Commit 5911e16

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: Nam Cao <[email protected]> Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 0235220 commit 5911e16

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

kernel/time/namespace.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,26 @@ static struct timens_offset offset_from_ts(struct timespec64 off)
165165
* HVCLOCK
166166
* VVAR
167167
*
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
169169
* the seq begin magic. So for the non-timens case most of the time
170170
* 'seq' is even, so the branch is not taken.
171171
*
172172
* 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
174174
* update to finish and for 'seq' to become even anyway.
175175
*
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
177177
* enforces the time namespace handling path.
178178
*/
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,
180180
struct time_namespace *ns)
181181
{
182-
struct timens_offset *offset = vdata->offset;
182+
struct timens_offset *offset = vc->offset;
183183
struct timens_offset monotonic = offset_from_ts(ns->offsets.monotonic);
184184
struct timens_offset boottime = offset_from_ts(ns->offsets.boottime);
185185

186-
vdata->seq = 1;
187-
vdata->clock_mode = VDSO_CLOCKMODE_TIMENS;
186+
vc->seq = 1;
187+
vc->clock_mode = VDSO_CLOCKMODE_TIMENS;
188188
offset[CLOCK_MONOTONIC] = monotonic;
189189
offset[CLOCK_MONOTONIC_RAW] = monotonic;
190190
offset[CLOCK_MONOTONIC_COARSE] = monotonic;
@@ -220,6 +220,7 @@ static void timens_set_vvar_page(struct task_struct *task,
220220
struct time_namespace *ns)
221221
{
222222
struct vdso_time_data *vdata;
223+
struct vdso_clock *vc;
223224
unsigned int i;
224225

225226
if (ns == &init_time_ns)
@@ -236,9 +237,10 @@ static void timens_set_vvar_page(struct task_struct *task,
236237

237238
ns->frozen_offsets = true;
238239
vdata = page_address(ns->vvar_page);
240+
vc = vdata;
239241

240242
for (i = 0; i < CS_BASES; i++)
241-
timens_setup_vdso_clock_data(&vdata[i], ns);
243+
timens_setup_vdso_clock_data(&vc[i], ns);
242244

243245
out:
244246
mutex_unlock(&offset_lock);

0 commit comments

Comments
 (0)