[Intel-gfx] [PATCH] drm/i915: Check reserve_memtype for failure

Chris Wilson chris at chris-wilson.co.uk
Sun Jan 21 16:27:38 UTC 2018


When we allocate the GTT page-directory on !llc, we try to mark those
pages as using WC (via PAT). This may fail, so check and propagate the
error.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 6a036c068684..eebeb9a91631 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -409,7 +409,10 @@ static struct page *vm_alloc_page(struct i915_address_space *vm, gfp_t gfp)
 	if (unlikely(!pvec->nr))
 		return NULL;
 
-	set_pages_array_wc(pvec->pages, pvec->nr);
+	if (unlikely(set_pages_array_wc(pvec->pages, pvec->nr))) {
+		__pagevec_release(pvec);
+		return NULL;
+	}
 
 	return pvec->pages[--pvec->nr];
 }
-- 
2.15.1



More information about the Intel-gfx mailing list