lib: multiply the max_runtime if detect kernel debug options
PATCH v2 1/1 lib: multiply the max_runtime if detect kernel debug options
The method adjusts the max_runtime for test cases by multiplying it by a factor (4x) if any debug kernel options are detected. Debug kernel configurations (such as CONFIG_KASAN, CONFIG_PROVE_LOCKING, etc.) are known to degrade performance, and this adjustment ensures that tests do not fail prematurely due to timeouts.
As Cyril pointed out that a debug kernel will typically run slower by a factor of N, and while determining the exact value of N is challenging, so a reasonable upper bound is sufficient for practical purposes.
---
Notes:
Hi, @Cyril, @Petr, I have no openSUSE and Ubuntu at my hands, could you help check if the debug configures are useful to the other two platforms? Or, should we add any more options there? Thanks.
include/tst_kconfig.h | 24 ++++++++++++++++++++++++ lib/tst_kconfig.c | 14 ++++++++++++++ lib/tst_test.c | 3 +++ 3 files changed, 41 insertions(+)
include/tst_kconfig.h +24 -0
@@ -98,4 +98,28 @@ struct tst_kcmdline_var {*/ void tst_kcmdline_parse (struct tst_kcmdline_var params[],size_t params_len); +/* +* List of debug-kernel config options that may degrade performance when enabled. +*/ +static const char *const tst_kconf_debug_options[][2 ] = { + {"CONFIG_PROVE_LOCKING=y" ,NULL }, + {"CONFIG_LOCKDEP=y" ,NULL }, + {"CONFIG_DEBUG_SPINLOCK=y" ,NULL }, + {"CONFIG_DEBUG_RT_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_PAGEALLOC=y" ,NULL }, + {"CONFIG_KASAN=y" ,NULL }, + {"CONFIG_SLUB_RCU_DEBUG=y" ,NULL }, + {"CONFIG_TRACE_IRQFLAGS=y" ,NULL }, + {"CONFIG_LATENCYTOP=y" ,NULL }, + {"CONFIG_DEBUG_NET=y" ,NULL }, + {"CONFIG_EXT4_DEBUG=y" ,NULL }, + {"CONFIG_QUOTA_DEBUG=y" ,NULL }, + {"CONFIG_FAULT_INJECTION=y" ,NULL }, + {"CONFIG_DEBUG_OBJECTS=y" ,NULL }, + {NULL ,NULL } +}; + +int tst_any_kconfig_debug_enabled (void ); +#endif /* TST_KCONFIG_H__ */
lib/tst_kconfig.c +14 -0
@@ -631,3 +631,17 @@ void tst_kcmdline_parse(struct tst_kcmdline_var params[], size_t params_len)SAFE_FCLOSE (f); } + +int tst_any_kconfig_debug_enabled (void ) +{ +int i; + +for (i =0 ; tst_kconf_debug_options[i][0 ] !=NULL ; i++) { +if (!tst_kconfig_check (tst_kconf_debug_options[i])) { +tst_res (TINFO ,"Detected kernel debug options. Likely running on a debug kernel" ); +return 1 ; + } + } + +return 0 ; +}
lib/tst_test.c +3 -0
@@ -555,6 +555,9 @@ static int multiply_runtime(int max_runtime)parse_mul (&runtime_mul,"LTP_RUNTIME_MUL" ,0.0099 ,100 ); +if (tst_any_kconfig_debug_enabled ()) + max_runtime *=4 ; +return max_runtime * runtime_mul; }
Signature · 5 lines
2.47.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li, Cyril,
Quoted 11 lines
The method adjusts the
max_runtimefor test cases by multiplying it by a factor (4x) if any debug kernel options are detected. Debug kernel configurations (such asCONFIG_KASAN,CONFIG_PROVE_LOCKING, etc.) are known to degrade performance, and this adjustment ensures that tests do not fail prematurely due to timeouts.As Cyril pointed out that a debug kernel will typically run slower by a factor of N, and while determining the exact value of N is challenging, so a reasonable upper bound is sufficient for practical purposes.
Quoted 7 lines
Signed-off-by Li Wang <[email protected]>---
Notes:
Hi, @Cyril, @Petr, I have no openSUSE and Ubuntu at my hands, could you help check if the debug configures are useful to the other two platforms? Or, should we add any more options there? Thanks.
openSUSE debug kernel:
$ grep ^CONFIG_DEBUG /boot/config-6.13.0-rc1-1.g492f944-debug # openSUSE Tumbleweed CONFIG_DEBUG_RSEQ=y CONFIG_DEBUG_GPIO=y CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF5=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_NET=y CONFIG_DEBUG_PAGEALLOC=y CONFIG_DEBUG_RODATA_TEST=y CONFIG_DEBUG_MEMORY_INIT=y CONFIG_DEBUG_SHIRQ=y CONFIG_DEBUG_RT_MUTEXES=y CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_MUTEXES=y
=> openSUSE debug kernel would be detected by:CONFIG_DEBUG_NET=yCONFIG_DEBUG_PAGEALLOC=yCONFIG_DEBUG_RT_MUTEXES=yCONFIG_DEBUG_SPINLOCK=yCONFIG_DEBUG_MUTEXES=y
=> if you want to add more:CONFIG_DEBUG_RSEQ=yCONFIG_DEBUG_GPIO=yCONFIG_DEBUG_RODATA_TEST=yCONFIG_DEBUG_SHIRQ=y
Also FYI some options from default kernel (to see which cannot be used):
$ grep ^CONFIG_DEBUG /boot/config-6.13.0-rc1-1.g492f944-default # openSUSE Tumbleweed CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF5=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_PAGEALLOC=y CONFIG_DEBUG_MEMORY_INIT=y
$ grep ^CONFIG_DEBUG /boot/config-6.11.10-amd64 # Debian CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_WX=y CONFIG_DEBUG_MEMORY_INIT=y CONFIG_DEBUG_LIST=y
Do Debian/Ubuntu even have debug kernel? I know only about linux-image-amd64-dbg [1], but that package has just debugging symbols.
Which tests should I run on the kernel to see if timeout is ok?
Kind regards,
Petr
[1] https://packages.debian.org/sid/linux-image-amd64-dbg
...
Quoted 20 lines
include/tst_kconfig.h +20
-0+/* +* List of debug-kernel config options that may degrade performance when enabled. +*/ +static const char *const tst_kconf_debug_options[][2 ] = { + {"CONFIG_PROVE_LOCKING=y" ,NULL }, + {"CONFIG_LOCKDEP=y" ,NULL }, + {"CONFIG_DEBUG_SPINLOCK=y" ,NULL }, + {"CONFIG_DEBUG_RT_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_PAGEALLOC=y" ,NULL }, + {"CONFIG_KASAN=y" ,NULL }, + {"CONFIG_SLUB_RCU_DEBUG=y" ,NULL }, + {"CONFIG_TRACE_IRQFLAGS=y" ,NULL }, + {"CONFIG_LATENCYTOP=y" ,NULL }, + {"CONFIG_DEBUG_NET=y" ,NULL }, + {"CONFIG_EXT4_DEBUG=y" ,NULL }, + {"CONFIG_QUOTA_DEBUG=y" ,NULL }, + {"CONFIG_FAULT_INJECTION=y" ,NULL }, + {"CONFIG_DEBUG_OBJECTS=y" ,NULL }, + {NULL ,NULL }
...
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Petr,
Quoted 50 lines · Petr Vorel
Hi Li, Cyril,
Quoted 3 lines
The method adjusts the
max_runtimefor test cases by multiplying it by a factor (4x) if any debug kernel options are detected. Debug kernel configurations (such asCONFIG_KASAN,CONFIG_PROVE_LOCKING,etc.)
Quoted 8 lines
are known to degrade performance, and this adjustment ensures that tests do not fail prematurely due to timeouts.
As Cyril pointed out that a debug kernel will typically run slower by a factor of N, and while determining the exact value of N is challenging, so a reasonable upper bound is sufficient for practical purposes.
Quoted 5 lines
Signed-off-by Li Wang <[email protected]>---
Notes:
Hi, @Cyril, @Petr, I have no openSUSE and Ubuntu at my hands, couldyou
Quoted 1 line
help check if the debug configures are useful to the other two
platforms?
Quoted 1 line
Or, should we add any more options there? Thanks.
openSUSE debug kernel:
$ grep ^CONFIG_DEBUG /boot/config-6.13.0-rc1-1.g492f944-debug # openSUSE Tumbleweed CONFIG_DEBUG_RSEQ=y CONFIG_DEBUG_GPIO=y CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF5=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_NET=y CONFIG_DEBUG_PAGEALLOC=y CONFIG_DEBUG_RODATA_TEST=y CONFIG_DEBUG_MEMORY_INIT=y CONFIG_DEBUG_SHIRQ=y CONFIG_DEBUG_RT_MUTEXES=y CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_MUTEXES=y
Quoted 8 lines
=> openSUSE debug kernel would be detected by:
CONFIG_DEBUG_NET=yCONFIG_DEBUG_PAGEALLOC=yCONFIG_DEBUG_RT_MUTEXES=yCONFIG_DEBUG_SPINLOCK=yCONFIG_DEBUG_MUTEXES=y
Thanks for much for providing these.
=> if you want to add more:
Quoted 5 lines
CONFIG_DEBUG_RSEQ=yCONFIG_DEBUG_GPIO=yCONFIG_DEBUG_RODATA_TEST=yCONFIG_DEBUG_SHIRQ=y
Those kernel debug options on performance are generally less severe compared to options like CONFIG_KASAN or CONFIG_PROVE_LOCKING.
We would like to recognize some configs that obviously lower the system speed.
Quoted 34 lines
Also FYI some options from default kernel (to see which cannot be used):
$ grep ^CONFIG_DEBUG /boot/config-6.13.0-rc1-1.g492f944-default # openSUSE Tumbleweed CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF5=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_PAGEALLOC=y CONFIG_DEBUG_MEMORY_INIT=y$ grep ^CONFIG_DEBUG /boot/config-6.11.10-amd64 # Debian CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_WX=y CONFIG_DEBUG_MEMORY_INIT=y CONFIG_DEBUG_LIST=y
Quoted 4 lines
Do Debian/Ubuntu even have debug kernel? I know only about linux-image-amd64-dbg
[1], but that package has just debugging symbols.
Maybe we shouldn't declare that the purpose is to debug kernel, any kernel build with the slower configs should impacted.
Quoted 3 lines
Which tests should I run on the kernel to see if timeout is ok?
Any test with set .max_runtime you can try, for this patch our original work is for starvation.c but now it is generic.
Quoted 31 lines
Kind regards,
Petr[1] https://packages.debian.org/sid/linux-image-amd64-dbg
...
Quoted 2 lines
+/*
+ * List of debug-kernel config options that may degrade performancewhen enabled.
Quoted 18 lines
+ */
include/tst_kconfig.h +17
-0+static const char *const tst_kconf_debug_options[][2 ] = { + {"CONFIG_PROVE_LOCKING=y" ,NULL }, + {"CONFIG_LOCKDEP=y" ,NULL }, + {"CONFIG_DEBUG_SPINLOCK=y" ,NULL }, + {"CONFIG_DEBUG_RT_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_PAGEALLOC=y" ,NULL }, + {"CONFIG_KASAN=y" ,NULL }, + {"CONFIG_SLUB_RCU_DEBUG=y" ,NULL }, + {"CONFIG_TRACE_IRQFLAGS=y" ,NULL }, + {"CONFIG_LATENCYTOP=y" ,NULL }, + {"CONFIG_DEBUG_NET=y" ,NULL }, + {"CONFIG_EXT4_DEBUG=y" ,NULL }, + {"CONFIG_QUOTA_DEBUG=y" ,NULL }, + {"CONFIG_FAULT_INJECTION=y" ,NULL }, + {"CONFIG_DEBUG_OBJECTS=y" ,NULL }, + {NULL ,NULL }...
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel
Acked-byHi Li,
...
Quoted 51 lines
Quoted 33 lines
Quoted 2 lines
Notes:
Hi, @Cyril, @Petr, I have no openSUSE and Ubuntu at my hands, couldyou
Quoted 1 line
help check if the debug configures are useful to the other two
platforms?
Quoted 1 line
Or, should we add any more options there? Thanks.
openSUSE debug kernel:
$ grep ^CONFIG_DEBUG /boot/config-6.13.0-rc1-1.g492f944-debug # openSUSE Tumbleweed CONFIG_DEBUG_RSEQ=y CONFIG_DEBUG_GPIO=y CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF5=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_NET=y CONFIG_DEBUG_PAGEALLOC=y CONFIG_DEBUG_RODATA_TEST=y CONFIG_DEBUG_MEMORY_INIT=y CONFIG_DEBUG_SHIRQ=y CONFIG_DEBUG_RT_MUTEXES=y CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_MUTEXES=yQuoted 6 lines
=> openSUSE debug kernel would be detected by:
CONFIG_DEBUG_NET=yCONFIG_DEBUG_PAGEALLOC=yCONFIG_DEBUG_RT_MUTEXES=yCONFIG_DEBUG_SPINLOCK=yCONFIG_DEBUG_MUTEXES=yThanks for much for providing these.
Quoted 5 lines
=> if you want to add more:
CONFIG_DEBUG_RSEQ=yCONFIG_DEBUG_GPIO=yCONFIG_DEBUG_RODATA_TEST=yCONFIG_DEBUG_SHIRQ=y
Quoted 5 lines
Those kernel debug options on performance are generally less severe compared to options like
CONFIG_KASANorCONFIG_PROVE_LOCKING.We would like to recognize some configs that obviously lower the system speed.
Makes sense.
Quoted 33 lines
Quoted 32 lines
Also FYI some options from default kernel (to see which cannot be used):
$ grep ^CONFIG_DEBUG /boot/config-6.13.0-rc1-1.g492f944-default # openSUSE Tumbleweed CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF5=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_PAGEALLOC=y CONFIG_DEBUG_MEMORY_INIT=y$ grep ^CONFIG_DEBUG /boot/config-6.11.10-amd64 # Debian CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_KERNEL=y CONFIG_DEBUG_MISC=y CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y CONFIG_DEBUG_INFO_COMPRESSED_NONE=y CONFIG_DEBUG_INFO_BTF=y CONFIG_DEBUG_INFO_BTF_MODULES=y CONFIG_DEBUG_FS=y CONFIG_DEBUG_FS_ALLOW_ALL=y CONFIG_DEBUG_WX=y CONFIG_DEBUG_MEMORY_INIT=y CONFIG_DEBUG_LIST=y
Quoted 7 lines
Quoted 3 lines
Do Debian/Ubuntu even have debug kernel? I know only about linux-image-amd64-dbg
[1], but that package has just debugging symbols.Maybe we shouldn't declare that the purpose is to debug kernel, any kernel build with the slower configs should impacted.
+1
Quoted 5 lines
Quoted 1 line
Which tests should I run on the kernel to see if timeout is ok?
Any test with set .max_runtime you can try, for this patch our original work is for
starvation.cbut now it is generic.
I'll try to do it this week. Also, don't feel blocked by my testing (can be merged without it).
Kind regards,
Petr
Quoted 28 lines
Quoted 28 lines
Kind regards,
Petr[1] https://packages.debian.org/sid/linux-image-amd64-dbg
...
Quoted 2 lines
+/*
+ * List of debug-kernel config options that may degrade performancewhen enabled.
Quoted 18 lines
+ */
include/tst_kconfig.h +17
-0+static const char *const tst_kconf_debug_options[][2 ] = { + {"CONFIG_PROVE_LOCKING=y" ,NULL }, + {"CONFIG_LOCKDEP=y" ,NULL }, + {"CONFIG_DEBUG_SPINLOCK=y" ,NULL }, + {"CONFIG_DEBUG_RT_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_PAGEALLOC=y" ,NULL }, + {"CONFIG_KASAN=y" ,NULL }, + {"CONFIG_SLUB_RCU_DEBUG=y" ,NULL }, + {"CONFIG_TRACE_IRQFLAGS=y" ,NULL }, + {"CONFIG_LATENCYTOP=y" ,NULL }, + {"CONFIG_DEBUG_NET=y" ,NULL }, + {"CONFIG_EXT4_DEBUG=y" ,NULL }, + {"CONFIG_QUOTA_DEBUG=y" ,NULL }, + {"CONFIG_FAULT_INJECTION=y" ,NULL }, + {"CONFIG_DEBUG_OBJECTS=y" ,NULL }, + {NULL ,NULL }...
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 30 lines
include/tst_kconfig.h +24
-0+/* +* List of debug-kernel config options that may degrade performance when enabled. +*/ +static const char *const tst_kconf_debug_options[][2 ] = { + {"CONFIG_PROVE_LOCKING=y" ,NULL }, + {"CONFIG_LOCKDEP=y" ,NULL }, + {"CONFIG_DEBUG_SPINLOCK=y" ,NULL }, + {"CONFIG_DEBUG_RT_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_PAGEALLOC=y" ,NULL }, + {"CONFIG_KASAN=y" ,NULL }, + {"CONFIG_SLUB_RCU_DEBUG=y" ,NULL }, + {"CONFIG_TRACE_IRQFLAGS=y" ,NULL }, + {"CONFIG_LATENCYTOP=y" ,NULL }, + {"CONFIG_DEBUG_NET=y" ,NULL }, + {"CONFIG_EXT4_DEBUG=y" ,NULL }, + {"CONFIG_QUOTA_DEBUG=y" ,NULL }, + {"CONFIG_FAULT_INJECTION=y" ,NULL }, + {"CONFIG_DEBUG_OBJECTS=y" ,NULL }, + {NULL ,NULL } +}; + +int tst_any_kconfig_debug_enabled (void ); +#endif /* TST_KCONFIG_H__ */ lib/tst_kconfig.c +0
-0
lib/tst_kconfig.c void tst_kcmdline_parse(struct tst_kcmdline_var params[], size_t params_len) · line 640
Quoted 10 lines
lib/tst_kconfig.c +7
-0@@ -631,3 +631,17 @@ void tst_kcmdline_parse(struct tst_kcmdline_var params[], size_t params_len)SAFE_FCLOSE (f); } + +int tst_any_kconfig_debug_enabled (void ) +{ +int i; + +for (i =0 ; tst_kconf_debug_options[i][0 ] !=NULL ; i++) { +if (!tst_kconfig_check (tst_kconf_debug_options[i])) {
I suppose that using tst_kconfig_check() here has a few flaws.
First of all we are passing it one by one, which means that we are parsing the .config over and over. Also the tst_kconfig_check() is tailored to a special usecase where each of the strings is treated as an expression, which is slower. And lastly but not least will also print the "Constraint '%s' not satisfied" line for each option that is not set.
We already have the tst_kconfig_var structure and tst_kconfig_read() so it would make more sense to use the simple interface as:
static struct tst_kconfig_var debug_kconfigs[] = {
TST_KCONFIG_INIT("CONFIG_PROVE_LOCKING"),
...
};And then loop over the results as:
int is_debug_kernel = 0;
tst_kconfig_read(debug_kconfigs, ARRAY_SIZE(debug_kconfigs));
for (i = 0; i < ARRAY_SIZE(debug_kconfigs); i++) {
if (debug_kconfigs[i].choice == 'y') {
tst_res(TINFO,
"%s kernel debug option detected",
debug_kconfigs[i].id);
is_debug_kernel = 1;
}
}Quoted 23 lines
lib/tst_kconfig.c +6
-0+tst_res (TINFO ,"Detected kernel debug options. Likely running on a debug kernel" ); +return 1 ; + } + } +return 0 ; +}lib/tst_test.c +3
-0@@ -555,6 +555,9 @@ static int multiply_runtime(int max_runtime)parse_mul (&runtime_mul,"LTP_RUNTIME_MUL" ,0.0099 ,100 ); +if (tst_any_kconfig_debug_enabled ()) + max_runtime *=4 ; +return max_runtime * runtime_mul; }Signature · 1 line
2.47.0
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 52 lines · Cyril Hrubis
Hi!
Quoted 2 lines
+/*
+ * List of debug-kernel config options that may degrade performancewhen enabled.
lib/tst_kconfig.c void tst_kcmdline_parse(struct tst_kcmdline_var
Quoted 28 lines
+ */
include/tst_kconfig.h +21
-0+static const char *const tst_kconf_debug_options[][2 ] = { + {"CONFIG_PROVE_LOCKING=y" ,NULL }, + {"CONFIG_LOCKDEP=y" ,NULL }, + {"CONFIG_DEBUG_SPINLOCK=y" ,NULL }, + {"CONFIG_DEBUG_RT_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_MUTEXES=y" ,NULL }, + {"CONFIG_DEBUG_PAGEALLOC=y" ,NULL }, + {"CONFIG_KASAN=y" ,NULL }, + {"CONFIG_SLUB_RCU_DEBUG=y" ,NULL }, + {"CONFIG_TRACE_IRQFLAGS=y" ,NULL }, + {"CONFIG_LATENCYTOP=y" ,NULL }, + {"CONFIG_DEBUG_NET=y" ,NULL }, + {"CONFIG_EXT4_DEBUG=y" ,NULL }, + {"CONFIG_QUOTA_DEBUG=y" ,NULL }, + {"CONFIG_FAULT_INJECTION=y" ,NULL }, + {"CONFIG_DEBUG_OBJECTS=y" ,NULL }, + {NULL ,NULL } +}; + +int tst_any_kconfig_debug_enabled (void ); +#endif /* TST_KCONFIG_H__ */ lib/tst_kconfig.c +0
-0@@ -631,3 +631,17 @@ void tst_kcmdline_parse(struct tst_kcmdline_varparams[],
size_tparams_len)lib/tst_kconfig.c void tst_kcmdline_parse(struct tst_kcmdline_var params[], size_t params_len) · line 640
Quoted 10 lines
lib/tst_kconfig.c +7
-0SAFE_FCLOSE (f); } + +int tst_any_kconfig_debug_enabled (void ) +{ +int i; + +for (i =0 ; tst_kconf_debug_options[i][0 ] !=NULL ; i++) { +if (!tst_kconfig_check (tst_kconf_debug_options[i])) {I suppose that using
tst_kconfig_check()here has a few flaws.First of all we are passing it one by one, which means that we are parsing the .config over and over. Also the
tst_kconfig_check()is tailored to a special usecase where each of the strings is treated as an expression, which is slower. And lastly but not least will also print the "Constraint '%s' not satisfied" line for each option that is not set.
Quoted 8 lines
We already have the
tst_kconfig_varstructure andtst_kconfig_read()so it would make more sense to use the simple interface as:static struct tst_kconfig_var debug_kconfigs[] = { TST_KCONFIG_INIT("CONFIG_PROVE_LOCKING"), ... };
This is a good suggestion, and besides, as I talked with Petr that I would more like to name it "slow_kconfigs" but not "debug" prefix, because the kernel configures is customized and maybe just enabled partly on self-build kernel.
if (tst_has_slow_kconfig())
max_runtime *= 4;And I agree all the rest comments.
Quoted 45 lines
And then loop over the results as:
int is_debug_kernel = 0; tst_kconfig_read(debug_kconfigs, ARRAY_SIZE(debug_kconfigs)); for (i = 0; i < ARRAY_SIZE(debug_kconfigs); i++) { if (debug_kconfigs[i].choice == 'y') { tst_res(TINFO, "%s kernel debug option detected", debug_kconfigs[i].id); is_debug_kernel = 1; } }lib/tst_kconfig.c void tst_kcmdline_parse(struct tst_kcmdline_var · line 640
Quoted 1 line
lib/tst_kconfig.c +1
-0+ tst_res(TINFO, "Detected kernel debug options.Likely running on a debug kernel");
Quoted 20 lines
lib/tst_kconfig.c +5
-0+return 1 ; + } + } +return 0 ; +}lib/tst_test.c +3
-1@@ -555,6 +555,9 @@ static int multiply_runtime(int max_runtime)parse_mul (&runtime_mul,"LTP_RUNTIME_MUL" ,0.0099 ,100 ); +if (tst_any_kconfig_debug_enabled ()) + max_runtime *=4 ; +return max_runtime * runtime_mul; } --Quoted 2 lines
2.47.0
--
Cyril Hrubis
[email protected]
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 4 lines
This is a good suggestion, and besides, as I talked with Petr that I would more like to name it "
slow_kconfigs" but not "debug" prefix, because the kernel configures is customized and maybe just enabled partly on self-build kernel.
Sounds reasonably too, there are some security related config options that slow down process execution as well.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp