Skip to content

Commit

Permalink
drm/i915: Require object lock when freeing pages during destruction
Browse files Browse the repository at this point in the history
TTM already requires this, and we require it for delayed destroy.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211216142749.1966107-11-maarten.lankhorst@linux.intel.com
  • Loading branch information
Maarten Lankhorst committed Dec 21, 2021
1 parent 2c3849b commit be7612f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/i915/gem/i915_gem_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ static void __i915_gem_object_free_mmaps(struct drm_i915_gem_object *obj)
*/
void __i915_gem_object_pages_fini(struct drm_i915_gem_object *obj)
{
assert_object_held(obj);

if (!list_empty(&obj->vma.list)) {
struct i915_vma *vma;

Expand Down Expand Up @@ -328,7 +330,10 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
obj->ops->delayed_free(obj);
continue;
}

i915_gem_object_lock(obj, NULL);
__i915_gem_object_pages_fini(obj);
i915_gem_object_unlock(obj);
__i915_gem_free_object(obj);

/* But keep the pointer alive for RCU-protected lookups */
Expand Down

0 comments on commit be7612f

Please sign in to comment.