mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
8f3f06dfd6
The algorithms work on 64 bytes at a time, which is the L1 cache line size of all current and future LoongArch cores (that we care about), as confirmed by Huacai. The code is based on the generic int.uc algorithm, unrolled 4 times for LSX and 2 times for LASX. Further unrolling does not meaningfully improve the performance according to experiments. Performance numbers measured during system boot on a 3A5000 @ 2.5GHz: > raid6: lasx gen() 12726 MB/s > raid6: lsx gen() 10001 MB/s > raid6: int64x8 gen() 2876 MB/s > raid6: int64x4 gen() 3867 MB/s > raid6: int64x2 gen() 2531 MB/s > raid6: int64x1 gen() 1945 MB/s Comparison of xor() speeds (from different boots but meaningful anyway): > lasx: 11226 MB/s > lsx: 6395 MB/s > int64x4: 2147 MB/s Performance as measured by raid6test: > raid6: lasx gen() 25109 MB/s > raid6: lsx gen() 13233 MB/s > raid6: int64x8 gen() 4164 MB/s > raid6: int64x4 gen() 6005 MB/s > raid6: int64x2 gen() 5781 MB/s > raid6: int64x1 gen() 4119 MB/s > raid6: using algorithm lasx gen() 25109 MB/s > raid6: .... xor() 14439 MB/s, rmw enabled Acked-by: Song Liu <song@kernel.org> Signed-off-by: WANG Xuerui <git@xen0n.name> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
39 lines
831 B
C
39 lines
831 B
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright (C) 2023 WANG Xuerui <git@xen0n.name>
|
|
*
|
|
* raid6/loongarch.h
|
|
*
|
|
* Definitions common to LoongArch RAID-6 code only
|
|
*/
|
|
|
|
#ifndef _LIB_RAID6_LOONGARCH_H
|
|
#define _LIB_RAID6_LOONGARCH_H
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <asm/cpu-features.h>
|
|
#include <asm/fpu.h>
|
|
|
|
#else /* for user-space testing */
|
|
|
|
#include <sys/auxv.h>
|
|
|
|
/* have to supply these defines for glibc 2.37- and musl */
|
|
#ifndef HWCAP_LOONGARCH_LSX
|
|
#define HWCAP_LOONGARCH_LSX (1 << 4)
|
|
#endif
|
|
#ifndef HWCAP_LOONGARCH_LASX
|
|
#define HWCAP_LOONGARCH_LASX (1 << 5)
|
|
#endif
|
|
|
|
#define kernel_fpu_begin()
|
|
#define kernel_fpu_end()
|
|
|
|
#define cpu_has_lsx (getauxval(AT_HWCAP) & HWCAP_LOONGARCH_LSX)
|
|
#define cpu_has_lasx (getauxval(AT_HWCAP) & HWCAP_LOONGARCH_LASX)
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* _LIB_RAID6_LOONGARCH_H */
|