On Fri, 8 May 2026, Krzysztof Karas wrote:
This set of tests require userspace memory to map objects, so
run them only if this that memory is available.

I think the word "this" can be dropped from the description.

Otherwise,
Reviewed-by: Michał Grzelak <[email protected]>


Reviewed-by: Sebastian Brzezinka <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Reviewed-by: Janusz Krzysztofik <[email protected]>
Signed-off-by: Krzysztof Karas <[email protected]>
---
.../gpu/drm/i915/gem/selftests/i915_gem_mman.c   | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c 
b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
index 9d454d0b46f2..d01acfb7d93d 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
@@ -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;
}
--
2.34.1

Reply via email to