Module: xenomai-2.6 Branch: master Commit: 3adaf6223c132fff9d8a07ce70e9b3072915eaa7 URL: http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=3adaf6223c132fff9d8a07ce70e9b3072915eaa7
Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org> Date: Wed Jul 6 15:02:21 2016 +0200 testsuite/switchtest: detect more FPU errors. Do not store the same value in all FP registers, so that if we access the backup area with an offset, we can detect it. Recheck the fpu registers after mode switches, in order to verify that the Linux and Xenomai backup areas are identical for Xenomai threads. This would have allowed to detect the issue fixed by commit d4e755b2a9909afb7bbd0a522ff1d97718494cd7 --- include/asm-arm/fptest.h | 8 ++++---- src/testsuite/switchtest/switchtest.c | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/asm-arm/fptest.h b/include/asm-arm/fptest.h index c695004..e2e5cb4 100644 --- a/include/asm-arm/fptest.h +++ b/include/asm-arm/fptest.h @@ -83,7 +83,7 @@ static inline void fp_regs_set(unsigned val) unsigned i; for (i = 0; i < 16; i++) - e[i] = val; + e[i] = val + i; /* vldm %0!, {d0-d15}, AKA fldmiax %0!, {d0-d15} */ @@ -106,9 +106,9 @@ static inline unsigned fp_regs_check(unsigned val) "=r"(i): "0"(&e[0]): "memory"); for (i = 0; i < 16; i++) - if (e[i] != val) { - printk("d%d: %llu != %u\n", i, e[i], val); - result = e[i]; + if (e[i] != val + i) { + printk("d%d: %llu != %u\n", i, e[i], val + i); + result = e[i] - i; } } diff --git a/src/testsuite/switchtest/switchtest.c b/src/testsuite/switchtest/switchtest.c index d27e684..7b4ab4a 100644 --- a/src/testsuite/switchtest/switchtest.c +++ b/src/testsuite/switchtest/switchtest.c @@ -361,7 +361,7 @@ static void *sleeper_switcher(void *cookie) /* If i % 3 == 2, repeat the same switch. */ } - expected = rtsw.from + i * 1000; + expected = rtsw.from * 1000 + i * 1000000; if (param->fp & UFPS) fp_regs_set(expected); err = ioctl(fd, RTTST_RTIOC_SWTEST_SWITCH_TO, &rtsw); @@ -487,7 +487,7 @@ static void *rtup(void *cookie) /* If i % 3 == 2, repeat the same switch. */ } - expected = rtsw.from + i * 1000; + expected = rtsw.from * 1000 + i * 1000000; if (param->fp & UFPP) fp_regs_set(expected); err = ioctl(fd, RTTST_RTIOC_SWTEST_SWITCH_TO, &rtsw); @@ -573,7 +573,7 @@ static void *rtus(void *cookie) /* If i % 3 == 2, repeat the same switch. */ } - expected = rtsw.from + i * 1000; + expected = rtsw.from * 1000 + i * 1000000; if (param->fp & UFPS) fp_regs_set(expected); err = ioctl(fd, RTTST_RTIOC_SWTEST_SWITCH_TO, &rtsw); @@ -659,7 +659,7 @@ static void *rtuo(void *cookie) /* If i % 3 == 2, repeat the same switch. */ } - expected = rtsw.from + i * 1000; + expected = rtsw.from * 1000 + i * 1000000; if ((mode && param->fp & UFPP) || (!mode && param->fp & UFPS)) fp_regs_set(expected); err = ioctl(fd, RTTST_RTIOC_SWTEST_SWITCH_TO, &rtsw); @@ -674,6 +674,7 @@ static void *rtuo(void *cookie) case -1: clean_exit(EXIT_FAILURE); } + if ((mode && param->fp & UFPP) || (!mode && param->fp & UFPS)) { fp_val = fp_regs_check(expected); if (fp_val != expected) @@ -682,14 +683,22 @@ static void *rtuo(void *cookie) /* Switch mode. */ if (i % 3 == 2) { - mode = PTHREAD_PRIMARY - mode; if ((err = pthread_set_mode_np - (PTHREAD_PRIMARY - mode, mode))) { + (mode, PTHREAD_PRIMARY - mode))) { fprintf(stderr, "rtuo: pthread_set_mode_np: %s\n", strerror(err)); clean_exit(EXIT_FAILURE); } + + /* Recheck the registers after the mode switch */ + if ((mode && param->fp & UFPP) || (!mode && param->fp & UFPS)) { + fp_val = fp_regs_check(expected); + if (fp_val != expected) + handle_bad_fpreg(param->cpu, fp_val); + } + + mode = PTHREAD_PRIMARY - mode; } if(++i == 4000000) _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git