Skip to content

Commit 70067ae

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
vdso/gettimeofday: Prepare do_coarse() for 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. Prepare for the rework of these structures by adding a struct vdso_clock pointer argument to do_coarse(), and replace the struct vdso_time_data pointer with the new pointer argument 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 83a2a6b commit 70067ae

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/vdso/gettimeofday.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,28 +229,29 @@ static __always_inline int do_coarse_timens(const struct vdso_time_data *vdns, c
229229
}
230230
#endif
231231

232-
static __always_inline int do_coarse(const struct vdso_time_data *vd, clockid_t clk,
233-
struct __kernel_timespec *ts)
232+
static __always_inline
233+
int do_coarse(const struct vdso_time_data *vd, const struct vdso_clock *vc,
234+
clockid_t clk, struct __kernel_timespec *ts)
234235
{
235-
const struct vdso_timestamp *vdso_ts = &vd->basetime[clk];
236+
const struct vdso_timestamp *vdso_ts = &vc->basetime[clk];
236237
u32 seq;
237238

238239
do {
239240
/*
240241
* Open coded function vdso_read_begin() to handle
241242
* VDSO_CLOCK_TIMENS. See comment in do_hres().
242243
*/
243-
while ((seq = READ_ONCE(vd->seq)) & 1) {
244+
while ((seq = READ_ONCE(vc->seq)) & 1) {
244245
if (IS_ENABLED(CONFIG_TIME_NS) &&
245-
vd->clock_mode == VDSO_CLOCKMODE_TIMENS)
246-
return do_coarse_timens(vd, clk, ts);
246+
vc->clock_mode == VDSO_CLOCKMODE_TIMENS)
247+
return do_coarse_timens(vc, clk, ts);
247248
cpu_relax();
248249
}
249250
smp_rmb();
250251

251252
ts->tv_sec = vdso_ts->sec;
252253
ts->tv_nsec = vdso_ts->nsec;
253-
} while (unlikely(vdso_read_retry(vd, seq)));
254+
} while (unlikely(vdso_read_retry(vc, seq)));
254255

255256
return 0;
256257
}
@@ -274,7 +275,7 @@ __cvdso_clock_gettime_common(const struct vdso_time_data *vd, clockid_t clock,
274275
if (likely(msk & VDSO_HRES))
275276
vc = &vc[CS_HRES_COARSE];
276277
else if (msk & VDSO_COARSE)
277-
return do_coarse(&vc[CS_HRES_COARSE], clock, ts);
278+
return do_coarse(vd, &vc[CS_HRES_COARSE], clock, ts);
278279
else if (msk & VDSO_RAW)
279280
vc = &vc[CS_RAW];
280281
else

0 commit comments

Comments
 (0)