Skip to content

Commit 2dbf708

Browse files
jtkukunasneilbrown
authored andcommitted
lib/raid6: update test program for recovery functions
Test each combination of recovery and syndrome generation functions. Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
1 parent 048a8b8 commit 2dbf708

3 files changed

Lines changed: 32 additions & 17 deletions

File tree

‎lib/raid6/test/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RANLIB = ranlib
2323
all: raid6.a raid6test
2424

2525
raid6.a: int1.o int2.o int4.o int8.o int16.o int32.o mmx.o sse1.o sse2.o \
26-
altivec1.o altivec2.o altivec4.o altivec8.o recov.o algos.o \
26+
altivec1.o altivec2.o altivec4.o altivec8.o recov.o recov_ssse3.o algos.o \
2727
tables.o
2828
rm -f $@
2929
$(AR) cq $@ $^

‎lib/raid6/test/test.c‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,35 @@ static int test_disks(int i, int j)
9090
int main(int argc, char *argv[])
9191
{
9292
const struct raid6_calls *const *algo;
93+
const struct raid6_recov_calls *const *ra;
9394
int i, j;
9495
int err = 0;
9596

9697
makedata();
9798

98-
for (algo = raid6_algos; *algo; algo++) {
99-
if (!(*algo)->valid || (*algo)->valid()) {
100-
raid6_call = **algo;
99+
for (ra = raid6_recov_algos; *ra; ra++) {
100+
if ((*ra)->valid && !(*ra)->valid())
101+
continue;
102+
raid6_2data_recov = (*ra)->data2;
103+
raid6_datap_recov = (*ra)->datap;
101104

102-
/* Nuke syndromes */
103-
memset(data[NDISKS-2], 0xee, 2*PAGE_SIZE);
105+
printf("using recovery %s\n", (*ra)->name);
104106

105-
/* Generate assumed good syndrome */
106-
raid6_call.gen_syndrome(NDISKS, PAGE_SIZE,
107-
(void **)&dataptrs);
107+
for (algo = raid6_algos; *algo; algo++) {
108+
if (!(*algo)->valid || (*algo)->valid()) {
109+
raid6_call = **algo;
108110

109-
for (i = 0; i < NDISKS-1; i++)
110-
for (j = i+1; j < NDISKS; j++)
111-
err += test_disks(i, j);
111+
/* Nuke syndromes */
112+
memset(data[NDISKS-2], 0xee, 2*PAGE_SIZE);
113+
114+
/* Generate assumed good syndrome */
115+
raid6_call.gen_syndrome(NDISKS, PAGE_SIZE,
116+
(void **)&dataptrs);
117+
118+
for (i = 0; i < NDISKS-1; i++)
119+
for (j = i+1; j < NDISKS; j++)
120+
err += test_disks(i, j);
121+
}
112122
}
113123
printf("\n");
114124
}

‎lib/raid6/x86.h‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,29 @@ static inline void kernel_fpu_end(void)
3535
{
3636
}
3737

38+
#define __aligned(x) __attribute__((aligned(x)))
39+
3840
#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
3941
#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions
4042
* (fast save and restore) */
4143
#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */
4244
#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */
45+
#define X86_FEATURE_XMM3 (4*32+ 0) /* "pni" SSE-3 */
46+
#define X86_FEATURE_SSSE3 (4*32+ 9) /* Supplemental SSE-3 */
47+
#define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */
4348
#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
4449

4550
/* Should work well enough on modern CPUs for testing */
4651
static inline int boot_cpu_has(int flag)
4752
{
48-
u32 eax = (flag >> 5) ? 0x80000001 : 1;
49-
u32 edx;
53+
u32 eax = (flag & 0x20) ? 0x80000001 : 1;
54+
u32 ecx, edx;
5055

5156
asm volatile("cpuid"
52-
: "+a" (eax), "=d" (edx)
53-
: : "ecx", "ebx");
57+
: "+a" (eax), "=d" (edx), "=c" (ecx)
58+
: : "ebx");
5459

55-
return (edx >> (flag & 31)) & 1;
60+
return ((flag & 0x80 ? ecx : edx) >> (flag & 31)) & 1;
5661
}
5762

5863
#endif /* ndef __KERNEL__ */

0 commit comments

Comments
 (0)