From: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
To: "Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
K Prateek Nayak <kprateek.nayak@amd.com>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v3 08/12] amd-pstate-ut: Add ability to run a single testcase
Date: Tue, 24 Mar 2026 09:59:08 +0530 [thread overview]
Message-ID: <acITFNYfjSMc/K1I@BLRRASHENOY1.amd.com> (raw)
In-Reply-To: <0b1f1901-8ea0-4b68-8887-29e88e86ab60@kernel.org>
Hello Mario,
On Mon, Mar 23, 2026 at 03:21:17PM -0500, Mario Limonciello (AMD) (kernel.org) wrote:
>
>
> On 3/20/2026 9:43 AM, Gautham R. Shenoy wrote:
> > Currently when amd-pstate-ut test module is loaded, it runs all the
> > tests from amd_pstate_ut_cases[] array.
> >
> > Add a module parameter named "run_only" that allows users to run a
> > single test from the array by specifying the test name string.
> >
> > Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
> > ---
> > drivers/cpufreq/amd-pstate-ut.c | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
> > index 447b9aa5ce40..35e453a49c0f 100644
> > --- a/drivers/cpufreq/amd-pstate-ut.c
> > +++ b/drivers/cpufreq/amd-pstate-ut.c
> > @@ -35,6 +35,10 @@
> > #include "amd-pstate.h"
> > +static char *run_only;
> > +module_param(run_only, charp, 0444);
> > +MODULE_PARM_DESC(run_only,
> > + "Run only the named test case (default: run all)");
>
> This default shows the end effect; but it doesn't make sense for this
> parameter IMO.
>
> How about instead if you had a semicolon delimitted list and then defaulted
> an empty list to mean all tests? Something like this:
>
> static char *test_list;
> module_param(test_list, charp, 0444)
> MODULE_PARM_DESC(test_list,
> "Semicolon delimitted list of tests to run (empty means run all tests)");
This makes sense.
>
> > struct amd_pstate_ut_struct {
> > const char *name;
> > @@ -275,7 +279,12 @@ static int __init amd_pstate_ut_init(void)
> > u32 i = 0, arr_size = ARRAY_SIZE(amd_pstate_ut_cases);
> > for (i = 0; i < arr_size; i++) {
> > - int ret = amd_pstate_ut_cases[i].func(i);
> > + int ret;
> > +
> > + if (run_only && strcmp(run_only, amd_pstate_ut_cases[i].name))
> > + continue;
> > +
> > + ret = amd_pstate_ut_cases[i].func(i);
>
> If you take my suggestion then you would split this on semicolon or end of
> string and then allow matching multiple.
How about something like the following (diff on top of this
patch. Will fold it in and post a v4 if this looks ok)
x8----------------------------------------x8---------------------------------------------x8
diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
index 5d87fb8a26df..5ef22a77a9c5 100644
--- a/drivers/cpufreq/amd-pstate-ut.c
+++ b/drivers/cpufreq/amd-pstate-ut.c
@@ -37,10 +37,10 @@
#include "amd-pstate.h"
-static char *run_only;
-module_param(run_only, charp, 0444);
-MODULE_PARM_DESC(run_only,
- "Run only the named test case (default: run all)");
+static char *test_list;
+module_param(test_list, charp, 0444);
+MODULE_PARM_DESC(test_list,
+ "Semicolon-delimited list of tests to run (empty means run all tests)");
struct amd_pstate_ut_struct {
const char *name;
@@ -403,6 +403,26 @@ static int amd_pstate_ut_check_freq_attrs(u32 index)
return ret;
}
+static bool test_in_list(const char *list, const char *name)
+{
+ size_t name_len = strlen(name);
+ const char *p = list;
+
+ while (*p) {
+ const char *sep = strchr(p, ';');
+ size_t token_len = sep ? sep - p : strlen(p);
+
+ if (token_len == name_len && !strncmp(p, name, token_len))
+ return true;
+
+ if (!sep)
+ break;
+ p = sep + 1;
+ }
+
+ return false;
+}
+
static int __init amd_pstate_ut_init(void)
{
u32 i = 0, arr_size = ARRAY_SIZE(amd_pstate_ut_cases);
@@ -410,7 +430,8 @@ static int __init amd_pstate_ut_init(void)
for (i = 0; i < arr_size; i++) {
int ret;
- if (run_only && strcmp(run_only, amd_pstate_ut_cases[i].name))
+ if (test_list && *test_list &&
+ !test_in_list(test_list, amd_pstate_ut_cases[i].name))
continue;
ret = amd_pstate_ut_cases[i].func(i);
x8----------------------------------------x8---------------------------------------------x8
--
Thanks and Regards
gautham.
next prev parent reply other threads:[~2026-03-24 4:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 14:43 [PATCH v3 00/12] amd-pstate: Introduce AMD CPPC Performance Priority Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 01/12] amd-pstate: Fix memory leak in amd_pstate_epp_cpu_init() Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 02/12] amd-pstate: Update cppc_req_cached in fast_switch case Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 03/12] amd-pstate: Make certain freq_attrs conditionally visible Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 04/12] x86/cpufeatures: Add AMD CPPC Performance Priority feature Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 05/12] amd-pstate: Add support for CPPC_REQ2 and FLOOR_PERF Gautham R. Shenoy
2026-03-24 21:38 ` Mario Limonciello
2026-03-25 4:09 ` K Prateek Nayak
2026-03-25 4:18 ` K Prateek Nayak
2026-03-26 11:30 ` Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 06/12] amd-pstate: Add sysfs support for floor_freq and floor_count Gautham R. Shenoy
2026-03-24 21:39 ` Mario Limonciello
2026-03-20 14:43 ` [PATCH v3 07/12] amd-pstate: Introduce a tracepoint trace_amd_pstate_cppc_req2() Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 08/12] amd-pstate-ut: Add ability to run a single testcase Gautham R. Shenoy
2026-03-23 20:21 ` Mario Limonciello (AMD) (kernel.org)
2026-03-24 4:29 ` Gautham R. Shenoy [this message]
2026-03-24 4:34 ` Mario Limonciello
2026-03-25 4:28 ` K Prateek Nayak
2026-03-25 13:45 ` Mario Limonciello
2026-03-26 11:29 ` Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 09/12] amd-pstate-ut: Add a testcase to validate the visibility of driver attributes Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 10/12] Documentation/amd-pstate: List amd_pstate_hw_prefcore sysfs file Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 11/12] Documentation/amd-pstate: List amd_pstate_prefcore_ranking " Gautham R. Shenoy
2026-03-20 14:43 ` [PATCH v3 12/12] Documentation/amd-pstate: Add documentation for amd_pstate_floor_{freq,count} Gautham R. Shenoy
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=acITFNYfjSMc/K1I@BLRRASHENOY1.amd.com \
--to=gautham.shenoy@amd.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=superm1@kernel.org \
--cc=viresh.kumar@linaro.org \
/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