[PATCH v4 1/1] riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall

Geert Uytterhoeven geert at linux-m68k.org
Mon Jul 19 07:49:11 PDT 2021


Hi Tsukamoto-san,

On Mon, Jul 19, 2021 at 2:53 PM Akira Tsukamoto
<akira.tsukamoto at gmail.com> wrote:
> This patch will reduce cpu usage dramatically in kernel space especially
> for application 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.

[...]

> Signed-off-by: Akira Tsukamoto <akira.tsukamoto at gmail.com>

Thanks for your patch!

As v3 is part of v5.14-rc1, all fixes and improvements need to be
send as incremental patches.

After reverting ca6eaaa210deec0e ("riscv: __asm_copy_to-from_user:
Optimize unaligned memory access and pipeline stall") and applying
v4, booting linux-on-litex-vexriscv still fails, but now differently
(real crash):

    /bi�����V�F-: applet not found
    2'�����t: applet not found
    Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
    CPU: 0 PID: 1 Comm: init Not tainted
5.14.0-rc2-orangecrab-01933-g5c9574869017 #357
    Call Trace:
    Unable to handle kernel NULL pointer dereference at virtual address 00000af0
    Oops [#1]
    CPU: 0 PID: 1 Comm: init Not tainted
5.14.0-rc2-orangecrab-01933-g5c9574869017 #357
    epc : walk_stackframe+0x11c/0x13c
     ra : dump_backtrace+0x2c/0x3c
    epc : c0003970 ra : c00039bc sp : c1835e20
     gp : c06a7690 tp : c1838000 t0 : 00000000
     t1 : 00000000 t2 : 00000000 s0 : c1835e50
     s1 : c05d8180 a0 : 00001000 a1 : 00000000
     a2 : c04dfd68 a3 : c05d8180 a4 : ab1d4cdc
     a5 : 00001000 a6 : c067d204 a7 : ffffefff
     s2 : 00000000 s3 : c05cc9f4 s4 : 00000000
     s5 : c05d8180 s6 : c04dfd68 s7 : 00000001
     s8 : 00000000 s9 : 95b6f158 s10: 00000000
     s11: 00000001 t3 : 00000000 t4 : 00000001
     t5 : 00000000 t6 : 00000000
    status: 00000100 badaddr: 00000af0 cause: 0000000d
    [<c0003970>] walk_stackframe+0x11c/0x13c
    [<c00039bc>] dump_backtrace+0x2c/0x3c
    [<c04dfde8>] show_stack+0x44/0x5c
    [<c04e4c98>] dump_stack_lvl+0x2c/0x40
    [<c04e4cc8>] dump_stack+0x1c/0x2c
    [<c04dff3c>] panic+0x13c/0x330
    [<c000c774>] do_exit+0x830/0x8b8
    [<c000c888>] do_group_exit+0x40/0xac
    [<c000c918>] __wake_up_parent+0x0/0x34
    [<c0002128>] ret_from_syscall+0x0/0x4
    ---[ end trace d147f0f146982b08 ]---
    note: init[1] exited with preempt_count 1
    Fixing recursive fault but reboot is needed!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



More information about the linux-riscv mailing list