OSDN Git Service

drm/i915/ttm: Fix incorrect assumptions about ttm_bo_validate() semantics
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 18 Jun 2021 13:25:15 +0000 (15:25 +0200)
committerMatthew Auld <matthew.auld@intel.com>
Fri, 18 Jun 2021 16:35:16 +0000 (17:35 +0100)
commitb07a6483839a838dc7acff570174053dd544c039
treeb2daf2d68c072620c657984f67de304da202f55b
parent3193927421554757e6bee52f9c7e3937edefc589
drm/i915/ttm: Fix incorrect assumptions about ttm_bo_validate() semantics

We have assumed that if the current placement was not the requested
placement, but instead one of the busy placements, a TTM move would have
been triggered. That is not the case.

So when we initially place LMEM objects in "Limbo", (that is system
placement without any pages allocated), to be able to defer clearing
objects until first get_pages(), the first get_pages() would happily keep
objects in system memory if that is one of the allowed placements. And
since we don't yet support i915 GEM system memory from TTM, everything
breaks apart.

So make sure we try the requested placement first, if no eviction is
needed. If that fails, retry with all allowed placements also allowing
evictions. Also make sure we handle TTM failure codes correctly.

Also temporarily (until we support i915 GEM system on TTM), restrict
allowed placements to the requested placement to avoid things falling
apart should LMEM be full.

Fixes: 38f28c0695c0 ("drm/i915/ttm: Calculate the object placement at get_pages time")
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210618132515.163277-1-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/i915/gem/i915_gem_ttm.c