Skip to content

Commit 59b7761

Browse files
t-8chKAGA-KOKO
authored andcommitted
x86/vdso: Access timens vdso data without vvar.h
The vdso_data is at the start of the timens page. Make use of this invariant to remove the usage of vvar.h. This also matches the logic for the pvclock and hvclock pages. 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 7175126 commit 59b7761

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

arch/x86/entry/vdso/vdso-layout.lds.S

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ SECTIONS
2828
hvclock_page = vvar_start + 2 * PAGE_SIZE;
2929
timens_page = vvar_start + 3 * PAGE_SIZE;
3030

31-
#undef _ASM_X86_VVAR_H
32-
/* Place all vvars in timens too at the offsets in asm/vvar.h. */
33-
#define EMIT_VVAR(name, offset) timens_ ## name = timens_page + offset;
34-
#include <asm/vvar.h>
35-
#undef EMIT_VVAR
36-
3731
. = SIZEOF_HEADERS;
3832

3933
.hash : { *(.hash) } :text

arch/x86/include/asm/vdso/getrandom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsig
3333
static __always_inline const struct vdso_rng_data *__arch_get_vdso_rng_data(void)
3434
{
3535
if (IS_ENABLED(CONFIG_TIME_NS) && __arch_get_vdso_data()->clock_mode == VDSO_CLOCKMODE_TIMENS)
36-
return (void *)&__vdso_rng_data + ((void *)&__timens_vdso_data - (void *)__arch_get_vdso_data());
36+
return (void *)&__vdso_rng_data + ((void *)&timens_page - (void *)__arch_get_vdso_data());
3737
return &__vdso_rng_data;
3838
}
3939

arch/x86/include/asm/vdso/gettimeofday.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#include <clocksource/hyperv_timer.h>
2222

2323
#define __vdso_data (VVAR(_vdso_data))
24-
#define __timens_vdso_data (TIMENS(_vdso_data))
24+
25+
extern struct vdso_data timens_page
26+
__attribute__((visibility("hidden")));
2527

2628
#define VDSO_HAS_TIME 1
2729

@@ -61,7 +63,7 @@ extern struct ms_hyperv_tsc_page hvclock_page
6163
static __always_inline
6264
const struct vdso_data *__arch_get_timens_vdso_data(const struct vdso_data *vd)
6365
{
64-
return __timens_vdso_data;
66+
return &timens_page;
6567
}
6668
#endif
6769

0 commit comments

Comments
 (0)