|
|
Subscribe / Log in / New account

riscv: uaccess: optimizations

From:  Cyril Bur <cyrilbur-AT-tenstorrent.com>
To:  palmer-AT-dabbelt.com, aou-AT-eecs.berkeley.edu, paul.walmsley-AT-sifive.com, charlie-AT-rivosinc.com, jrtc27-AT-jrtc27.com, ben.dooks-AT-codethink.co.uk
Subject:  [PATCH v3 0/4] riscv: uaccess: optimizations
Date:  Fri, 21 Feb 2025 00:09:20 +0000
Message-ID:  <20250221000924.734006-1-cyrilbur@tenstorrent.com>
Cc:  linux-riscv-AT-lists.infradead.org, linux-kernel-AT-vger.kernel.org, jszhang-AT-kernel.org
Archive-link:  Article

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.

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




Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds