diff mbox series

kunit: Mark filter_glob param as rw

Message ID 20240112001240.1710962-1-lucas.demarchi@intel.com (mailing list archive)
State New
Delegated to: Brendan Higgins
Headers show
Series kunit: Mark filter_glob param as rw | expand

Commit Message

Lucas De Marchi Jan. 12, 2024, 12:12 a.m. UTC
By allowing the filter_glob parameter to be written to, it's possible to
tweak the testsuites that will be executed on new module loads. This
makes it easier to run specific tests without having to reload kunit and
provides a way to filter tests on real HW even if kunit is builtin.
Example for xe driver:

1) Run just 1 test
	# echo -n xe_bo > /sys/module/kunit/parameters/filter_glob
	# modprobe -r xe_live_test
	# modprobe xe_live_test
	# ls /sys/kernel/debug/kunit/
	xe_bo

2) Run all tests
	# echo \* > /sys/module/kunit/parameters/filter_glob
	# modprobe -r xe_live_test
	# modprobe xe_live_test
	# ls /sys/kernel/debug/kunit/
	xe_bo  xe_dma_buf  xe_migrate  xe_mocs

References: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/kunit/executor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rae Moar Jan. 18, 2024, 10:23 p.m. UTC | #1
On Thu, Jan 11, 2024 at 7:13 PM Lucas De Marchi
<lucas.demarchi@intel.com> wrote:
>
> By allowing the filter_glob parameter to be written to, it's possible to
> tweak the testsuites that will be executed on new module loads. This
> makes it easier to run specific tests without having to reload kunit and
> provides a way to filter tests on real HW even if kunit is builtin.
> Example for xe driver:
>
> 1) Run just 1 test
>         # echo -n xe_bo > /sys/module/kunit/parameters/filter_glob
>         # modprobe -r xe_live_test
>         # modprobe xe_live_test
>         # ls /sys/kernel/debug/kunit/
>         xe_bo
>
> 2) Run all tests
>         # echo \* > /sys/module/kunit/parameters/filter_glob
>         # modprobe -r xe_live_test
>         # modprobe xe_live_test
>         # ls /sys/kernel/debug/kunit/
>         xe_bo  xe_dma_buf  xe_migrate  xe_mocs
>
> References: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Hello!

I have tested this and this looks good to me. I agree this is very
helpful and I wonder if we should do the same with the other module
parameters (filter, filter_action).

It did worry me to make filter_glob writable due to the recent patch
that requires the output of filtering to be a valid virtual address
but I think there is a sufficient amount of checking of filter_glob.

Thanks!
-Rae

Reviewed-by: Rae Moar <rmoar@google.com>




> ---
>  lib/kunit/executor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
> index 1236b3cd2fbb..30ed9d321c19 100644
> --- a/lib/kunit/executor.c
> +++ b/lib/kunit/executor.c
> @@ -31,7 +31,7 @@ static char *filter_glob_param;
>  static char *filter_param;
>  static char *filter_action_param;
>
> -module_param_named(filter_glob, filter_glob_param, charp, 0400);
> +module_param_named(filter_glob, filter_glob_param, charp, 0600);
>  MODULE_PARM_DESC(filter_glob,
>                 "Filter which KUnit test suites/tests run at boot-time, e.g. list* or list*.*del_test");
>  module_param_named(filter, filter_param, charp, 0400);
> --
> 2.40.1
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20240112001240.1710962-1-lucas.demarchi%40intel.com.
Lucas De Marchi Jan. 18, 2024, 11:29 p.m. UTC | #2
On Thu, Jan 18, 2024 at 05:23:33PM -0500, Rae Moar wrote:
>On Thu, Jan 11, 2024 at 7:13 PM Lucas De Marchi
><lucas.demarchi@intel.com> wrote:
>>
>> By allowing the filter_glob parameter to be written to, it's possible to
>> tweak the testsuites that will be executed on new module loads. This
>> makes it easier to run specific tests without having to reload kunit and
>> provides a way to filter tests on real HW even if kunit is builtin.
>> Example for xe driver:
>>
>> 1) Run just 1 test
>>         # echo -n xe_bo > /sys/module/kunit/parameters/filter_glob
>>         # modprobe -r xe_live_test
>>         # modprobe xe_live_test
>>         # ls /sys/kernel/debug/kunit/
>>         xe_bo
>>
>> 2) Run all tests
>>         # echo \* > /sys/module/kunit/parameters/filter_glob
>>         # modprobe -r xe_live_test
>>         # modprobe xe_live_test
>>         # ls /sys/kernel/debug/kunit/
>>         xe_bo  xe_dma_buf  xe_migrate  xe_mocs
>>
>> References: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>
>Hello!
>
>I have tested this and this looks good to me. I agree this is very
>helpful and I wonder if we should do the same with the other module
>parameters (filter, filter_action).

