public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
@ 2024-12-07  8:57 Li Wang
  2024-12-09  4:43 ` Petr Vorel
  2024-12-09 14:02 ` Cyril Hrubis
  0 siblings, 2 replies; 7+ messages in thread
From: Li Wang @ 2024-12-07  8:57 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Li Wang <liwang@redhat.com>
---

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(+)

diff --git a/include/tst_kconfig.h b/include/tst_kconfig.h
index 23f807409..18856df87 100644
--- a/include/tst_kconfig.h
+++ b/include/tst_kconfig.h
@@ -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__ */
diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
index 6d6b1da18..a99147a62 100644
--- a/lib/tst_kconfig.c
+++ b/lib/tst_kconfig.c
@@ -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;
+}
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 8db554dea..00ac8f4f3 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -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;
 }
 
-- 
2.47.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
  2024-12-07  8:57 [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options Li Wang
@ 2024-12-09  4:43 ` Petr Vorel
  2024-12-09  6:36   ` Li Wang
  2024-12-09 14:02 ` Cyril Hrubis
  1 sibling, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2024-12-09  4:43 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li, Cyril,

> 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.

> Signed-off-by: Li Wang <liwang@redhat.com>
> ---

> 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=y
CONFIG_DEBUG_PAGEALLOC=y
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y

=> if you want to add more:
CONFIG_DEBUG_RSEQ=y
CONFIG_DEBUG_GPIO=y
CONFIG_DEBUG_RODATA_TEST=y
CONFIG_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

...
> +/*
> + * 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}
...

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
  2024-12-09  4:43 ` Petr Vorel
@ 2024-12-09  6:36   ` Li Wang
  2024-12-09 12:14     ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Li Wang @ 2024-12-09  6:36 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi Petr,

On Mon, Dec 9, 2024 at 12:43 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li, Cyril,
>
> > 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.
>
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
>
> > 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=y
> CONFIG_DEBUG_PAGEALLOC=y
> CONFIG_DEBUG_RT_MUTEXES=y
> CONFIG_DEBUG_SPINLOCK=y
> CONFIG_DEBUG_MUTEXES=y
>
>
Thanks for much for providing these.


=> if you want to add more:
> CONFIG_DEBUG_RSEQ=y
> CONFIG_DEBUG_GPIO=y
> CONFIG_DEBUG_RODATA_TEST=y
> CONFIG_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.



>
> 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.
>

Maybe we shouldn't declare that the purpose is to debug kernel,
any kernel build with the slower configs should impacted.



>
> 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.



>
> Kind regards,
> Petr
>
> [1] https://packages.debian.org/sid/linux-image-amd64-dbg
>
> ...
> > +/*
> > + * 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}
> ...
>
>

-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
  2024-12-09  6:36   ` Li Wang
@ 2024-12-09 12:14     ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2024-12-09 12:14 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li,
...
> > > 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=y
> > CONFIG_DEBUG_PAGEALLOC=y
> > CONFIG_DEBUG_RT_MUTEXES=y
> > CONFIG_DEBUG_SPINLOCK=y
> > CONFIG_DEBUG_MUTEXES=y


> Thanks for much for providing these.


> > => if you want to add more:
> > CONFIG_DEBUG_RSEQ=y
> > CONFIG_DEBUG_GPIO=y
> > CONFIG_DEBUG_RODATA_TEST=y
> > CONFIG_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.

Makes sense.

> > 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.


> Maybe we shouldn't declare that the purpose is to debug kernel,
> any kernel build with the slower configs should impacted.

+1

> > 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.

I'll try to do it this week. Also, don't feel blocked by my testing (can be
merged without it).

Acked-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


> > Kind regards,
> > Petr

> > [1] https://packages.debian.org/sid/linux-image-amd64-dbg

> > ...
> > > +/*
> > > + * 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}
> > ...

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
  2024-12-07  8:57 [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options Li Wang
  2024-12-09  4:43 ` Petr Vorel
@ 2024-12-09 14:02 ` Cyril Hrubis
  2024-12-10  8:48   ` Li Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2024-12-09 14:02 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi!
> +/*
> + * 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__ */
> diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
> index 6d6b1da18..a99147a62 100644
> --- a/lib/tst_kconfig.c
> +++ b/lib/tst_kconfig.c
> @@ -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;
		}
	}

> +			tst_res(TINFO, "Detected kernel debug options. Likely running on a debug kernel");
> +			return 1;
> +		}
> +	}
> +	return 0;
> +}
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 8db554dea..00ac8f4f3 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -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;
>  }
>  
> -- 
> 2.47.0
> 

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
  2024-12-09 14:02 ` Cyril Hrubis
@ 2024-12-10  8:48   ` Li Wang
  2024-12-10  8:58     ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Li Wang @ 2024-12-10  8:48 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

On Mon, Dec 9, 2024 at 10:02 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > +/*
> > + * 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__ */
> > diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
> > index 6d6b1da18..a99147a62 100644
> > --- a/lib/tst_kconfig.c
> > +++ b/lib/tst_kconfig.c
> > @@ -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"),
>         ...
> };
>

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.


> 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;
>                 }
>         }
>
> > +                     tst_res(TINFO, "Detected kernel debug options.
> Likely running on a debug kernel");
> > +                     return 1;
> > +             }
> > +     }
> > +     return 0;
> > +}
> > diff --git a/lib/tst_test.c b/lib/tst_test.c
> > index 8db554dea..00ac8f4f3 100644
> > --- a/lib/tst_test.c
> > +++ b/lib/tst_test.c
> > @@ -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;
> >  }
> >
> > --
> > 2.47.0
> >
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
>

-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
  2024-12-10  8:48   ` Li Wang
@ 2024-12-10  8:58     ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2024-12-10  8:58 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi!
> 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.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-12-10  8:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-07  8:57 [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options Li Wang
2024-12-09  4:43 ` Petr Vorel
2024-12-09  6:36   ` Li Wang
2024-12-09 12:14     ` Petr Vorel
2024-12-09 14:02 ` Cyril Hrubis
2024-12-10  8:48   ` Li Wang
2024-12-10  8:58     ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox