Skip to content

Commit

Permalink
x86/vdso: Access timens vdso data without vvar.h
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
t-8ch authored and KAGA-KOKO committed Nov 2, 2024
1 parent 7175126 commit 59b7761
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 0 additions & 6 deletions arch/x86/entry/vdso/vdso-layout.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ SECTIONS
hvclock_page = vvar_start + 2 * PAGE_SIZE;
timens_page = vvar_start + 3 * PAGE_SIZE;

#undef _ASM_X86_VVAR_H
/* Place all vvars in timens too at the offsets in asm/vvar.h. */
#define EMIT_VVAR(name, offset) timens_ ## name = timens_page + offset;
#include <asm/vvar.h>
#undef EMIT_VVAR

. = SIZEOF_HEADERS;

.hash : { *(.hash) } :text
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/vdso/getrandom.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsig
static __always_inline const struct vdso_rng_data *__arch_get_vdso_rng_data(void)
{
if (IS_ENABLED(CONFIG_TIME_NS) && __arch_get_vdso_data()->clock_mode == VDSO_CLOCKMODE_TIMENS)
return (void *)&__vdso_rng_data + ((void *)&__timens_vdso_data - (void *)__arch_get_vdso_data());
return (void *)&__vdso_rng_data + ((void *)&timens_page - (void *)__arch_get_vdso_data());
return &__vdso_rng_data;
}

Expand Down
6 changes: 4 additions & 2 deletions arch/x86/include/asm/vdso/gettimeofday.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#include <clocksource/hyperv_timer.h>

#define __vdso_data (VVAR(_vdso_data))
#define __timens_vdso_data (TIMENS(_vdso_data))

extern struct vdso_data timens_page
__attribute__((visibility("hidden")));

#define VDSO_HAS_TIME 1

Expand Down Expand Up @@ -61,7 +63,7 @@ extern struct ms_hyperv_tsc_page hvclock_page
static __always_inline
const struct vdso_data *__arch_get_timens_vdso_data(const struct vdso_data *vd)
{
return __timens_vdso_data;
return &timens_page;
}
#endif

Expand Down

0 comments on commit 59b7761

Please sign in to comment.