[PATCH v5 3/3] riscv: optimized memset
Ley Foon Tan
lftan.linux at gmail.com
Thu Nov 25 02:56:41 PST 2021
On Thu, Sep 30, 2021 at 1:56 AM Matteo Croce <mcroce at linux.microsoft.com> wrote:
>
> From: Matteo Croce <mcroce at microsoft.com>
>
> The generic memset is defined as a byte at time write. This is always
> safe, but it's slower than a 4 byte or even 8 byte write.
>
> Write a generic memset which fills the data one byte at time until the
> destination is aligned, then fills using the largest size allowed,
> and finally fills the remaining data one byte at time.
>
> Signed-off-by: Matteo Croce <mcroce at microsoft.com>
> ---
> arch/riscv/include/asm/string.h | 10 +--
> arch/riscv/kernel/Makefile | 1 -
> arch/riscv/kernel/riscv_ksyms.c | 13 ----
> arch/riscv/lib/Makefile | 1 -
> arch/riscv/lib/memset.S | 113 --------------------------------
> arch/riscv/lib/string.c | 41 ++++++++++++
> 6 files changed, 44 insertions(+), 135 deletions(-)
> delete mode 100644 arch/riscv/kernel/riscv_ksyms.c
> delete mode 100644 arch/riscv/lib/memset.S
This patch causes the Linux kernel to hang if compile with LLVM/Clang.
Tested on Qemu.
Steps to compile with Clang:
make CC=clang defconfig
make CC=clang -j
Boot log:
[ 0.000000] Linux version 5.15.4-01003-g23eeaac40da8 (xxxxx at ubuntu)
(clang version 14.0.0 (https://github.com/llvm/llvm-project
6b715e9c4d9cc00f59906d48cd57f4c767229093), GNU ld (GNU Binutils)
2.36.1) #151 SMP Thu Nov 25 18:41:47 +08 2021
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Machine model: riscv-virtio,qemu
[ 0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[ 0.000000] printk: bootconsole [sbi0] enabled
[ 0.000000] efi: UEFI not found.
Regards
Ley Foon
More information about the linux-riscv
mailing list