yeah, after I sent this I was wondering about the other parameters. I
don't have a use for them right now, but I can try a few things and spin
a new version if people find it useful.

>
>It did worry me to make filter_glob writable due to the recent patch
>that requires the output of filtering to be a valid virtual address
>but I think there is a sufficient amount of checking of filter_glob.
>
>Thanks!
>-Rae
>
>Reviewed-by: Rae Moar <rmoar@google.com>

thanks
Lucas De Marchi
Krzysztofik, Janusz Jan. 22, 2024, 10:28 a.m. UTC | #3
On Friday, 19 January 2024 00:29:33 CET Lucas De Marchi wrote:
> On Thu, Jan 18, 2024 at 05:23:33PM -0500, Rae Moar wrote:
> >On Thu, Jan 11, 2024 at 7:13 PM Lucas De Marchi
> ><lucas.demarchi@intel.com> wrote:
> >>
> >> By allowing the filter_glob parameter to be written to, it's possible to
> >> tweak the testsuites that will be executed on new module loads. This
> >> makes it easier to run specific tests without having to reload kunit and
> >> provides a way to filter tests on real HW even if kunit is builtin.
> >> Example for xe driver:
> >>
> >> 1) Run just 1 test
> >>         # echo -n xe_bo > /sys/module/kunit/parameters/filter_glob
> >>         # modprobe -r xe_live_test
> >>         # modprobe xe_live_test
> >>         # ls /sys/kernel/debug/kunit/
> >>         xe_bo
> >>
> >> 2) Run all tests
> >>         # echo \* > /sys/module/kunit/parameters/filter_glob
> >>         # modprobe -r xe_live_test
> >>         # modprobe xe_live_test
> >>         # ls /sys/kernel/debug/kunit/
> >>         xe_bo  xe_dma_buf  xe_migrate  xe_mocs
> >>
> >> References: https://lore.kernel.org/intel-xe/
dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
> >> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> >
> >Hello!
> >
> >I have tested this and this looks good to me. I agree this is very
> >helpful and I wonder if we should do the same with the other module
> >parameters (filter, filter_action).
> 
> yeah, after I sent this I was wondering about the other parameters. I
> don't have a use for them right now, but I can try a few things and spin
> a new version if people find it useful.

Yes, please do.  I find it very useful for improving the current 
implementation of IGT kunit which now depends the ability to unload and reload 
the kunit base module with specific filter parameters in order to get a KTAP 
formatted list of test cases without executing them, then to run those test 
cases filtered one by one.

Thanks,
Janusz

> 
> >
> >It did worry me to make filter_glob writable due to the recent patch
> >that requires the output of filtering to be a valid virtual address
> >but I think there is a sufficient amount of checking of filter_glob.
> >
> >Thanks!
> >-Rae
> >
> >Reviewed-by: Rae Moar <rmoar@google.com>
> 
> thanks
> Lucas De Marchi
> 
> 

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
diff mbox series

Patch

diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
index 1236b3cd2fbb..30ed9d321c19 100644
--- a/lib/kunit/executor.c
+++ b/lib/kunit/executor.c
@@ -31,7 +31,7 @@  static char *filter_glob_param;
 static char *filter_param;
 static char *filter_action_param;
 
-module_param_named(filter_glob, filter_glob_param, charp, 0400);
+module_param_named(filter_glob, filter_glob_param, charp, 0600);
 MODULE_PARM_DESC(filter_glob,
 		"Filter which KUnit test suites/tests run at boot-time, e.g. list* or list*.*del_test");
 module_param_named(filter, filter_param, charp, 0400);