]> Git Repo - linux.git/commit
riscv: lib: vectorize copy_to_user/copy_from_user
authorAndy Chiu <[email protected]>
Mon, 15 Jan 2024 05:59:24 +0000 (05:59 +0000)
committerPalmer Dabbelt <[email protected]>
Tue, 16 Jan 2024 15:13:57 +0000 (07:13 -0800)
commitc2a658d419246108c9bf065ec347355de5ba8a05
tree01afac13dfa6c595dd5154b3f45a2a6fe929f728
parent7df56cbc27e4239807b5d8860f79a7350d63a741
riscv: lib: vectorize copy_to_user/copy_from_user

This patch utilizes Vector to perform copy_to_user/copy_from_user. If
Vector is available and the size of copy is large enough for Vector to
perform better than scalar, then direct the kernel to do Vector copies
for userspace. Though the best programming practice for users is to
reduce the copy, this provides a faster variant when copies are
inevitable.

The optimal size for using Vector, copy_to_user_thres, is only a
heuristic for now. We can add DT parsing if people feel the need of
customizing it.

The exception fixup code of the __asm_vector_usercopy must fallback to
the scalar one because accessing user pages might fault, and must be
sleepable. Current kernel-mode Vector does not allow tasks to be
preemptible, so we must disactivate Vector and perform a scalar fallback
in such case.

The original implementation of Vector operations comes from
https://github.com/sifive/sifive-libc, which we agree to contribute to
Linux kernel.

Co-developed-by: Jerry Shih <[email protected]>
Signed-off-by: Jerry Shih <[email protected]>
Co-developed-by: Nick Knight <[email protected]>
Signed-off-by: Nick Knight <[email protected]>
Suggested-by: Guo Ren <[email protected]>
Signed-off-by: Andy Chiu <[email protected]>
Tested-by: Björn Töpel <[email protected]>
Tested-by: Lad Prabhakar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>
arch/riscv/Kconfig
arch/riscv/include/asm/asm-prototypes.h
arch/riscv/lib/Makefile
arch/riscv/lib/riscv_v_helpers.c [new file with mode: 0644]
arch/riscv/lib/uaccess.S
arch/riscv/lib/uaccess_vector.S [new file with mode: 0644]
This page took 0.044677 seconds and 4 git commands to generate.