2024-01-22 17:48:43

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH v2] kunit: Mark filter* params as rw

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

For completeness and to cover other use cases, also change filter and
filter_action to rw.

Link: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
Reviewed-by: Rae Moar <[email protected]>
Signed-off-by: Lucas De Marchi <[email protected]>
---

Rae, I kept your r-b from v1 since the additions are just what we talked
about.

v2: also change filter_action and filter to rw, testing with the xe
module to see if filter=module=none filter_action=skip produces
the result expected by igt

lib/kunit/executor.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
index 1236b3cd2fbb..371ddcee7fb5 100644
--- a/lib/kunit/executor.c
+++ b/lib/kunit/executor.c
@@ -31,13 +31,13 @@ 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);
+module_param_named(filter, filter_param, charp, 0600);
MODULE_PARM_DESC(filter,
"Filter which KUnit test suites/tests run at boot-time using attributes, e.g. speed>slow");
-module_param_named(filter_action, filter_action_param, charp, 0400);
+module_param_named(filter_action, filter_action_param, charp, 0600);
MODULE_PARM_DESC(filter_action,
"Changes behavior of filtered tests using attributes, valid values are:\n"
"<none>: do not run filtered tests as normal\n"
--
2.40.1



2024-01-23 08:02:20

by David Gow

[permalink] [raw]
Subject: Re: [PATCH v2] kunit: Mark filter* params as rw

On Tue, 23 Jan 2024 at 01:14, Lucas De Marchi <[email protected]> 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
>
> For completeness and to cover other use cases, also change filter and
> filter_action to rw.
>
> Link: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
> Reviewed-by: Rae Moar <[email protected]>
> Signed-off-by: Lucas De Marchi <[email protected]>
> ---

This looks good to me, and works here.

Reviewed-by: David Gow <[email protected]>

Thanks,
-- David

>
> Rae, I kept your r-b from v1 since the additions are just what we talked
> about.
>
> v2: also change filter_action and filter to rw, testing with the xe
> module to see if filter=module=none filter_action=skip produces
> the result expected by igt
>
> lib/kunit/executor.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
> index 1236b3cd2fbb..371ddcee7fb5 100644
> --- a/lib/kunit/executor.c
> +++ b/lib/kunit/executor.c
> @@ -31,13 +31,13 @@ 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);
> +module_param_named(filter, filter_param, charp, 0600);
> MODULE_PARM_DESC(filter,
> "Filter which KUnit test suites/tests run at boot-time using attributes, e.g. speed>slow");
> -module_param_named(filter_action, filter_action_param, charp, 0400);
> +module_param_named(filter_action, filter_action_param, charp, 0600);
> MODULE_PARM_DESC(filter_action,
> "Changes behavior of filtered tests using attributes, valid values are:\n"
> "<none>: do not run filtered tests as normal\n"
> --
> 2.40.1
>


Attachments:
smime.p7s (3.92 kB)
S/MIME Cryptographic Signature

2024-01-23 16:51:59

by Lucas De Marchi

[permalink] [raw]
Subject: Re: Re: [PATCH v2] kunit: Mark filter* params as rw

On Tue, Jan 23, 2024 at 04:01:49PM +0800, David Gow wrote:
>On Tue, 23 Jan 2024 at 01:14, Lucas De Marchi <[email protected]> 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
>>
>> For completeness and to cover other use cases, also change filter and
>> filter_action to rw.
>>
>> Link: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
>> Reviewed-by: Rae Moar <[email protected]>
>> Signed-off-by: Lucas De Marchi <[email protected]>
>> ---
>
>This looks good to me, and works here.
>
>Reviewed-by: David Gow <[email protected]>

are you going to merge this through kunit tree or should I carry it in
drm ?

thanks
Lucas De Marchi

>
>Thanks,
>-- David
>
>>
>> Rae, I kept your r-b from v1 since the additions are just what we talked
>> about.
>>
>> v2: also change filter_action and filter to rw, testing with the xe
>> module to see if filter=module=none filter_action=skip produces
>> the result expected by igt
>>
>> lib/kunit/executor.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c
>> index 1236b3cd2fbb..371ddcee7fb5 100644
>> --- a/lib/kunit/executor.c
>> +++ b/lib/kunit/executor.c
>> @@ -31,13 +31,13 @@ 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);
>> +module_param_named(filter, filter_param, charp, 0600);
>> MODULE_PARM_DESC(filter,
>> "Filter which KUnit test suites/tests run at boot-time using attributes, e.g. speed>slow");
>> -module_param_named(filter_action, filter_action_param, charp, 0400);
>> +module_param_named(filter_action, filter_action_param, charp, 0600);
>> MODULE_PARM_DESC(filter_action,
>> "Changes behavior of filtered tests using attributes, valid values are:\n"
>> "<none>: do not run filtered tests as normal\n"
>> --
>> 2.40.1
>>



2024-01-24 03:50:09

by David Gow

[permalink] [raw]
Subject: Re: Re: [PATCH v2] kunit: Mark filter* params as rw

On Wed, 24 Jan 2024 at 00:31, Lucas De Marchi <[email protected]> wrote:
>
> On Tue, Jan 23, 2024 at 04:01:49PM +0800, David Gow wrote:
> >On Tue, 23 Jan 2024 at 01:14, Lucas De Marchi <[email protected]> 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
> >>
> >> For completeness and to cover other use cases, also change filter and
> >> filter_action to rw.
> >>
> >> Link: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
> >> Reviewed-by: Rae Moar <[email protected]>
> >> Signed-off-by: Lucas De Marchi <[email protected]>
> >> ---
> >
> >This looks good to me, and works here.
> >
> >Reviewed-by: David Gow <[email protected]>
>
> are you going to merge this through kunit tree or should I carry it in
> drm ?
>

I think we'll merge it via KUnit for 6.9, but if you need it sooner, I
doubt it'd cause problems if it went in via DRM instead.

-- David


Attachments:
smime.p7s (3.92 kB)
S/MIME Cryptographic Signature

2024-01-24 18:28:15

by Lucas De Marchi

[permalink] [raw]
Subject: Re: Re: Re: [PATCH v2] kunit: Mark filter* params as rw

On Wed, Jan 24, 2024 at 11:49:43AM +0800, David Gow wrote:
>On Wed, 24 Jan 2024 at 00:31, Lucas De Marchi <[email protected]> wrote:
>>
>> On Tue, Jan 23, 2024 at 04:01:49PM +0800, David Gow wrote:
>> >On Tue, 23 Jan 2024 at 01:14, Lucas De Marchi <[email protected]> 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
>> >>
>> >> For completeness and to cover other use cases, also change filter and
>> >> filter_action to rw.
>> >>
>> >> Link: https://lore.kernel.org/intel-xe/dzacvbdditbneiu3e3fmstjmttcbne44yspumpkd6sjn56jqpk@vxu7sksbqrp6/
>> >> Reviewed-by: Rae Moar <[email protected]>
>> >> Signed-off-by: Lucas De Marchi <[email protected]>
>> >> ---
>> >
>> >This looks good to me, and works here.
>> >
>> >Reviewed-by: David Gow <[email protected]>
>>
>> are you going to merge this through kunit tree or should I carry it in
>> drm ?
>>
>
>I think we'll merge it via KUnit for 6.9, but if you need it sooner, I
>doubt it'd cause problems if it went in via DRM instead.

I think it's fine to have it on your tree. For our CI, we can just
apply it on the side to have it working before the 6.9 merge window.

thanks
Lucas De Marchi