[PATCH] i915/selftest/igt_mmap: let mmap tests run in kthread

Mikolaj Wasiak mikolaj.wasiak at intel.com
Fri Feb 28 13:38:49 UTC 2025


Hi,

On 2025-02-26 at 13:41:34 GMT, Krzysztof Niemiec wrote:
> I have two suggestions for a different fix:
>
> 1. Disable the test on systems with NUMA and/or if it's running in a
> kthread, on the premise that it doesn't make sense to run this
> specific test in a kthread. This is the easier option.
> 
> 2. Find a way to pass an argument to the selftest, so we can pass a
> known mm to the test thread. Then set it as current->mm for the
> duration of the test like you're doing in your patch. We could pass
> the IGT process's mm to "emulate" having it being the initializer of
> the test task; this way we're being a good citizen and we don't mess
> with some other process memory. I figure this is the harder option.
> 
> I'd try 2 and if it doesn't work then just resort to 1 if there's no
> better idea floating around.

>From I can see, Krzysztof's idea won't work because we can't access
current->mm address from igt in userspace and the kernel switches to
ktherad before we can do anything in the driver. Or am I missing
something?

On 2025-02-28 at 11:06:50 +0100, Janusz Krzysztofik wrote:
> > > While looking for similar cases, I've found commit 51104c19d857 ("kunit: test: 
> > > Add vm_mmap() allocation resource manager") that seems to have resolved a 
> > > similar issue for then newly added kunit tests accessing current->mm.  Maybe 
> > > the approach used there is worth of reusing it for i915 selftests.
> > > 
> > > Thanks,
> > > Janusz
> > 
> > I've seen commit you found. It sadly uses symbols that aren't exported
> > outside of mm module and kunit tests 
> > and so I can't replicate it in our
> > selftest.
> > 
> > Mikołaj
> 
> Well, strictly speaking, those core symbols were also not available to kunit, 
> and that patch exported them to kunit namespace.  While i915 selftests are not 
> kunit, they are still in-kernel tests, then maybe it would be acceptable to 
> import the kunit namespace as needed to our selftests and use those symbols 
> for the same purpose as intended.  CI already runs kunit tests, then builds 
> the kernels with CONFIG_KUNIT=y.  The code of i915 selftest that will depend 
> on those symbols may then just check for CONFIG_KUNIT defined and be skipped 
> if not.

Andi, what do you think about setting selftest as kunit to have access
to exported symbols?

Mikołaj




More information about the Intel-gfx mailing list