[Intel-gfx] [PATCH] drm/i915: If the first pin in map_ggtt doesn't success, try again

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 4 05:36:45 UTC 2019


Being unable to find a hole in the mappable aperture, should only be
possible if the entire aperture is *pinned*. Our pins are shortlived,
only taken while binding and constructing batches/mappings, so if we
find no room try again. There are a few semi-permanent pins for rings,
contexts, page tables which take a little longer to be released, but for
our Haswell failure case, should not be the issue.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111530
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index e0bfc021ec6f..3c046803fc61 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -280,7 +280,9 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf)
 		}
 
 		/* The entire mappable GGTT is pinned? Unexpected! */
-		GEM_BUG_ON(vma == ERR_PTR(-ENOSPC));
+		if (unlikely(vma == ERR_PTR(-ENOSPC)))
+			/* Pins *should* be transient, so try again */
+			vma = ERR_PTR(-EAGAIN);
 	}
 	if (IS_ERR(vma)) {
 		ret = PTR_ERR(vma);
-- 
2.23.0



More information about the Intel-gfx mailing list