From: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
To: Akira Tsukamoto <akira.tsukamoto@gmail.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Guenter Roeck <linux@roeck-us.net>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Albert Ou <aou@eecs.berkeley.edu>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/1] __asm_copy_to-from_user: Reduce more byte_copy
Date: Sun, 15 Aug 2021 10:30:06 +0800 [thread overview]
Message-ID: <21b55fd7-7ab5-10e9-4fc9-1815ec95927d@kylinos.com.cn> (raw)
In-Reply-To: <a70451d1-57ad-6b49-24c1-6408ef94a959@gmail.com>
Hi Akira,
This patch breaks my userspace and I can't boot my system after
applying this. Here is the stack trace:
[ 10.349080] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000000
[ 10.357116] Oops [#15]
[ 10.359433] CPU: 2 PID: 169 Comm: (networkd) Tainted: G D
5.14.0-rc5 #53
[ 10.367422] Hardware name: SiFive HiFive Unmatched A00 (DT)
[ 10.372981] epc : __asm_copy_from_user+0x48/0xf0
[ 10.377584] ra : _copy_from_user+0x28/0x68
[ 10.381754] epc : ffffffff8099a280 ra : ffffffff803614a8 sp :
ffffffd00416bd90
[ 10.388963] gp : ffffffff811ee540 tp : ffffffe0841b3680 t0 :
ffffffd00416bde0
[ 10.396172] t1 : ffffffd00416bdd8 t2 : 0000003ff09ca3a0 s0 :
ffffffd00416bdc0
[ 10.403381] s1 : 0000000000000000 a0 : ffffffd00416bdd8 a1 :
0000000000000000
[ 10.410590] a2 : 0000000000000010 a3 : 0000000000000040 a4 :
ffffffd00416be18
[ 10.417800] a5 : 0000003ffffffff0 a6 : 000000000000000f a7 :
ffffffe085d58540
[ 10.425009] s2 : 0000000000000010 s3 : ffffffd00416bdd8 s4 :
0000000000000002
[ 10.432218] s5 : 0000000000000000 s6 : 0000000000000000 s7 :
ffffffe0841b3680
[ 10.439427] s8 : 0000002aad788040 s9 : 0000000000000000 s10:
0000000000000001
[ 10.446636] s11: 0000000000000000 t3 : 0000000000000000 t4 :
0000000000000001
[ 10.453845] t5 : 0000000000000010 t6 : 0000000000040000
[ 10.459144] status: 0000000200040120 badaddr: 0000000000000000 cause:
000000000000000d
[ 10.467049] [<ffffffff8099a280>] __asm_copy_from_user+0x48/0xf0
[ 10.472955] [<ffffffff8009a562>] do_seccomp+0x62/0x8be
[ 10.478079] [<ffffffff8009af58>] prctl_set_seccomp+0x24/0x32
[ 10.483725] [<ffffffff80020756>] sys_prctl+0xf6/0x450
[ 10.488763] [<ffffffff800034f2>] ret_from_syscall+0x0/0x2
The PC register points to this line:
+1:
+ REG_L a5, 0(a1)
Qiu
On 8/12/21 7:01 PM, Akira Tsukamoto wrote:
> Hi Guenter, Geert and Qiu,
>
> Would you mind testing this patch?
> Thanks,
>
> Akira
>
> On 7/30/2021 10:50 PM, Akira Tsukamoto wrote:
>> Adding none unrolling word_copy, which is used if the size is smaller
>> than 9*SZREG.
>>
>> This patch is based on Palmer's past comment.
>>> My guess is that some workloads will want some smaller unrolling factors,
>> It will reduce the number of slow byte_copy being used when the
>> size is small.
>>
>> Have tested on qemu rv32, qemu rv64 and beaglev beta board.
>>
>> In the future, I am planning to convert uaccess.S to inline assembly
>> in .c file. Then it will be easier to optimize on both in-order core and
>> out-of-order core with #ifdef macro in c.
>>
>> Akira Tsukamoto (1):
>> riscv: __asm_copy_to-from_user: Improve using word copy if size <
>> 9*SZREG
>>
>> arch/riscv/lib/uaccess.S | 46 ++++++++++++++++++++++++++++++++++++----
>> 1 file changed, 42 insertions(+), 4 deletions(-)
>>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2021-08-15 2:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 13:50 [PATCH 0/1] __asm_copy_to-from_user: Reduce more byte_copy Akira Tsukamoto
2021-07-30 13:52 ` [PATCH 1/1] riscv: __asm_copy_to-from_user: Improve using word copy if size < 9*SZREG Akira Tsukamoto
2021-08-12 13:41 ` Guenter Roeck
2021-08-15 6:51 ` Andreas Schwab
2021-08-16 18:09 ` Palmer Dabbelt
2021-08-16 19:00 ` Andreas Schwab
2021-08-20 6:42 ` Akira Tsukamoto
2021-08-17 9:03 ` Akira Tsukamoto
2021-08-12 11:01 ` [PATCH 0/1] __asm_copy_to-from_user: Reduce more byte_copy Akira Tsukamoto
2021-08-15 2:30 ` Qiu Wenbo [this message]
[not found] ` <61187c37.1c69fb81.ed9bd.cc45SMTPIN_ADDED_BROKEN@mx.google.com>
2021-08-16 6:24 ` Akira Tsukamoto
2021-08-16 9:45 ` Qiu Wenbo
[not found] ` <611a33ac.1c69fb81.12aae.89a5SMTPIN_ADDED_BROKEN@mx.google.com>
2021-08-17 7:32 ` Akira Tsukamoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21b55fd7-7ab5-10e9-4fc9-1815ec95927d@kylinos.com.cn \
--to=qiuwenbo@kylinos.com.cn \
--cc=akira.tsukamoto@gmail.com \
--cc=aou@eecs.berkeley.edu \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@roeck-us.net \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).