linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/1] riscv: improving uaccess with logs from network bench
@ 2021-07-19 12:51 Akira Tsukamoto
  2021-07-19 12:53 ` [PATCH v4 1/1] riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall Akira Tsukamoto
  2021-07-19 14:55 ` [PATCH v4 0/1] riscv: improving uaccess with logs from network bench Akira Tsukamoto
  0 siblings, 2 replies; 11+ messages in thread
From: Akira Tsukamoto @ 2021-07-19 12:51 UTC (permalink / raw)
  To: Palmer Dabbelt, Guenter Roeck, Geert Uytterhoeven, Qiu Wenbo,
	Paul Walmsley, Albert Ou, Akira Tsukamoto, linux-riscv,
	linux-kernel

Hi Guenter, Geert and Qiu,

I fixed the bug which was overrunning the copy when the size was in the
between 8*SZREG to 9*SZREG. The SZREG holds the bytes per register size
which is 4 for RV32 and 8 for RV64.

Do you mind trying this patch? It works OK at my place.

Since I had to respin the patch I added word copy without unrolling when
the size is in the between 2*SZREG to 9*SZREG to reduce the number of byte
copies which has heavy overhead as Palmer has mentioned when he included
this patch to riscv/for-next.


I rewrote the functions but heavily influenced by Garry's memcpy
function [1]. It must be written in assembler to handle page faults
manually inside the function unlike other memcpy functions.

This patch will reduce cpu usage dramatically in kernel space especially
for applications which use sys-call with large buffer size, such as network
applications. The main reason behind this is that every unaligned memory
access will raise exceptions and switch between s-mode and m-mode causing
large overhead.

---
v3 -> v4:
- Fixed overrun copy
- Added word copy without unrolling to reduce byte copy for left over

v2 -> v3:
- Merged all patches

v1 -> v2:
- Added shift copy
- Separated patches for readability of changes in assembler
- Using perf results

[1] https://lkml.org/lkml/2021/2/16/778

Akira Tsukamoto (1):
  riscv: __asm_copy_to-from_user: Optimize unaligned memory access and
    pipeline stall

 arch/riscv/lib/uaccess.S | 218 ++++++++++++++++++++++++++++++++-------
 1 file changed, 183 insertions(+), 35 deletions(-)

-- 
2.17.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2021-07-20  6:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 12:51 [PATCH v4 0/1] riscv: improving uaccess with logs from network bench Akira Tsukamoto
2021-07-19 12:53 ` [PATCH v4 1/1] riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall Akira Tsukamoto
2021-07-19 13:51   ` Guenter Roeck
2021-07-19 14:00     ` Akira Tsukamoto
2021-07-19 14:24       ` Guenter Roeck
2021-07-19 14:49         ` Akira Tsukamoto
2021-07-19 15:16           ` Guenter Roeck
2021-07-20  6:54             ` Akira Tsukamoto
2021-07-19 14:49   ` Geert Uytterhoeven
2021-07-19 15:22     ` Akira Tsukamoto
2021-07-19 14:55 ` [PATCH v4 0/1] riscv: improving uaccess with logs from network bench Akira Tsukamoto

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).