lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAN7m+mC18ch=+iqJxarc-Xi_W9hZZkHD-p7ZthXqH9CwDtsqKA@mail.gmail.com>
Date: Sun, 23 Feb 2025 18:12:36 +1100
From: Anton Blanchard <antonb@...storrent.com>
To: Cyril Bur <cyrilbur@...storrent.com>
Cc: Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, 
	Paul Walmsley <paul.walmsley@...ive.com>, charlie@...osinc.com, jrtc27@...c27.com, 
	ben.dooks@...ethink.co.uk, linux-riscv@...ts.infradead.org, 
	linux-kernel@...r.kernel.org, jszhang@...nel.org
Subject: Re: [PATCH v3 0/4] riscv: uaccess: optimizations

Hi Cyril,

On Fri, Feb 21, 2025 at 11:09 AM Cyril Bur <cyrilbur@...storrent.com> wrote:
> This series tries to optimize riscv uaccess by allowing the use of
> user_access_begin() and user_access_end() which permits grouping user accesses
> and avoiding the CSR write penalty for each access.

I tested this on the upcoming Tenstorrent Ascalon CPU using a simple
microbenchmark (getdents64() on a directory with 10 files in it) and it was
significantly faster (over 40%). This came from both a reduction in
instruction count as well as a reduction in sstatus CSR writes.

It would be great if we could get this merged considering x86, arm64 and
POWER are exploiting this optimisation already.

Thanks,
Anton

> The error path can also be optimised using asm goto which patches 3 and 4
> achieve. This will speed up jumping to labels by avoiding the need of an
> intermediary error type variable within the uaccess macros
>
> I did read the discussion this series generated. It isn't clear to me
> which direction to take the patches, if any.
>
> V2:
> I've taken on this series as there isn't any response from Jisheng. No
> significant changes other than build fixes.
> - Fixes build breakage in patch 3 to do with not having used 'goto' keyword.
> - Fixes build breakage in patch 4 on 32bit not having delcared __ptr in the
>   macro.
>
> V3:
> Significant commit message rewrites.
>  - Corrected the justification for patch 2
>  - Better explained/justified patches 3 and 4
> Minor code changes for legibility and more comments.
>
> 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 | 205 +++++++++++++++++++++++--------
>  1 file changed, 152 insertions(+), 53 deletions(-)
>
> --
> 2.34.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