drm/i915/selftests: Run vma tests only if current->mm is present

This set of tests require userspace memory to map objects, so
run them only if this that memory is available.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20260508080214.1979686-3-krzysztof.karas@intel.com
This commit is contained in:
Krzysztof Karas 2026-05-08 08:02:14 +00:00 committed by Andi Shyti
parent e8c3344765
commit 82eb94b1fa

View File

@ -1847,11 +1847,12 @@ static int igt_mmap_revoke(void *arg)
int i915_gem_mman_live_selftests(struct drm_i915_private *i915)
{
int ret;
bool unuse_mm = false;
static const struct i915_subtest tests[] = {
SUBTEST(igt_partial_tiling),
SUBTEST(igt_smoke_tiling),
SUBTEST(igt_mmap_offset_exhaustion),
};
static const struct i915_subtest vma_tests[] = {
SUBTEST(igt_mmap),
SUBTEST(igt_mmap_migrate),
SUBTEST(igt_mmap_access),
@ -1859,15 +1860,14 @@ int i915_gem_mman_live_selftests(struct drm_i915_private *i915)
SUBTEST(igt_mmap_gpu),
};
if (!current->mm) {
kthread_use_mm(current->active_mm);
unuse_mm = true;
}
ret = i915_live_subtests(tests, i915);
if (ret)
return ret;
if (unuse_mm)
kthread_unuse_mm(current->active_mm);
if (current->mm)
ret = i915_live_subtests(vma_tests, i915);
else
pr_warn("No current->mm to safely borrow userspace memory from. Skipping VMA tests.\n");
return ret;
}