Message ID | 1479415087-13216-1-git-send-email-matthew.auld@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Nov 17, 2016 at 08:38:07PM +0000, Matthew Auld wrote: > We need to clean up the global_timeline in i915_gem_load_cleanup. > > v2: don't forget about the struct_mutex, and also WARN_ON if we have any > remaining timelines before purging the global_timeline. > > v3: it might be a good idea to first remove the global_timeline...duh! > > Fixes: 73cb97010d4f ("drm/i915: Combine seqno + tracking into a global timeline struct") > Cc: Chris Wilson <chris@chris-wilson.co.uk> > Signed-off-by: Matthew Auld <matthew.auld@intel.com> > --- > drivers/gpu/drm/i915/i915_gem.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 3fb5e66e4d65..b7a8c8349ccb 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -4557,6 +4557,12 @@ void i915_gem_load_cleanup(struct drm_device *dev) > > WARN_ON(!llist_empty(&dev_priv->mm.free_list)); > > + mutex_lock(&dev_priv->drm.struct_mutex); > + i915_gem_timeline_fini(&dev_priv->gt.global_timeline); > + mutex_unlock(&dev_priv->drm.struct_mutex); > + > + WARN_ON(!list_empty(&dev_priv->gt.timelines)); I would have plonked this under the mutex, then it mirrors the mutex_lock() INIT_LIST_HEAD() i915_gem_timeline_init(&dev_priv->gt.global_timeline); mutex_unlock() we do at the start. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> I'll surreptiously do that, and send this pair to CI together since the order is important to avoid adding this WARN before the fix. -Chris
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 3fb5e66e4d65..b7a8c8349ccb 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4557,6 +4557,12 @@ void i915_gem_load_cleanup(struct drm_device *dev) WARN_ON(!llist_empty(&dev_priv->mm.free_list)); + mutex_lock(&dev_priv->drm.struct_mutex); + i915_gem_timeline_fini(&dev_priv->gt.global_timeline); + mutex_unlock(&dev_priv->drm.struct_mutex); + + WARN_ON(!list_empty(&dev_priv->gt.timelines)); + kmem_cache_destroy(dev_priv->dependencies); kmem_cache_destroy(dev_priv->requests); kmem_cache_destroy(dev_priv->vmas);
We need to clean up the global_timeline in i915_gem_load_cleanup. v2: don't forget about the struct_mutex, and also WARN_ON if we have any remaining timelines before purging the global_timeline. v3: it might be a good idea to first remove the global_timeline...duh! Fixes: 73cb97010d4f ("drm/i915: Combine seqno + tracking into a global timeline struct") Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Matthew Auld <matthew.auld@intel.com> --- drivers/gpu/drm/i915/i915_gem.c | 6 ++++++ 1 file changed, 6 insertions(+)