diff mbox

drm/i915/selftests: Mark contexts as lost during freeing of mock device

Message ID 20170719135957.14603-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 19, 2017, 1:59 p.m. UTC
We need to unpin the last retired context early in the shutdown sequence
so that its RCU free is done before we try to free the context ida. I
included this in a later patch ("drm/i915: Keep a recent cache of freed
contexts objects for reuse") and so missed that the selftests were broken
in the meantime.

Reported-by: Matthew Auld <matthew.auld@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101627
Fixes: 5f09a9c8ab6b ("drm/i915: Allow contexts to be unreferenced locklessly")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/selftests/mock_gem_device.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Matthew Auld July 19, 2017, 5:40 p.m. UTC | #1
On 19 July 2017 at 14:59, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> We need to unpin the last retired context early in the shutdown sequence
> so that its RCU free is done before we try to free the context ida. I
> included this in a later patch ("drm/i915: Keep a recent cache of freed
> contexts objects for reuse") and so missed that the selftests were broken
> in the meantime.
>
> Reported-by: Matthew Auld <matthew.auld@intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101627
> Fixes: 5f09a9c8ab6b ("drm/i915: Allow contexts to be unreferenced locklessly")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>

Makes sense.

Tested-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Chris Wilson July 19, 2017, 6:16 p.m. UTC | #2
Quoting Matthew Auld (2017-07-19 18:40:05)
> On 19 July 2017 at 14:59, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > We need to unpin the last retired context early in the shutdown sequence
> > so that its RCU free is done before we try to free the context ida. I
> > included this in a later patch ("drm/i915: Keep a recent cache of freed
> > contexts objects for reuse") and so missed that the selftests were broken
> > in the meantime.
> >
> > Reported-by: Matthew Auld <matthew.auld@intel.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101627
> > Fixes: 5f09a9c8ab6b ("drm/i915: Allow contexts to be unreferenced locklessly")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> 
> Makes sense.
> 
> Tested-by: Matthew Auld <matthew.auld@intel.com>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>

Obvious in hindsight, pushed. Thanks,
-Chris
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index d451dfbe9bbb..dda413c95b89 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -54,6 +54,7 @@  static void mock_device_release(struct drm_device *dev)
 
 	mutex_lock(&i915->drm.struct_mutex);
 	mock_device_flush(i915);
+	i915_gem_contexts_lost(i915);
 	mutex_unlock(&i915->drm.struct_mutex);
 
 	cancel_delayed_work_sync(&i915->gt.retire_work);