drm/i915: Check PIN_NONFAULT overlaps in evict_for_node
authorChris Wilson <[email protected]>
Mon, 9 Oct 2017 08:43:58 +0000 (09:43 +0100)
committerChris Wilson <[email protected]>
Mon, 9 Oct 2017 16:07:29 +0000 (17:07 +0100)
If the caller says that he doesn't want to evict any other faulting
vma, honour that flag. The logic was used in evict_something, but not
the more specific evict_for_node, now being used as a preliminary probe
since commit 606fec956c0e ("drm/i915: Prefer random replacement before
eviction search").

Fixes: 606fec956c0e ("drm/i915: Prefer random replacement before eviction search")
Fixes: 821188778b9b ("drm/i915: Choose not to evict faultable objects from the GGTT")
References: https://bugs.freedesktop.org/show_bug.cgi?id=102490
Signed-off-by: Chris Wilson <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Reviewed-by: Joonas Lahtinen <[email protected]>
drivers/gpu/drm/i915/i915_gem_evict.c

index 933ee8ecfa54e01f15903f28f6ff08e182843887..a5a5b7e6daae355b9f5a80e39ea2cbaac9173e90 100644 (file)
@@ -315,6 +315,11 @@ int i915_gem_evict_for_node(struct i915_address_space *vm,
                        break;
                }
 
+               if (flags & PIN_NONFAULT && i915_vma_has_userfault(vma)) {
+                       ret = -ENOSPC;
+                       break;
+               }
+
                /* Overlap of objects in the same batch? */
                if (i915_vma_is_pinned(vma)) {
                        ret = -ENOSPC;