Skip to content

Commit e15bf9e

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
vdso/helpers: 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 an array of VDSO clocks. For now, vdso_clock is simply a define which maps vdso_clock to vdso_time_data. Prepare all functions which need the pointer to the vdso_clock array to work well after the structures get reworked. 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 a05f14d commit e15bf9e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

include/vdso/helpers.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,53 @@
77
#include <asm/barrier.h>
88
#include <vdso/datapage.h>
99

10-
static __always_inline u32 vdso_read_begin(const struct vdso_time_data *vd)
10+
static __always_inline u32 vdso_read_begin(const struct vdso_clock *vc)
1111
{
1212
u32 seq;
1313

14-
while (unlikely((seq = READ_ONCE(vd->seq)) & 1))
14+
while (unlikely((seq = READ_ONCE(vc->seq)) & 1))
1515
cpu_relax();
1616

1717
smp_rmb();
1818
return seq;
1919
}
2020

21-
static __always_inline u32 vdso_read_retry(const struct vdso_time_data *vd,
21+
static __always_inline u32 vdso_read_retry(const struct vdso_clock *vc,
2222
u32 start)
2323
{
2424
u32 seq;
2525

2626
smp_rmb();
27-
seq = READ_ONCE(vd->seq);
27+
seq = READ_ONCE(vc->seq);
2828
return seq != start;
2929
}
3030

3131
static __always_inline void vdso_write_begin(struct vdso_time_data *vd)
3232
{
33+
struct vdso_clock *vc = vd;
34+
3335
/*
3436
* WRITE_ONCE() is required otherwise the compiler can validly tear
3537
* updates to vd[x].seq and it is possible that the value seen by the
3638
* reader is inconsistent.
3739
*/
38-
WRITE_ONCE(vd[CS_HRES_COARSE].seq, vd[CS_HRES_COARSE].seq + 1);
39-
WRITE_ONCE(vd[CS_RAW].seq, vd[CS_RAW].seq + 1);
40+
WRITE_ONCE(vc[CS_HRES_COARSE].seq, vc[CS_HRES_COARSE].seq + 1);
41+
WRITE_ONCE(vc[CS_RAW].seq, vc[CS_RAW].seq + 1);
4042
smp_wmb();
4143
}
4244

4345
static __always_inline void vdso_write_end(struct vdso_time_data *vd)
4446
{
47+
struct vdso_clock *vc = vd;
48+
4549
smp_wmb();
4650
/*
4751
* WRITE_ONCE() is required otherwise the compiler can validly tear
4852
* updates to vd[x].seq and it is possible that the value seen by the
4953
* reader is inconsistent.
5054
*/
51-
WRITE_ONCE(vd[CS_HRES_COARSE].seq, vd[CS_HRES_COARSE].seq + 1);
52-
WRITE_ONCE(vd[CS_RAW].seq, vd[CS_RAW].seq + 1);
55+
WRITE_ONCE(vc[CS_HRES_COARSE].seq, vc[CS_HRES_COARSE].seq + 1);
56+
WRITE_ONCE(vc[CS_RAW].seq, vc[CS_RAW].seq + 1);
5357
}
5458

5559
#endif /* !__ASSEMBLY__ */

0 commit comments

Comments
 (0)