aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-12-04 08:25:13 -0500
committerJani Nikula <jani.nikula@intel.com>2017-12-14 03:58:06 -0500
commit2797c4a11f373b2545c2398ccb02e362ee66a142 (patch)
tree41f24606e5b544dd7e1cd16036f755bce3ff07b8
parent50c4c4e268a2d7a3e58ebb698ac74da0de40ae36 (diff)
drm/i915: Flush pending GTT writes before unbinding
From the shrinker paths, we want to relinquish the GPU and GGTT access to the object, releasing the backing storage back to the system for swapout. As a part of that process we would unpin the pages, marking them for access by the CPU (for the swapout/swapin). However, if that process was interrupted after unbind the vma, we missed a flush of the inflight GGTT writes before we made that GTT space available again for reuse, with the prospect that we would redirect them to another page. The bug dates back to the introduction of multiple GGTT vma, but the code itself dates to commit 02bef8f98d26 ("drm/i915: Unbind closed vma for i915_gem_object_unbind()"). Fixes: 02bef8f98d26 ("drm/i915: Unbind closed vma for i915_gem_object_unbind()") Fixes: c5ad54cf7dd8 ("drm/i915: Use partial view in mmap fault handler") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: stable@vger.kernel.org Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171204132513.7303-1-chris@chris-wilson.co.uk (cherry picked from commit 5888fc9eac3c2ff96e76aeeb865fdb46ab2d711e) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ad4050f7ab3b..18de6569d04a 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -330,17 +330,10 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj)
330 * must wait for all rendering to complete to the object (as unbinding 330 * must wait for all rendering to complete to the object (as unbinding
331 * must anyway), and retire the requests. 331 * must anyway), and retire the requests.
332 */ 332 */
333 ret = i915_gem_object_wait(obj, 333 ret = i915_gem_object_set_to_cpu_domain(obj, false);
334 I915_WAIT_INTERRUPTIBLE |
335 I915_WAIT_LOCKED |
336 I915_WAIT_ALL,
337 MAX_SCHEDULE_TIMEOUT,
338 NULL);
339 if (ret) 334 if (ret)
340 return ret; 335 return ret;
341 336
342 i915_gem_retire_requests(to_i915(obj->base.dev));
343
344 while ((vma = list_first_entry_or_null(&obj->vma_list, 337 while ((vma = list_first_entry_or_null(&obj->vma_list,
345 struct i915_vma, 338 struct i915_vma,
346 obj_link))) { 339 obj_link))) {