From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [Patch V2] lib: multiply the max_runtime if detect kernel debug options
Date: Mon, 9 Dec 2024 15:02:09 +0100 [thread overview]
Message-ID: <Z1b4YRIly1R1DtBS@yuki.lan> (raw)
In-Reply-To: <20241207085754.159597-1-liwang@redhat.com>
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
next prev parent reply other threads:[~2024-12-09 14:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-12-10 8:48 ` Li Wang
2024-12-10 8:58 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1b4YRIly1R1DtBS@yuki.lan \
--to=chrubis@suse.cz \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox