]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Do not cleanup obj with NULL bo->resource
authorNirmoy Das <nirmoy.das@intel.com>
Tue, 20 Sep 2022 17:06:28 +0000 (19:06 +0200)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 27 Sep 2022 10:05:23 +0000 (11:05 +0100)
For delayed BO release i915_ttm_delete_mem_notify()
gets called twice, once with proper bo->resource and
another time with NULL. We shouldn't do anything for
the 2nd time as we already cleaned up the obj once.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/6850
Fixes: cc00a61e26f6f8 ("drm/i915/dgfx: Release mmap on rpm suspend")
Signed-off-by: Nirmoy Das <nirmoy.das@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/20220920170628.3391-1-nirmoy.das@intel.com
(cherry picked from commit fb7818989976317cc2e78008aa2df7b9fe423c86)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
drivers/gpu/drm/i915/gem/i915_gem_ttm.c

index 0544b0a4a43ad16e39ac05bdc0a9779b542d2993..e3fc38dd5db048bb2bf9e209299b2cf183f4f385 100644 (file)
@@ -511,7 +511,7 @@ static void i915_ttm_delete_mem_notify(struct ttm_buffer_object *bo)
        struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);
        intel_wakeref_t wakeref = 0;
 
-       if (likely(obj)) {
+       if (bo->resource && likely(obj)) {
                /* ttm_bo_release() already has dma_resv_lock */
                if (i915_ttm_cpu_maps_iomem(bo->resource))
                        wakeref = intel_runtime_pm_get(&to_i915(obj->base.dev)->runtime_pm);