mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

As commit601255ae3c
("arm64: vdso: move data page before code pages"), the same issue exists on riscv, testcase is shown below, make sure that vdso.so is bigger than page size, struct timespec tp; clock_gettime(5, &tp); printf("tv_sec: %ld, tv_nsec: %ld\n", tp.tv_sec, tp.tv_nsec); without this patch, test result : tv_sec: 0, tv_nsec: 0 with this patch, test result : tv_sec: 1629271537, tv_nsec: 748000000 Move the vdso data page in front of the VDSO area to fix the issue. Fixes:ad5d1122b8
("riscv: use vDSO common flow to reduce the latency of the time-related functions") Signed-off-by: Tong Tiangen <tongtiangen@huawei.com> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
39 lines
868 B
C
39 lines
868 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2012 ARM Limited
|
|
* Copyright (C) 2014 Regents of the University of California
|
|
* Copyright (C) 2017 SiFive
|
|
*/
|
|
|
|
#ifndef _ASM_RISCV_VDSO_H
|
|
#define _ASM_RISCV_VDSO_H
|
|
|
|
|
|
/*
|
|
* All systems with an MMU have a VDSO, but systems without an MMU don't
|
|
* support shared libraries and therefor don't have one.
|
|
*/
|
|
#ifdef CONFIG_MMU
|
|
|
|
#include <linux/types.h>
|
|
/*
|
|
* All systems with an MMU have a VDSO, but systems without an MMU don't
|
|
* support shared libraries and therefor don't have one.
|
|
*/
|
|
#ifdef CONFIG_MMU
|
|
|
|
#define __VVAR_PAGES 1
|
|
|
|
#ifndef __ASSEMBLY__
|
|
#include <generated/vdso-offsets.h>
|
|
|
|
#define VDSO_SYMBOL(base, name) \
|
|
(void __user *)((unsigned long)(base) + __vdso_##name##_offset)
|
|
|
|
#endif /* CONFIG_MMU */
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
#endif /* CONFIG_MMU */
|
|
|
|
#endif /* _ASM_RISCV_VDSO_H */
|