]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/selftests: handle allocation failures
authorMatthew Auld <matthew.auld@intel.com>
Mon, 28 Feb 2022 12:36:06 +0000 (12:36 +0000)
committerMatthew Auld <matthew.auld@intel.com>
Tue, 1 Mar 2022 08:50:47 +0000 (08:50 +0000)
If we have to contend with non-mappable LMEM, then we need to ensure the
object fits within the mappable portion, like in the selftests, where we
later try to CPU access the pages. However if it can't then we need to
gracefully handle this, without throwing an error.

Also it looks like TTM will return -ENOMEM, in ttm_bo_mem_space() after
exhausting all possible placements.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Acked-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220228123607.580432-3-matthew.auld@intel.com
drivers/gpu/drm/i915/gem/selftests/huge_pages.c
drivers/gpu/drm/i915/selftests/intel_memory_region.c

index dbbae53f820a73aedf80f0621c4197ad7f1ca9af..7a84fa68a99ca09e06e7fe80e506aae88de3e3be 100644 (file)
@@ -1345,7 +1345,7 @@ try_again:
 
                err = i915_gem_object_pin_pages_unlocked(obj);
                if (err) {
-                       if (err == -ENXIO || err == -E2BIG) {
+                       if (err == -ENXIO || err == -E2BIG || err == -ENOMEM) {
                                i915_gem_object_put(obj);
                                size >>= 1;
                                goto try_again;
index 56dec9723601a58d80b975dcc3d0be747da02640..ba32893e0873c903fd97c61de4df5eb554a6afbd 100644 (file)
@@ -822,8 +822,14 @@ static int igt_lmem_create_with_ps(void *arg)
 
                i915_gem_object_lock(obj, NULL);
                err = i915_gem_object_pin_pages(obj);
-               if (err)
+               if (err) {
+                       if (err == -ENXIO || err == -E2BIG || err == -ENOMEM) {
+                               pr_info("%s not enough lmem for ps(%u) err=%d\n",
+                                       __func__, ps, err);
+                               err = 0;
+                       }
                        goto out_put;
+               }
 
                daddr = i915_gem_object_get_dma_address(obj, 0);
                if (!IS_ALIGNED(daddr, ps)) {