[PATCH i-g-t 0/3] lib/kunit: Support writable filter* parameters of kunit module

Lucas De Marchi lucas.demarchi at intel.com
Mon Jan 29 16:04:49 UTC 2024


On Fri, Jan 26, 2024 at 10:05:25PM +0100, Janusz Krzysztofik wrote:
>On Friday, 26 January 2024 17:31:53 CET Janusz Krzysztofik wrote:
>> On Friday, 26 January 2024 15:46:54 CET Lucas De Marchi wrote:
>> > On Thu, Jan 25, 2024 at 11:25:55AM -0600, Lucas De Marchi wrote:
>> > >On Thu, Jan 25, 2024 at 05:52:09PM +0100, Janusz Krzysztofik wrote:
>> > >>Instead of wasting resources on reloading the base Kunit module each time
>> > >>a different set of filter parameters is needed, try to write the required
>> > >>values to sysfs representation of those parameters.  If that fails (e.g.
>> > >>on older LTS kernels with read-only filter parameters), fall back to
>> > >
>> > >we can't really execute anything on LTS kernel. I don't think think it's
>> > >worth keeping the multiple fallbacks we have now.
>> > >q
>> > >I think trying to maintain compat is good, but I'm not sure it makes
>> > >sense for these tightly coupled tests with the kernel.
>> >
>> > I gave it a try and it doesn't really work for me. It seems that after
>> > you list the tests, the filter_action remains on skip, so the tests just
>> > skips.
>> >
>> > $ sudo ./build/tests/xe_live_ktest --r dmabuf
>> > ...
>> > Subtest dmabuf: SKIP (0.078s)
>> > $ sudo grep . /sys/module/kunit/parameters/*
>> > /sys/module/kunit/parameters/action:(null)
>> > /sys/module/kunit/parameters/filter:module=none
>> > /sys/module/kunit/parameters/filter_action:skip
>> > /sys/module/kunit/parameters/filter_glob:*
>> > /sys/module/kunit/parameters/stats_enabled:1
>> >
>> > This works for me (with my additional patch to rename the module):
>> >
>> > # # list tests
>> > # modprobe xe_live_test
>> > # echo -n 'skip' > /sys/module/kunit/parameters/filter_action
>> > # echo -n '*' > /sys/module/kunit/parameters/filter_glob
>> > # modprobe xe_live_test
>> >
>> > # # run just xe_dma_buf
>> > # modprobe -r xe_live_test
>> > # echo -ne '0x00' > /sys/module/kunit/parameters/filter_action
>> > # echo -n 'xe_dma_buf' > /sys/module/kunit/parameters/filter_glob
>> > # modprobe xe_live_test
>> >
>> > I  think the main issue is that kunit have some different code paths for
>> > not param == NULL and also that writting an empty string is not really
>> > working as it doesn't issue a write() syscall. If you force a \0 and use
>> > len + 1, then I think it might work, but I didn't test it completely.
>> > I may have to enhance the patch on the kernel side to handle that more
>> > effectively.
>>
>> OK, if you are going to enhance the kernel side then I'll hold on for now and
>> get back to it when we can call the ABI stable.
>
>Or I can propose a workaround that sets some non-default values of filter
>parameters that effectively work the same way as if default NULLs were
>restored, which now seems impossible to be done via sysfs.  Example:
>
>List mode:
>- filter: "module=none" (no module matches the filter),
>- filter_action: "skip" (always, since all modules are filtered out),
>- filter_glob: "*" (equivalent of default NULL).
>
>Execute mode:
>- filter: "module!=none" (any module matches, equivalent of default NULL),
>- filter_action: not used (no modules are filtered out),
>- filter_glob: application decides.

yeah, that should be ok. I was worried that setting the values too late
was not taking effect, but upon double checking it seems the main
problem is when trying to write "" in igt:  it will just open/close the
file to truncate it and that doesn't work for setting sysfs files.
In bash, `echo -ne '\0' > filter` works for me where needed.

You will probably need something like that for filter_action to be able
to remove the previous value set and stop  skipping the tests.

Lucas De Marchi


>
>Thanks,
>Janusz
>
>
>>
>> Thanks,
>> Janusz
>>
>> >
>> > Lucas De Marchi
>> >
>>
>>
>>
>>
>>
>
>
>
>


More information about the igt-dev mailing list