Skip to content

Commit

Permalink
drm/i915/selftests: Grab the runtime pm in shrink_thp
Browse files Browse the repository at this point in the history
Since we are not holding a wakeref, shrinking a bound object is not
guaranteed.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6370
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220706154738.235204-1-matthew.auld@intel.com
  • Loading branch information
Chris Wilson authored and Matthew Auld committed Jul 7, 2022
1 parent b94a1a2 commit 027c38b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/gpu/drm/i915/gem/selftests/huge_pages.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,7 @@ static int igt_shrink_thp(void *arg)
struct file *file;
unsigned int flags = PIN_USER;
unsigned int n;
intel_wakeref_t wf;
bool should_swap;
int err;

Expand Down Expand Up @@ -1659,9 +1660,11 @@ static int igt_shrink_thp(void *arg)
goto out_put;
}

wf = intel_runtime_pm_get(&i915->runtime_pm); /* active shrink */

err = i915_vma_pin(vma, 0, 0, flags);
if (err)
goto out_put;
goto out_wf;

if (obj->mm.page_sizes.phys < I915_GTT_PAGE_SIZE_2M) {
pr_info("failed to allocate THP, finishing test early\n");
Expand Down Expand Up @@ -1732,6 +1735,8 @@ static int igt_shrink_thp(void *arg)

out_unpin:
i915_vma_unpin(vma);
out_wf:
intel_runtime_pm_put(&i915->runtime_pm, wf);
out_put:
i915_gem_object_put(obj);
out_vm:
Expand Down

0 comments on commit 027c38b

Please sign in to comment.