riscv/vdso: Move vdso data page up front
authorTong Tiangen <tongtiangen@huawei.com>
Wed, 1 Sep 2021 02:46:20 +0000 (02:46 +0000)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 2 Oct 2021 20:42:25 +0000 (13:42 -0700)
commit78a743cd82a35ca0724179fc22834f06a2151fc2
treee15da52d9d6653bdf5e5b399f6eab678716539ae
parentbb4a23c994aebcd96c567a0be8e964d516bd4a61
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>
arch/riscv/include/asm/vdso.h
arch/riscv/kernel/vdso.c
arch/riscv/kernel/vdso/vdso.lds.S