OSDN Git Service

riscv: use vDSO common flow to reduce the latency of the time-related functions
authorVincent Chen <vincent.chen@sifive.com>
Tue, 9 Jun 2020 14:14:48 +0000 (22:14 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 11 Jun 2020 02:47:16 +0000 (19:47 -0700)
commitad5d1122b82fbd6a816d1b9d26ee01a6dbc2d757
tree5e78643855b7be7a1bcffc4c7ee2769323ab181f
parent05589dde649cd954a122b0ebb2cbe4ade8a80e98
riscv: use vDSO common flow to reduce the latency of the time-related functions

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.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
16 files changed:
arch/riscv/Kconfig
arch/riscv/include/asm/clocksource.h [new file with mode: 0644]
arch/riscv/include/asm/processor.h
arch/riscv/include/asm/vdso.h
arch/riscv/include/asm/vdso/clocksource.h [new file with mode: 0644]
arch/riscv/include/asm/vdso/gettimeofday.h [new file with mode: 0644]
arch/riscv/include/asm/vdso/processor.h [new file with mode: 0644]
arch/riscv/include/asm/vdso/vsyscall.h [new file with mode: 0644]
arch/riscv/kernel/time.c
arch/riscv/kernel/vdso.c
arch/riscv/kernel/vdso/Makefile
arch/riscv/kernel/vdso/clock_getres.S [deleted file]
arch/riscv/kernel/vdso/clock_gettime.S [deleted file]
arch/riscv/kernel/vdso/gettimeofday.S [deleted file]
arch/riscv/kernel/vdso/vdso.lds.S
arch/riscv/kernel/vdso/vgettimeofday.c [new file with mode: 0644]