diff options
author | Tong Tiangen <tongtiangen@huawei.com> | 2021-09-01 02:46:20 +0000 |
---|---|---|
committer | Palmer Dabbelt <palmerdabbelt@google.com> | 2021-10-02 13:42:25 -0700 |
commit | 78a743cd82a35ca0724179fc22834f06a2151fc2 (patch) | |
tree | e15da52d9d6653bdf5e5b399f6eab678716539ae /arch/riscv/kernel/vdso | |
parent | bb4a23c994aebcd96c567a0be8e964d516bd4a61 (diff) |
riscv/vdso: Move vdso data page up front
As commit 601255ae3c98 ("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: ad5d1122b82fb ("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>
Diffstat (limited to 'arch/riscv/kernel/vdso')
-rw-r--r-- | arch/riscv/kernel/vdso/vdso.lds.S | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/riscv/kernel/vdso/vdso.lds.S b/arch/riscv/kernel/vdso/vdso.lds.S index e6f558bca71b..e9111f700af0 100644 --- a/arch/riscv/kernel/vdso/vdso.lds.S +++ b/arch/riscv/kernel/vdso/vdso.lds.S @@ -3,12 +3,13 @@ * Copyright (C) 2012 Regents of the University of California */ #include <asm/page.h> +#include <asm/vdso.h> OUTPUT_ARCH(riscv) SECTIONS { - PROVIDE(_vdso_data = . + PAGE_SIZE); + PROVIDE(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE); . = SIZEOF_HEADERS; .hash : { *(.hash) } :text |