On Thu, 2026-05-07 at 14:24 +0000, Krzysztof Karas wrote:
> This set of tests require userspace memory to map objects, so
> run them only if this that memory is available.
> 
> Reviewed-by: Sebastian Brzezinka <[email protected]>
> Reviewed-by: Andi Shyti <[email protected]>
> Signed-off-by: Krzysztof Karas <[email protected]>

Reviewed-by: Janusz Krzysztofik <[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;
>  }

Reply via email to