Skip to content

Commit

Permalink
drm/i915/gt: Mark context->state vma as active while pinned
Browse files Browse the repository at this point in the history
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
context->state vma as active during execution if we want to include it
in the error state.

Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: b1e3177 ("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>
Link: https://patchwork.freedesktop.org/patch/msgid/20200110110402.1231745-2-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Jan 10, 2020
1 parent 80e5351 commit 1b8bfc5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/gpu/drm/i915/gt/intel_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ static int __context_pin_state(struct i915_vma *vma)
if (err)
return err;

err = i915_active_acquire(&vma->active);
if (err)
goto err_unpin;

/*
* And mark it as a globally pinned object to let the shrinker know
* it cannot reclaim the object until we release it.
Expand All @@ -168,11 +172,16 @@ static int __context_pin_state(struct i915_vma *vma)
vma->obj->mm.dirty = true;

return 0;

err_unpin:
i915_vma_unpin(vma);
return err;
}

static void __context_unpin_state(struct i915_vma *vma)
{
i915_vma_make_shrinkable(vma);
i915_active_release(&vma->active);
__i915_vma_unpin(vma);
}

Expand Down

0 comments on commit 1b8bfc5

Please sign in to comment.