RFC: switchtest FPU, introduce option to enforce testing
Hey,
currently the switchtest will not run FPU related tests on x86 when some kernel-CONFIGS are set. (CONFIG_X86_USE_3DNOW, CONFIG_MD_RAID456)
http://git.xenomai.org/xenomai-3.git/tree/kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h#n32
The FPU switching code is infamous for popping up with every other kernel-release. Therefore i think this test is extremely important and should not "just" be ignored on a "typical" kernel config.
In order to run the test today you have to change your kernel config, boot that kernel and run the test. If it works you can change back to the config you had before and you should be safe. But that is a lot of work and you will not be running the test on your "actual" kernel.
As far as i understand the situation this is a safeguard so you do not mess up your raid when you do active developement on a machine with say a raid-rootfs. For such a scenario running that kind of stress test on a subsystem that is known to break easily is a bad idea.
http://www.xenomai.org/pipermail/xenomai/2016-August/036598.html
But say your test machine is disposable or known to not use RAID etc. It would be nice to have a way to enforce the test anyway. A good example for such a scenario is CI where you might want to test your actual production kernel and not a second kernel that comes close.
I would like to add a --force option to switchtest, pass that up to the kernel to skip the sanity check there.
Or would that be a bad idea?
Henning
PATCH 1/1 testsuite/switchtest/x86: allow in kernel-FPU testing
Not running the in-kernel FPU tests while Linux might be using the FPU in kernel-mode is a safeguard measure for development versions that might still have issues with FPU context switching. i.e. it prevents data corruption on RAIDs beeing triggered by an FPU Bug.
In a bug-free kernel running the switchtest in kernel-mode is not a problem and may be desired for proper test-coverage.
This patch introduces a command line option to switchtest to allow overriding the safeguard.
--- include/rtdm/uapi/testing.h | 1 + kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/blackfin/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h | 14 ++++++++++++-- kernel/drivers/testing/switchtest.c | 7 +++++-- testsuite/switchtest/switchtest.c | 11 ++++++++++- 8 files changed, 32 insertions(+), 9 deletions(-)
include/rtdm/uapi/testing.h +1 -0
@@ -70,6 +70,7 @@ struct rttst_swtest_task {#define RTTST_SWTEST_FPU 0x1#define RTTST_SWTEST_USE_FPU 0x2/* Only for kernel-space tasks. */ #define RTTST_SWTEST_FREEZE 0x4/* Only for kernel-space tasks. */ +#define RTTST_SWTEST_FORCE 0x8/* Only for kernel-space tasks. */ struct rttst_swtest_dir {unsigned int from;
kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h +1 -1
@@ -35,7 +35,7 @@ static inline int fp_kernel_supported(void)return 1 ; } -static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }
kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h +1 -1
@@ -30,7 +30,7 @@ static inline int fp_kernel_supported(void)return 1 ; } -static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }
kernel/cobalt/arch/blackfin/include/asm/xenomai/fptest.h +1 -1
@@ -27,7 +27,7 @@ static inline int fp_kernel_supported(void)return 0 ; } -static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }
kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h +1 -1
@@ -41,7 +41,7 @@ static inline int fp_kernel_supported(void)#endif /* !CONFIG_PPC_FPU */ } -static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }
kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h +12 -2
@@ -29,13 +29,15 @@ static inline int fp_kernel_supported(void)return 1 ; } -static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {#if defined(CONFIG_X86_USE_3DNOW ) \ || defined(CONFIG_MD_RAID456 ) || defined(CONFIG_MD_RAID456_MODULE )/* Ther kernel uses x86 FPU, we can not also use it in our tests. */ static int once =0 ; -if (!once) { +if (force) + goto nocheck; +if (once !=1 ) { once =1 ;printk ("%s:%d: Warning: Linux is compiled to use FPU in " "kernel-space.\nFor this reason, switchtest can not "
@@ -43,6 +45,14 @@ static inline int fp_linux_begin(void) __FILE__, __LINE__); }return -EBUSY ; +nocheck: +if (once !=2 ) { + once =2 ; +printk ("%s:%d: Warning: Switchtest is using FPU in " +"kernel-space\nwhile Linux might do so as well.\n" , + __FILE__, __LINE__); + + }#endif /* 3DNow or RAID 456 */ kernel_fpu_begin ();/* kernel_fpu_begin() does no re-initialize the fpu context, but
kernel/drivers/testing/switchtest.c +5 -2
@@ -276,7 +276,10 @@ static int rtswitch_to_nrt(struct rtswitch_context *ctx,case RTSWITCH_RT : -if (!fp_check ||fp_linux_begin () <0 ) { +if (!fp_check || +fp_linux_begin (to->base.flags &RTTST_SWTEST_FORCE ) + <0 ) + { fp_check =0 ; goto signal_nofp; }
@@ -308,7 +311,7 @@ static int rtswitch_to_nrt(struct rtswitch_context *ctx, (ctx->switches_count %4000000 ) *1000 ;barrier (); -fp_linux_begin (); +fp_linux_begin (to->base.flags &RTTST_SWTEST_FORCE );fp_regs_set (fp_features, expected);rtdm_event_signal (&to->rt_synch); fp_val =fp_regs_check (fp_features, expected, report);
testsuite/switchtest/switchtest.c +10 -1
@@ -89,6 +89,7 @@ static struct timespec start;static pthread_mutex_t headers_lock;static unsigned long data_lines =21 ;static unsigned freeze_on_error; +static unsigned force_kernel_fpu;static int fp_features;static pthread_t main_tid;
@@ -815,7 +816,8 @@ static int task_create(struct cpu_tasks *cpu,case RTK : param->swt.flags = (param->fp &AFP ?RTTST_SWTEST_FPU :0 ) | (param->fp &UFPP ?RTTST_SWTEST_USE_FPU :0 ) - | (freeze_on_error ?RTTST_SWTEST_FREEZE :0 ); + | (freeze_on_error ?RTTST_SWTEST_FREEZE :0 ) + | (force_kernel_fpu ?RTTST_SWTEST_FORCE :0 ); err=ioctl (cpu->fd,RTTST_RTIOC_SWTEST_CREATE_KTASK ,¶m->swt);if (err) {
@@ -1012,6 +1014,8 @@ static void usage(FILE *fd, const char *progname)"--stress <period> or -s <period> enable a stress mode where:\n" " context switches occur every <period> us;\n" " a background task uses fpu (and check) fpu all the time.\n" +"--force-kernel-fpu run in kernel fpu tests even if the kernel" +" seems to be using the fpu internally.\n" "--freeze trace upon error.\n\n" "Each 'threadspec' specifies the characteristics of a " "thread to be created:\n"
@@ -1154,6 +1158,7 @@ int main(int argc, const char *argv[]) opterr =0 ;for (;;) {static struct option long_options[] = { + {"force-kernel-fpu" ,0 ,NULL ,'F' }, {"freeze" ,0 ,NULL ,'f' }, {"help" ,0 ,NULL ,'h' }, {"lines" ,1 ,NULL ,'l' },
@@ -1172,6 +1177,10 @@ int main(int argc, const char *argv[])break ;switch (c) { +case 'F' : + force_kernel_fpu =1 ; +break ; +case 'f' : freeze_on_error =1 ;break ;
Signature · 1 line
2.10.2
Re: [Xenomai] [PATCH] testsuite/switchtest/x86: allow in kernel-FPU testing
Quoted 9 lines · On Fri, 27 Jan 2017 14:52:22 +0100 Henning Schild <[email protected]>…
Not running the in-kernel FPU tests while Linux might be using the FPU in kernel-mode is a safeguard measure for development versions that might still have issues with FPU context switching. i.e. it prevents data corruption on RAIDs beeing triggered by an FPU Bug.
In a bug-free kernel running the switchtest in kernel-mode is not a problem and may be desired for proper test-coverage.This patch introduces a command line option to switchtest to allow overriding the safeguard.
I am not sure i am happy with this solution either. Actually the test should always run as part of the unit tests. It is very valuable and skipping it "silently" is a really bad idea.
If it is really just disabled for when it might mess with your raid on the machine you do kernel development on, maybe you should not use such a machine for that?
So i am starting to think the test should run by default and the conservative version should be opt-in instead of opt-out.
Henning
Quoted 194 lines
Signed-off-by Henning Schild <[email protected]>--- include/rtdm/uapi/testing.h | 1 + kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/blackfin/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h | 2 +- kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h | 14++++++++++++--
kernel/drivers/testing/switchtest.c| 7 +++++--testsuite/switchtest/switchtest.c| 11
++++++++++- 8 files changed, 32 insertions(+), 9 deletions(-)include/rtdm/uapi/testing.h +0
-0@@ -70,6 +70,7 @@ struct rttst_swtest_task {#define RTTST_SWTEST_FPU 0x1#define RTTST_SWTEST_USE_FPU 0x2/* Only for kernel-space tasks. */ #define
RTTST_SWTEST_FREEZE0x4/* Only for kernel-space tasks. */ +#defineRTTST_SWTEST_FORCE0x8/* Only for kernel-space tasks.
*/ structrttst_swtest_dir{include/rtdm/uapi/testing.h +0
-0unsigned int from;(quoted diff) +0
-0
b/kernel/cobalt/arch/arm/include/asm/xenomai/fptest.hindex a76f1e6..7bc92f3 100644 ---a/kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h+++b/kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h@@ -35,7 +35,7 @@ static inline intfp_kernel_supported(void)return 1;
}kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h +1
-1-static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }(quoted diff) +0
-0
b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.hindex cfdf0b3..c15e1a5 100644 ---a/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h+++b/kernel/cobalt/arch/arm64/include/asm/xenomai/fptest.h@@ -30,7 +30,7 @@ static inline intfp_kernel_supported(void)return 1;
}kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h +1
-1-static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }(quoted diff) +0
-0
b/kernel/cobalt/arch/blackfin/include/asm/xenomai/fptest.hindex 904ce83..6ef979a 100644 ---a/kernel/cobalt/arch/blackfin/include/asm/xenomai/fptest.h+++b/kernel/cobalt/arch/blackfin/include/asm/xenomai/fptest.h@@ -27,7 +27,7 @@ static inline intfp_kernel_supported(void)return 0;
}kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h +1
-1-static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }(quoted diff) +0
-0
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.hindex e09ca2c..48bec0a 100644 ---a/kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h+++b/kernel/cobalt/arch/powerpc/include/asm/xenomai/fptest.h@@ -41,7 +41,7 @@ static inline intfp_kernel_supported(void)
#endif /* !CONFIG_PPC_FPU */ }kernel/cobalt/arch/arm/include/asm/xenomai/fptest.h +1
-1-static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) {return -ENOSYS ; }(quoted diff) +0
-0
b/kernel/cobalt/arch/x86/include/asm/xenomai/fptest.hindex f0ecd00..3c1fe3c 100644 ---a/kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h+++b/kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h@@ -29,13 +29,15 @@ static inline intfp_kernel_supported(void)return 1;
}kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h +1
-1-static inline int fp_linux_begin (void ) +static inline int fp_linux_begin (int __maybe_unused force) { #if defined(CONFIG_X86_USE_3DNOW) \ || defined(CONFIG_MD_RAID456) ||
defined(CONFIG_MD_RAID456_MODULE)/* Ther kernel uses x86 FPU, we can not also use it in our tests. */ static int once = 0;kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h +3
-1-if (!once) { +if (force) + goto nocheck; +if (once !=1 ) { once =1 ; printk("%s:%d: Warning: Linux is compiled to use FPUin " "kernel-space.\nFor this reason, switchtest can not "
kernel/cobalt/arch/x86/include/asm/xenomai/fptest.h +8
-0@@ -43,6 +45,14 @@ static inline int fp_linux_begin(void) __FILE__, __LINE__); }return -EBUSY ; +nocheck: +if (once !=2 ) { + once =2 ; +printk ("%s:%d: Warning: Switchtest is using FPU in " + "kernel-space\nwhile Linux might do so as well.\n", + __FILE__, __LINE__); + + }#endif /* 3DNow or RAID 456 */ kernel_fpu_begin ();/*
kernel_fpu_begin()does no re-initialize the fpu context,
but diff --gita/kernel/drivers/testing/switchtest.cb/kernel/drivers/testing/switchtest.cindex 3a2e0d5..3befae2 100644kernel/drivers/testing/switchtest.c +4
-1@@ -276,7 +276,10 @@ static int rtswitch_to_nrt(struct rtswitch_context *ctx, case RTSWITCH_RT: -if (!fp_check ||fp_linux_begin () <0 ) { +if (!fp_check || +fp_linux_begin (to->base.flags &RTTST_SWTEST_FORCE ) + <0 ) + { fp_check =0 ; goto signal_nofp;kernel/drivers/testing/switchtest.c +1
-1}@@ -308,7 +311,7 @@ static int rtswitch_to_nrt(struct rtswitch_context *ctx, (ctx->switches_count %4000000 ) *1000 ;barrier (); -fp_linux_begin (); +fp_linux_begin (to->base.flags &RTTST_SWTEST_FORCE );fp_regs_set (fp_features, expected);rtdm_event_signal (&to->rt_synch); fp_val = fp_regs_check(fp_features,expected, report); diff --git
a/testsuite/switchtest/switchtest.cb/testsuite/switchtest/switchtest.cindex 5c102a2..66b5b84 100644testsuite/switchtest/switchtest.c +3
-1@@ -89,6 +89,7 @@ static struct timespec start;static pthread_mutex_t headers_lock;static unsigned long data_lines =21 ;static unsigned freeze_on_error; +static unsigned force_kernel_fpu;static int fp_features;static pthread_t main_tid;@@ -815,7 +816,8 @@ static int task_create(struct cpu_tasks *cpu,case RTK : param->swt.flags = (param->fp &AFP ?RTTST_SWTEST_FPU :0 ) | (param->fp &UFPP ?RTTST_SWTEST_USE_FPU :0 ) - | (freeze_on_error ?RTTST_SWTEST_FREEZE : 0); + | (freeze_on_error ? RTTST_SWTEST_FREEZE : 0) + | (force_kernel_fpu ?RTTST_SWTEST_FORCE :0 ); err=ioctl (cpu->fd,RTTST_RTIOC_SWTEST_CREATE_KTASK ,¶m->swt);testsuite/switchtest/switchtest.c +0
-0if (err) {@@ -1012,6 +1014,8 @@ static void usage(FILE *fd, const char *progname) "--stress <period> or -s <period> enable a stress modewhere:\n" " context switches occur every <period> us;\n"
" a background task uses fpu (and check) fpu all
the time.\n"testsuite/switchtest/switchtest.c +1
-0+ "--force-kernel-fpu run in kernel fpu tests even ifthe kernel"
testsuite/switchtest/switchtest.c +1
-0+" seems to be using the fpu internally.\n" "--freeze trace upon error.\n\n" "Each 'threadspec' specifies the characteristics ofa " "thread to be created:\n"
testsuite/switchtest/switchtest.c +5
-0@@ -1154,6 +1158,7 @@ int main(int argc, const char *argv[]) opterr =0 ;for (;;) {static struct option long_options[] = { + {"force-kernel-fpu" ,0 ,NULL ,'F' }, {"freeze" ,0 ,NULL ,'f' }, {"help" ,0 ,NULL ,'h' }, {"lines" ,1 ,NULL ,'l' },@@ -1172,6 +1177,10 @@ int main(int argc, const char *argv[])break ;switch (c) { +case 'F' : + force_kernel_fpu =1 ; +break ; +case 'f' : freeze_on_error =1 ;break ;
Re: [Xenomai] [PATCH] testsuite/switchtest/x86: allow in kernel-FPU testing
Quoted 13 lines · Henning Schild
Quoted 9 lines · On Fri, 27 Jan 2017 14:52:22 +0100 Henning Schild <[email protected]>…
Not running the in-kernel FPU tests while Linux might be using the FPU in kernel-mode is a safeguard measure for development versions that might still have issues with FPU context switching. i.e. it prevents data corruption on RAIDs beeing triggered by an FPU Bug.
In a bug-free kernel running the switchtest in kernel-mode is not a problem and may be desired for proper test-coverage.This patch introduces a command line option to switchtest to allow overriding the safeguard.
Quoted 9 lines
I am not sure i am happy with this solution either. Actually the test should always run as part of the unit tests. It is very valuable and skipping it "silently" is a really bad idea.
If it is really just disabled for when it might mess with your raid on the machine you do kernel development on, maybe you should not use such a machine for that?
So i am starting to think the test should run by default and the conservative version should be opt-in instead of opt-out.
A conservative version can only be opt-out, otherwise people may run into damages without knowing, which would defeat the intent of picking the conservative approach.
I'm still pondering whether this test makes sense in 3.x, given that official support for running fpu ops over rt threads in kernel space was dropped for that version. Too much of a mess.
Signature · 1 line
Philippe.
Re: [Xenomai] [PATCH] testsuite/switchtest/x86: allow in kernel-FPU testing
Quoted 24 lines · On Fri, 27 Jan 2017 15:10:59 +0100 Philippe Gerum <[email protected]> wrote:
Quoted 13 lines · Henning Schild
Quoted 9 lines · On Fri, 27 Jan 2017 14:52:22 +0100 Henning Schild <[email protected]>…
Not running the in-kernel FPU tests while Linux might be using the FPU in kernel-mode is a safeguard measure for development versions that might still have issues with FPU context switching. i.e. it prevents data corruption on RAIDs beeing triggered by an FPU Bug. In a bug-free kernel running the switchtest in kernel-mode is not a problem and may be desired for proper test-coverage.
This patch introduces a command line option to switchtest to allow overriding the safeguard.
Quoted 9 lines
I am not sure i am happy with this solution either. Actually the test should always run as part of the unit tests. It is very valuable and skipping it "silently" is a really bad idea. If it is really just disabled for when it might mess with your raid on the machine you do kernel development on, maybe you should not use such a machine for that?
So i am starting to think the test should run by default and the conservative version should be opt-in instead of opt-out.
Quoted 3 lines
A conservative version can only be opt-out, otherwise people may run into damages without knowing, which would defeat the intent of picking the conservative approach.
There should at least be a prominent notice that an important test was skipped. The once-printk is just not the right place. Maybe the whole testcase should fail instead so that people have to say --kfpu-may-be-skipped
Maybe i still did not fully understand why the test gets skipped. I have seen CONFIG_CIFS_SMB2 trigger the FPU problem in the broken 4.1. Would that be a reason to add that to the list of switches skipping the test? Or is the whole thing really just there to protect devs from messing up their raids?
I do not see who does kernel development on a machine so valueable to justify skipping such an important test for everyone.
Quoted 3 lines
I'm still pondering whether this test makes sense in 3.x, given that official support for running fpu ops over rt threads in kernel space was dropped for that version. Too much of a mess.
Ok, i am actually again looking primarily at xenomai-2 and was planning on backporting whatever we come up with.
Henning
Re: [Xenomai] [PATCH] testsuite/switchtest/x86: allow in kernel-FPU testing
Quoted 27 lines · Henning Schild
Quoted 24 lines · On Fri, 27 Jan 2017 15:10:59 +0100 Philippe Gerum <[email protected]> wrote:
Quoted 22 lines · Henning Schild
Quoted 9 lines · On Fri, 27 Jan 2017 14:52:22 +0100 Henning Schild <[email protected]>…
Not running the in-kernel FPU tests while Linux might be using the FPU in kernel-mode is a safeguard measure for development versions that might still have issues with FPU context switching. i.e. it prevents data corruption on RAIDs beeing triggered by an FPU Bug. In a bug-free kernel running the switchtest in kernel-mode is not a problem and may be desired for proper test-coverage.
This patch introduces a command line option to switchtest to allow overriding the safeguard.
I am not sure i am happy with this solution either. Actually the test should always run as part of the unit tests. It is very valuable and skipping it "silently" is a really bad idea. If it is really just disabled for when it might mess with your raid on the machine you do kernel development on, maybe you should not use such a machine for that?
So i am starting to think the test should run by default and the conservative version should be opt-in instead of opt-out.
Quoted 8 lines
Quoted 3 lines
A conservative version can only be opt-out, otherwise people may run into damages without knowing, which would defeat the intent of picking the conservative approach.
There should at least be a prominent notice that an important test was skipped. The once-printk is just not the right place. Maybe the whole testcase should fail instead so that people have to say --kfpu-may-be-skipped
That sounds like a fair compromise.
Quoted 6 lines
Maybe i still did not fully understand why the test gets skipped. I have seen
CONFIG_CIFS_SMB2trigger the FPU problem in the broken 4.1. Would that be a reason to add that to the list of switches skipping the test? Or is the whole thing really just there to protect devs from messing up their raids?
I seem to remember that Gilles and I eventually agreed a long time ago on skipping those tests, due to the impossibility for us to reach a proper test coverage for fpu in kernel space when those options are enabled, with potentially hard damages upon bugs (e.g. RAID). Given that fpu support in kernel space over real-time threads was already deprecated at that time, we did not see any point in making the test and maintenance process even more complex to keep it as a first class citizen.
Quoted 3 lines
I do not see who does kernel development on a machine so valueable to justify skipping such an important test for everyone.
Well, I must admit that I would not run a development version of any kernel code on a system which holds critically important data either. But I don't think that we can impose such a restriction on people competing for the Darwin Awards.
Quoted 7 lines
Quoted 3 lines
I'm still pondering whether this test makes sense in 3.x, given that official support for running fpu ops over rt threads in kernel space was dropped for that version. Too much of a mess.
Ok, i am actually again looking primarily at xenomai-2 and was planning on backporting whatever we come up with.
I'm ok with pushing this to the 2.x branch, but then I'll cowardly let you deal with any follow up from the user base regarding this.
Signature · 1 line
Philippe.
Re: [Xenomai] [PATCH] testsuite/switchtest/x86: allow in kernel-FPU testing
Quoted 33 lines · On Thu, 2 Feb 2017 10:43:33 +0100 Philippe Gerum <[email protected]> wrote:
Quoted 32 lines · Henning Schild
Quoted 28 lines · On Fri, 27 Jan 2017 15:10:59 +0100 Philippe Gerum <[email protected]> wrote:
Quoted 14 lines · Henning Schild
Quoted 10 lines · On Fri, 27 Jan 2017 14:52:22 +0100 Henning Schild <[email protected]>…
Not running the in-kernel FPU tests while Linux might be using the FPU in kernel-mode is a safeguard measure for development versions that might still have issues with FPU context switching. i.e. it prevents data corruption on RAIDs beeing triggered by an FPU Bug. In a bug-free kernel running the switchtest in kernel-mode is not a problem and may be desired for proper test-coverage.
This patch introduces a command line option to switchtest to allow overriding the safeguard.
Quoted 9 lines
I am not sure i am happy with this solution either. Actually the test should always run as part of the unit tests. It is very valuable and skipping it "silently" is a really bad idea. If it is really just disabled for when it might mess with your raid on the machine you do kernel development on, maybe you should not use such a machine for that?
So i am starting to think the test should run by default and the conservative version should be opt-in instead of opt-out.A conservative version can only be opt-out, otherwise people may run into damages without knowing, which would defeat the intent of picking the conservative approach.
Quoted 6 lines
Quoted 4 lines
There should at least be a prominent notice that an important test was skipped. The once-printk is just not the right place. Maybe the whole testcase should fail instead so that people have to say --kfpu-may-be-skipped
That sounds like a fair compromise.
I also like that better than what the current patch does.
Quoted 29 lines
Quoted 6 lines
Maybe i still did not fully understand why the test gets skipped. I have seen
CONFIG_CIFS_SMB2trigger the FPU problem in the broken 4.1. Would that be a reason to add that to the list of switches skipping the test? Or is the whole thing really just there to protect devs from messing up their raids?I seem to remember that Gilles and I eventually agreed a long time ago on skipping those tests, due to the impossibility for us to reach a proper test coverage for fpu in kernel space when those options are enabled, with potentially hard damages upon bugs (e.g. RAID). Given that fpu support in kernel space over real-time threads was already deprecated at that time, we did not see any point in making the test and maintenance process even more complex to keep it as a first class citizen.
Quoted 3 lines
I do not see who does kernel development on a machine so valueable to justify skipping such an important test for everyone.
Well, I must admit that I would not run a development version of any kernel code on a system which holds critically important data either. But I don't think that we can impose such a restriction on people competing for the Darwin Awards.
Quoted 4 lines
Quoted 3 lines
I'm still pondering whether this test makes sense in 3.x, given that official support for running fpu ops over rt threads in kernel space was dropped for that version. Too much of a mess.
Quoted 6 lines
Quoted 3 lines
Ok, i am actually again looking primarily at xenomai-2 and was planning on backporting whatever we come up with.
I'm ok with pushing this to the 2.x branch, but then I'll cowardly let you deal with any follow up from the user base regarding this.
Well if we do not need that in Xeno3 because there are no in-cobalt fpu-threads anymore, than i guess we can forget about that patch.
It would only be useful for more kernel updates with Xeno2. So lets forget about that one for now. We can revisit it in the unlikely event of a Xeno2 kernel 4.4+ effort.
Henning