Message ID | 20191212140459.1307617-9-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/33] drm/i915: Use EAGAIN for trylock failures | expand |
On 12/12/2019 16:04, Chris Wilson wrote: > As we use the active state to keep the vma alive while we are reading > its contents during GPU error capture, we need to mark the > ring->vma as active during execution if we want to include the rinbuffer > in the error state. > > Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > Fixes: b1e3177bd1d8 ("drm/i915: Coordinate i915_active with its own mutex") > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > --- > drivers/gpu/drm/i915/gt/intel_ring.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c > index 374b28f13ca0..7a27264150b9 100644 > --- a/drivers/gpu/drm/i915/gt/intel_ring.c > +++ b/drivers/gpu/drm/i915/gt/intel_ring.c > @@ -45,6 +45,10 @@ int intel_ring_pin(struct intel_ring *ring) > if (unlikely(ret)) > goto err_unpin; > > + ret = i915_active_acquire(&vma->active); > + if (ret) > + goto err_ring; > + > if (i915_vma_is_map_and_fenceable(vma)) > addr = (void __force *)i915_vma_pin_iomap(vma); > else > @@ -52,7 +56,7 @@ int intel_ring_pin(struct intel_ring *ring) > i915_coherent_map_type(vma->vm->i915)); > if (IS_ERR(addr)) { > ret = PTR_ERR(addr); > - goto err_ring; > + goto err_active; > } > > i915_vma_make_unshrinkable(vma); > @@ -63,6 +67,8 @@ int intel_ring_pin(struct intel_ring *ring) > ring->vaddr = addr; > return 0; > > +err_active: > + i915_active_release(&vma->active); > err_ring: > i915_vma_unpin(vma); > err_unpin: > @@ -93,6 +99,8 @@ void intel_ring_unpin(struct intel_ring *ring) > i915_gem_object_unpin_map(vma->obj); > > i915_vma_make_purgeable(vma); > + > + i915_active_release(&vma->active); > i915_vma_unpin(vma); > } >
diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c index 374b28f13ca0..7a27264150b9 100644 --- a/drivers/gpu/drm/i915/gt/intel_ring.c +++ b/drivers/gpu/drm/i915/gt/intel_ring.c @@ -45,6 +45,10 @@ int intel_ring_pin(struct intel_ring *ring) if (unlikely(ret)) goto err_unpin; + ret = i915_active_acquire(&vma->active); + if (ret) + goto err_ring; + if (i915_vma_is_map_and_fenceable(vma)) addr = (void __force *)i915_vma_pin_iomap(vma); else @@ -52,7 +56,7 @@ int intel_ring_pin(struct intel_ring *ring) i915_coherent_map_type(vma->vm->i915)); if (IS_ERR(addr)) { ret = PTR_ERR(addr); - goto err_ring; + goto err_active; } i915_vma_make_unshrinkable(vma); @@ -63,6 +67,8 @@ int intel_ring_pin(struct intel_ring *ring) ring->vaddr = addr; return 0; +err_active: + i915_active_release(&vma->active); err_ring: i915_vma_unpin(vma); err_unpin: @@ -93,6 +99,8 @@ void intel_ring_unpin(struct intel_ring *ring) i915_gem_object_unpin_map(vma->obj); i915_vma_make_purgeable(vma); + + i915_active_release(&vma->active); i915_vma_unpin(vma); }
As we use the active state to keep the vma alive while we are reading its contents during GPU error capture, we need to mark the ring->vma as active during execution if we want to include the rinbuffer in the error state. Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes: b1e3177bd1d8 ("drm/i915: Coordinate i915_active with its own mutex") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com> --- drivers/gpu/drm/i915/gt/intel_ring.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)