Re: [PATCH 0/4] riscv: uaccess: optimizations

Palmer Dabbelt
2024-07-24T22:57:29Z

On Mon, 24 Jun 2024 21:04:56 PDT (-0700), jszhang@kernel.org wrote:
> This series tries to optimize riscv uaccess in the following way:
>
> patch1 implement the user_access_begin and families, I.E the unsafe
> accessors. when a function like strncpy_from_user() is called,
> the userspace access protection is disabled and enabled for every
> word read. After patch1, the protection is disabled at the beginning
> of the copy and enabled at the end.
>
> patch2 is a simple clean up
>
> patch3 uses 'asm goto' for put_user()
> patch4 uses 'asm goto output' for get_user()
>
> Both patch3 and patch4 are based on the fact -- 'asm goto' and
> 'asm goto output'generates noticeably better code since we don't need
> to test the error etc, the exception just jumps to the error handling
> directly.
>
>
> Jisheng Zhang (4):
> riscv: implement user_access_begin and families
> riscv: uaccess: use input constraints for ptr of __put_user
> riscv: uaccess: use 'asm goto' for put_user()
> riscv: uaccess: use 'asm goto output' for get_user
>
> arch/riscv/include/asm/uaccess.h | 201 +++++++++++++++++++++++--------
> 1 file changed, 149 insertions(+), 52 deletions(-)

This genreally looks good to me, but there's some failures reported by
the LKP tester and I don't think they're spurious.