linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/5] riscv: uaccess: optimisations
@ 2025-04-10  7:05 Cyril Bur
  2025-04-10  7:05 ` [PATCH v6 1/5] riscv: save the SR_SUM status over switches Cyril Bur
                   ` (5 more replies)
  0 siblings, 6 replies; 32+ messages in thread
From: Cyril Bur @ 2025-04-10  7:05 UTC (permalink / raw)
  To: palmer, aou, paul.walmsley, charlie, jrtc27, ben.dooks, alex
  Cc: linux-riscv, linux-kernel, jszhang

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 declared __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

V4:
Fixed checkpatch errors
Added a unsafe_copy_from_user()
Added patch from Ben Dooks to save SR_SUM bit on switch

V5:
Fixed mistakes in adding unsafe_copy_from_user()
 - Sorry about the noise

V6:
Reworded patch 1 commit message
Patch 1 no longer clears SR_SUM, just saves/restores

Ben Dooks (1):
  riscv: save the SR_SUM status over switches

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/processor.h |   1 +
 arch/riscv/include/asm/uaccess.h   | 218 ++++++++++++++++++++++-------
 arch/riscv/kernel/asm-offsets.c    |   5 +
 arch/riscv/kernel/entry.S          |   8 ++
 4 files changed, 179 insertions(+), 53 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2025-05-27 20:58 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10  7:05 [PATCH v6 0/5] riscv: uaccess: optimisations Cyril Bur
2025-04-10  7:05 ` [PATCH v6 1/5] riscv: save the SR_SUM status over switches Cyril Bur
2025-04-22 10:22   ` Alexandre Ghiti
2025-05-21  8:26     ` Ben Dooks
2025-05-21 13:38       ` Samuel Holland
2025-05-21 14:30         ` Alexandre Ghiti
2025-05-21 14:45           ` Cyril Bur
2025-05-22 16:15           ` [EXT] " Cyril Bur
2025-05-22 17:40           ` Andy Chiu
2025-05-22 20:03             ` Ben Dooks
2025-04-22 23:01   ` Deepak Gupta
2025-04-23  6:44     ` Alexandre Ghiti
2025-05-20 16:49     ` Deepak Gupta
2025-05-22  6:23       ` Ben Dooks
2025-05-22 14:49         ` Deepak Gupta
2025-05-22 17:42           ` Andy Chiu
2025-05-22 22:43             ` Deepak Gupta
2025-05-23 12:22               ` Alexandre Ghiti
2025-05-23 17:14                 ` Deepak Gupta
2025-05-23 20:00                   ` Alexandre Ghiti
2025-05-27 19:34                     ` Deepak Gupta
2025-05-24 10:00                   ` Andy Chiu
2025-05-27 20:58                     ` Deepak Gupta
2025-04-10  7:05 ` [PATCH v6 2/5] riscv: implement user_access_begin() and families Cyril Bur
2025-04-22 10:26   ` Alexandre Ghiti
2025-04-10  7:05 ` [PATCH v6 3/5] riscv: uaccess: use input constraints for ptr of __put_user() Cyril Bur
2025-04-22 12:10   ` Alexandre Ghiti
2025-04-10  7:05 ` [PATCH v6 4/5] riscv: uaccess: use 'asm goto' for put_user() Cyril Bur
2025-04-22 10:36   ` Alexandre Ghiti
2025-04-10  7:05 ` [PATCH v6 5/5] riscv: uaccess: use 'asm_goto_output' for get_user() Cyril Bur
2025-04-22 12:19   ` Alexandre Ghiti
2025-05-09 17:30 ` [PATCH v6 0/5] riscv: uaccess: optimisations patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).