Hi Mikolaj, > This makes it impossible to use current->mm in selftests which currently > creates null pointer exception. Did you see this happening locally on your setup or is this already documented in an open issue? If latter is the case, then you could write here something like this: "Using current->mm may cause a null pointer exception in selftests as seen in issue <issue id>". > --- > > 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, but I think we should not expose the foreign memory mapping, if that "sometimes makes the test fail" (we have no way to determine the outcome of the test and subjecting the testing suites to sporadical failures that we have no idea when would happen makes the test lose its value). Skipping this test on setups with NUMA nodes would let us avoid the null pointer exceptions and give us time to figure out how to run it safely on such setups. [...] > +int igt_mmap_enable_current(void) > +{ > + if (current->flags & PF_KTHREAD) { > + if (!current->active_mm) { Insetad of trying to pull foreign memory, we could return early whenever we detect a kthread. I also wander if this is the best place to insert the code responsible for detecting these problematic conditions. Here we need to return an error, which then causes the SUBTEST to fail, but we cannot really do anything about it until we figure out a way to run these tests safely everywhere. I think `i915_subtest tests[]` could have two versions: 1) one containing all the current SUBTEST entries for when we are sure it is safe to run all of them 2) and the second that does not contain SUBTESTs that you modify in this patch, which would be chosen if we'd detect conditions that could cause these null pointer exceptions. > + pr_info("Couldn't get userspace mm in kthread\n"); > + return -ENODATA; > + } > + kthread_use_mm(current->active_mm); Best Regards, Krzysztof