On 2025-02-26 at 13:41:34 GMT, Krzysztof Niemiec wrote: > On 2025-02-25 at 11:41:56 GMT, Mikolaj Wasiak wrote: > > When driver is loaded on system with numa nodes it might be run in kthread. > > This makes it impossible to use current->mm in selftests which currently > > creates null pointer exception. > > This patch allows selftest to use current->mm by using active_mm. > > > > Signed-off-by: Mikolaj Wasiak <mikolaj.wasiak@xxxxxxxxx> > > --- > > > > This patch is mostly damage control. By using active_mm we expose our > > test to foreign memory mapping, which sometimes makes the test fail. > > That is still better than just having null pointer exception in driver > > code. > > > > We talked about this offline a bit, I'll recount what we determined here > just for the record. > > On NUMA systems, the driver might be probed via a kthread consuming a > workqueue. This shouldn't be a problem as long as we don't rely on > current->mm (i915 usually doesn't, unless it's ioctls where it's fair > game) - but this test wasn't written with that in mind, hence the > derefs. > > We can't just use current->active_mm in place of current->mm inside of > the test code, because one of the functions that the test uses > (vma_lookup to be exact) I meant vm_mmap() (called by igt_mmap_offset() in the test). Slip of tongue :')