aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig8
-rw-r--r--lib/raid6/algos.c81
-rw-r--r--lib/raid6/test/Makefile3
3 files changed, 54 insertions, 38 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index 79bc2eef9c14..a9e56539bd11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -10,6 +10,14 @@ menu "Library routines"
10config RAID6_PQ 10config RAID6_PQ
11 tristate 11 tristate
12 12
13config RAID6_PQ_BENCHMARK
14 bool "Automatically choose fastest RAID6 PQ functions"
15 depends on RAID6_PQ
16 default y
17 help
18 Benchmark all available RAID6 PQ functions on init and choose the
19 fastest one.
20
13config BITREVERSE 21config BITREVERSE
14 tristate 22 tristate
15 23
diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c
index 5065b1e7e327..7e4f7a8ffa8e 100644
--- a/lib/raid6/algos.c
+++ b/lib/raid6/algos.c
@@ -34,64 +34,64 @@ struct raid6_calls raid6_call;
34EXPORT_SYMBOL_GPL(raid6_call); 34EXPORT_SYMBOL_GPL(raid6_call);
35 35
36const struct raid6_calls * const raid6_algos[] = { 36const struct raid6_calls * const raid6_algos[] = {
37#if defined(__ia64__)
38 &raid6_intx16,
39 &raid6_intx32,
40#endif
41#if defined(__i386__) && !defined(__arch_um__) 37#if defined(__i386__) && !defined(__arch_um__)
42 &raid6_mmxx1,
43 &raid6_mmxx2,
44 &raid6_sse1x1,
45 &raid6_sse1x2,
46 &raid6_sse2x1,
47 &raid6_sse2x2,
48#ifdef CONFIG_AS_AVX2
49 &raid6_avx2x1,
50 &raid6_avx2x2,
51#endif
52#ifdef CONFIG_AS_AVX512 38#ifdef CONFIG_AS_AVX512
53 &raid6_avx512x1,
54 &raid6_avx512x2, 39 &raid6_avx512x2,
40 &raid6_avx512x1,
55#endif 41#endif
56#endif
57#if defined(__x86_64__) && !defined(__arch_um__)
58 &raid6_sse2x1,
59 &raid6_sse2x2,
60 &raid6_sse2x4,
61#ifdef CONFIG_AS_AVX2 42#ifdef CONFIG_AS_AVX2
62 &raid6_avx2x1,
63 &raid6_avx2x2, 43 &raid6_avx2x2,
64 &raid6_avx2x4, 44 &raid6_avx2x1,
45#endif
46 &raid6_sse2x2,
47 &raid6_sse2x1,
48 &raid6_sse1x2,
49 &raid6_sse1x1,
50 &raid6_mmxx2,
51 &raid6_mmxx1,
65#endif 52#endif
53#if defined(__x86_64__) && !defined(__arch_um__)
66#ifdef CONFIG_AS_AVX512 54#ifdef CONFIG_AS_AVX512
67 &raid6_avx512x1,
68 &raid6_avx512x2,
69 &raid6_avx512x4, 55 &raid6_avx512x4,
56 &raid6_avx512x2,
57 &raid6_avx512x1,
70#endif 58#endif
59#ifdef CONFIG_AS_AVX2
60 &raid6_avx2x4,
61 &raid6_avx2x2,
62 &raid6_avx2x1,
63#endif
64 &raid6_sse2x4,
65 &raid6_sse2x2,
66 &raid6_sse2x1,
71#endif 67#endif
72#ifdef CONFIG_ALTIVEC 68#ifdef CONFIG_ALTIVEC
73 &raid6_altivec1,
74 &raid6_altivec2,
75 &raid6_altivec4,
76 &raid6_altivec8,
77 &raid6_vpermxor1,
78 &raid6_vpermxor2,
79 &raid6_vpermxor4,
80 &raid6_vpermxor8, 69 &raid6_vpermxor8,
70 &raid6_vpermxor4,
71 &raid6_vpermxor2,
72 &raid6_vpermxor1,
73 &raid6_altivec8,
74 &raid6_altivec4,
75 &raid6_altivec2,
76 &raid6_altivec1,
81#endif 77#endif
82#if defined(CONFIG_S390) 78#if defined(CONFIG_S390)
83 &raid6_s390vx8, 79 &raid6_s390vx8,
84#endif 80#endif
85 &raid6_intx1,
86 &raid6_intx2,
87 &raid6_intx4,
88 &raid6_intx8,
89#ifdef CONFIG_KERNEL_MODE_NEON 81#ifdef CONFIG_KERNEL_MODE_NEON
90 &raid6_neonx1,
91 &raid6_neonx2,
92 &raid6_neonx4,
93 &raid6_neonx8, 82 &raid6_neonx8,
83 &raid6_neonx4,
84 &raid6_neonx2,
85 &raid6_neonx1,
94#endif 86#endif
87#if defined(__ia64__)
88 &raid6_intx32,
89 &raid6_intx16,
90#endif
91 &raid6_intx8,
92 &raid6_intx4,
93 &raid6_intx2,
94 &raid6_intx1,
95 NULL 95 NULL
96}; 96};
97 97
@@ -163,6 +163,11 @@ static inline const struct raid6_calls *raid6_choose_gen(
163 if ((*algo)->valid && !(*algo)->valid()) 163 if ((*algo)->valid && !(*algo)->valid())
164 continue; 164 continue;
165 165
166 if (!IS_ENABLED(CONFIG_RAID6_PQ_BENCHMARK)) {
167 best = *algo;
168 break;
169 }
170
166 perf = 0; 171 perf = 0;
167 172
168 preempt_disable(); 173 preempt_disable();
diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile
index 79777645cac9..3ab8720aa2f8 100644
--- a/lib/raid6/test/Makefile
+++ b/lib/raid6/test/Makefile
@@ -34,6 +34,9 @@ endif
34 34
35ifeq ($(IS_X86),yes) 35ifeq ($(IS_X86),yes)
36 OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o 36 OBJS += mmx.o sse1.o sse2.o avx2.o recov_ssse3.o recov_avx2.o avx512.o recov_avx512.o
37 CFLAGS += $(shell echo "pshufb %xmm0, %xmm0" | \
38 gcc -c -x assembler - >&/dev/null && \
39 rm ./-.o && echo -DCONFIG_AS_SSSE3=1)
37 CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \ 40 CFLAGS += $(shell echo "vpbroadcastb %xmm0, %ymm1" | \
38 gcc -c -x assembler - >&/dev/null && \ 41 gcc -c -x assembler - >&/dev/null && \
39 rm ./-.o && echo -DCONFIG_AS_AVX2=1) 42 rm ./-.o && echo -DCONFIG_AS_AVX2=1)