Skip to content

Commit dce54e8

Browse files
icklejlahtine-intel
authored andcommitted
drm/i915/gt: Mark ring->vma as active while pinned
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 <[email protected]> Fixes: b1e3177 ("drm/i915: Coordinate i915_active with its own mutex") Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Lionel Landwerlin <[email protected]> Acked-by: Lionel Landwerlin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 8ccfc20) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent e2c56d8 commit dce54e8

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

drivers/gpu/drm/i915/gt/intel_context.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,31 @@ static void __context_unpin_state(struct i915_vma *vma)
148148
__i915_vma_unpin(vma);
149149
}
150150

151+
static int __ring_active(struct intel_ring *ring)
152+
{
153+
int err;
154+
155+
err = i915_active_acquire(&ring->vma->active);
156+
if (err)
157+
return err;
158+
159+
err = intel_ring_pin(ring);
160+
if (err)
161+
goto err_active;
162+
163+
return 0;
164+
165+
err_active:
166+
i915_active_release(&ring->vma->active);
167+
return err;
168+
}
169+
170+
static void __ring_retire(struct intel_ring *ring)
171+
{
172+
intel_ring_unpin(ring);
173+
i915_active_release(&ring->vma->active);
174+
}
175+
151176
__i915_active_call
152177
static void __intel_context_retire(struct i915_active *active)
153178
{
@@ -160,7 +185,7 @@ static void __intel_context_retire(struct i915_active *active)
160185
__context_unpin_state(ce->state);
161186

162187
intel_timeline_unpin(ce->timeline);
163-
intel_ring_unpin(ce->ring);
188+
__ring_retire(ce->ring);
164189

165190
intel_context_put(ce);
166191
}
@@ -172,7 +197,7 @@ static int __intel_context_active(struct i915_active *active)
172197

173198
intel_context_get(ce);
174199

175-
err = intel_ring_pin(ce->ring);
200+
err = __ring_active(ce->ring);
176201
if (err)
177202
goto err_put;
178203

@@ -192,7 +217,7 @@ static int __intel_context_active(struct i915_active *active)
192217
err_timeline:
193218
intel_timeline_unpin(ce->timeline);
194219
err_ring:
195-
intel_ring_unpin(ce->ring);
220+
__ring_retire(ce->ring);
196221
err_put:
197222
intel_context_put(ce);
198223
return err;

0 commit comments

Comments
 (0)