Skip to content

Commit

Permalink
drm/i915/selftests: Prepare huge_pages testcases for obj->mm.lock rem…
Browse files Browse the repository at this point in the history
…oval.

Straightforward conversion, just convert a bunch of calls to
unlocked versions.

Signed-off-by: Maarten Lankhorst <[email protected]>
Reviewed-by: Thomas Hellström <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
mlankhorst authored and danvet committed Mar 24, 2021
1 parent 26ad4f8 commit 6c12ada
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions drivers/gpu/drm/i915/gem/selftests/huge_pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ static int igt_mock_ppgtt_misaligned_dma(void *arg)
goto out_put;
}

err = i915_gem_object_pin_pages(obj);
err = i915_gem_object_pin_pages_unlocked(obj);
if (err)
goto out_put;

Expand Down Expand Up @@ -653,15 +653,19 @@ static int igt_mock_ppgtt_misaligned_dma(void *arg)
break;
}

i915_gem_object_lock(obj, NULL);
i915_gem_object_unpin_pages(obj);
__i915_gem_object_put_pages(obj);
i915_gem_object_unlock(obj);
i915_gem_object_put(obj);
}

return 0;

out_unpin:
i915_gem_object_lock(obj, NULL);
i915_gem_object_unpin_pages(obj);
i915_gem_object_unlock(obj);
out_put:
i915_gem_object_put(obj);

Expand All @@ -675,8 +679,10 @@ static void close_object_list(struct list_head *objects,

list_for_each_entry_safe(obj, on, objects, st_link) {
list_del(&obj->st_link);
i915_gem_object_lock(obj, NULL);
i915_gem_object_unpin_pages(obj);
__i915_gem_object_put_pages(obj);
i915_gem_object_unlock(obj);
i915_gem_object_put(obj);
}
}
Expand Down Expand Up @@ -713,7 +719,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
break;
}

err = i915_gem_object_pin_pages(obj);
err = i915_gem_object_pin_pages_unlocked(obj);
if (err) {
i915_gem_object_put(obj);
break;
Expand Down Expand Up @@ -889,7 +895,7 @@ static int igt_mock_ppgtt_64K(void *arg)
if (IS_ERR(obj))
return PTR_ERR(obj);

err = i915_gem_object_pin_pages(obj);
err = i915_gem_object_pin_pages_unlocked(obj);
if (err)
goto out_object_put;

Expand Down Expand Up @@ -943,8 +949,10 @@ static int igt_mock_ppgtt_64K(void *arg)
}

i915_vma_unpin(vma);
i915_gem_object_lock(obj, NULL);
i915_gem_object_unpin_pages(obj);
__i915_gem_object_put_pages(obj);
i915_gem_object_unlock(obj);
i915_gem_object_put(obj);
}
}
Expand All @@ -954,7 +962,9 @@ static int igt_mock_ppgtt_64K(void *arg)
out_vma_unpin:
i915_vma_unpin(vma);
out_object_unpin:
i915_gem_object_lock(obj, NULL);
i915_gem_object_unpin_pages(obj);
i915_gem_object_unlock(obj);
out_object_put:
i915_gem_object_put(obj);

Expand Down Expand Up @@ -1024,7 +1034,7 @@ static int __cpu_check_vmap(struct drm_i915_gem_object *obj, u32 dword, u32 val)
if (err)
return err;

ptr = i915_gem_object_pin_map(obj, I915_MAP_WC);
ptr = i915_gem_object_pin_map_unlocked(obj, I915_MAP_WC);
if (IS_ERR(ptr))
return PTR_ERR(ptr);

Expand Down Expand Up @@ -1304,7 +1314,7 @@ static int igt_ppgtt_smoke_huge(void *arg)
return err;
}

err = i915_gem_object_pin_pages(obj);
err = i915_gem_object_pin_pages_unlocked(obj);
if (err) {
if (err == -ENXIO || err == -E2BIG) {
i915_gem_object_put(obj);
Expand All @@ -1327,8 +1337,10 @@ static int igt_ppgtt_smoke_huge(void *arg)
__func__, size, i);
}
out_unpin:
i915_gem_object_lock(obj, NULL);
i915_gem_object_unpin_pages(obj);
__i915_gem_object_put_pages(obj);
i915_gem_object_unlock(obj);
out_put:
i915_gem_object_put(obj);

Expand Down Expand Up @@ -1402,7 +1414,7 @@ static int igt_ppgtt_sanity_check(void *arg)
return err;
}

err = i915_gem_object_pin_pages(obj);
err = i915_gem_object_pin_pages_unlocked(obj);
if (err) {
i915_gem_object_put(obj);
goto out;
Expand All @@ -1416,8 +1428,10 @@ static int igt_ppgtt_sanity_check(void *arg)

err = igt_write_huge(ctx, obj);

i915_gem_object_lock(obj, NULL);
i915_gem_object_unpin_pages(obj);
__i915_gem_object_put_pages(obj);
i915_gem_object_unlock(obj);
i915_gem_object_put(obj);

if (err) {
Expand Down Expand Up @@ -1462,7 +1476,7 @@ static int igt_tmpfs_fallback(void *arg)
goto out_restore;
}

vaddr = i915_gem_object_pin_map(obj, I915_MAP_WB);
vaddr = i915_gem_object_pin_map_unlocked(obj, I915_MAP_WB);
if (IS_ERR(vaddr)) {
err = PTR_ERR(vaddr);
goto out_put;
Expand Down

0 comments on commit 6c12ada

Please sign in to comment.