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

Lucas De Marchi lucas.demarchi at intel.com
Fri Jan 26 14:46:54 UTC 2024


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.

Lucas De Marchi


More information about the Intel-xe mailing list