Commit 8221d21b authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Lock the drm_mm while modifying

Remember to lock the drm_mm as we modify it, lest it be modified in the
background by retire/free workers!
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190703091726.11690-2-chris@chris-wilson.co.uk
parent 63251685
...@@ -414,7 +414,9 @@ static int igt_mmap_offset_exhaustion(void *arg) ...@@ -414,7 +414,9 @@ static int igt_mmap_offset_exhaustion(void *arg)
drm_mm_for_each_hole(hole, mm, hole_start, hole_end) { drm_mm_for_each_hole(hole, mm, hole_start, hole_end) {
resv.start = hole_start; resv.start = hole_start;
resv.size = hole_end - hole_start - 1; /* PAGE_SIZE units */ resv.size = hole_end - hole_start - 1; /* PAGE_SIZE units */
mutex_lock(&i915->drm.struct_mutex);
err = drm_mm_reserve_node(mm, &resv); err = drm_mm_reserve_node(mm, &resv);
mutex_unlock(&i915->drm.struct_mutex);
if (err) { if (err) {
pr_err("Failed to trim VMA manager, err=%d\n", err); pr_err("Failed to trim VMA manager, err=%d\n", err);
goto out_park; goto out_park;
...@@ -478,7 +480,9 @@ static int igt_mmap_offset_exhaustion(void *arg) ...@@ -478,7 +480,9 @@ static int igt_mmap_offset_exhaustion(void *arg)
} }
out: out:
mutex_lock(&i915->drm.struct_mutex);
drm_mm_remove_node(&resv); drm_mm_remove_node(&resv);
mutex_unlock(&i915->drm.struct_mutex);
out_park: out_park:
restore_retire_worker(i915); restore_retire_worker(i915);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment