Skip to content

riscv: introduce vDSO common flow

Vincent Chen linux-riscv 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 1 replyIn review
  2. v32 patches 0 repliesSuperseded
  3. v22 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch3 repliesSuperseded

Changes in v4 from the cover letter

1. Fix build warnings reported by kbuild system

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2riscv: use vDSO common flow to reduce the latency of the time-related functionsarch/riscv/Kconfig arch/riscv/include/asm/clocksource.h arch/riscv/include/asm/processor.h +13 more+199 -690 replies
2/2riscv: set the permission of vdso_data to read-onlyarch/riscv/kernel/vdso.c+14 -20 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchAtish Patra
1/2R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/2] riscv: introduce vDSO common flow

Even if RISC-V has supported the vDSO feature, the latency of the functions for obtaining the system time is still expensive. It is because these functions still trigger a corresponding system call in the process, which slows down the response time. If we want to remove the system call to reduce the latency, the kernel should have the ability to output the system clock information to userspace. This patch introduces the vDSO common flow to enable the kernel to achieve the above feature and uses "rdtime" instruction to obtain the current time in the user space. Under this condition, the latency cost by the ecall from U-mode to S-mode can be eliminated. After applying this patch, the latency of gettimeofday() measured on the HiFive unleashed board can be reduced by %61.

change since v3:
1. Fix build warnings reported by kbuild system

change since v2:
1. Fix build errors that occurred in the case of rv32 and nommu.

change since v1:
1. Modify the permission of vdso_data to read-only

Vincent Chen (2):
riscv: use vDSO common flow to reduce the latency of the time-related
functions
riscv: set the permission of vdso_data to read-only

 arch/riscv/Kconfig                         |  4 ++
 arch/riscv/include/asm/clocksource.h       |  7 +++
 arch/riscv/include/asm/processor.h         | 12 +----
 arch/riscv/include/asm/vdso.h              |  2 +
 arch/riscv/include/asm/vdso/clocksource.h  |  8 +++
 arch/riscv/include/asm/vdso/gettimeofday.h | 79 ++++++++++++++++++++++++++++++
 arch/riscv/include/asm/vdso/processor.h    | 19 +++++++
 arch/riscv/include/asm/vdso/vsyscall.h     | 27 ++++++++++
 arch/riscv/kernel/time.c                   |  9 ++++
 arch/riscv/kernel/vdso.c                   | 24 +++++++--
 arch/riscv/kernel/vdso/Makefile            | 12 +++--
 arch/riscv/kernel/vdso/clock_getres.S      | 18 -------
 arch/riscv/kernel/vdso/clock_gettime.S     | 18 -------
 arch/riscv/kernel/vdso/gettimeofday.S      | 18 -------
 arch/riscv/kernel/vdso/vdso.lds.S          |  2 +
 arch/riscv/kernel/vdso/vgettimeofday.c     | 25 ++++++++++
 16 files changed, 213 insertions(+), 71 deletions(-)
 create mode 100644 arch/riscv/include/asm/clocksource.h
 create mode 100644 arch/riscv/include/asm/vdso/clocksource.h
 create mode 100644 arch/riscv/include/asm/vdso/gettimeofday.h
 create mode 100644 arch/riscv/include/asm/vdso/processor.h
 create mode 100644 arch/riscv/include/asm/vdso/vsyscall.h
 delete mode 100644 arch/riscv/kernel/vdso/clock_getres.S
 delete mode 100644 arch/riscv/kernel/vdso/clock_gettime.S
 delete mode 100644 arch/riscv/kernel/vdso/gettimeofday.S
 create mode 100644 arch/riscv/kernel/vdso/vgettimeofday.c
Signature · 1 line
2.7.4