Skip to content

Commit e543e37

Browse files
icklejnikula
authored andcommitted
drm/i915/gt: Prevent queuing retire workers on the virtual engine
Virtual engines are fleeting. They carry a reference count and may be freed when their last request is retired. This makes them unsuitable for the task of housing engine->retire.work so assert that it is not used. Tvrtko tracked down an instance where we did indeed violate this rule. In virtual_submit_request, we flush a completed request directly with __i915_request_submit and this causes us to queue that request on the veng's breadcrumb list and signal it. Leading us down a path where we should not attach the retire. Reported-by: Tvrtko Ursulin <[email protected]> Fixes: dc93c9b ("drm/i915/gt: Schedule request retirement when signaler idles") Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Mika Kuoppala <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit f91d815) Signed-off-by: Jani Nikula <[email protected]>
1 parent 2e0a576 commit e543e37

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ static void add_retire(struct intel_breadcrumbs *b, struct intel_timeline *tl)
136136
struct intel_engine_cs *engine =
137137
container_of(b, struct intel_engine_cs, breadcrumbs);
138138

139+
if (unlikely(intel_engine_is_virtual(engine)))
140+
engine = intel_virtual_engine_get_sibling(engine, 0);
141+
139142
intel_engine_add_retire(engine, tl);
140143
}
141144

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ static bool add_retire(struct intel_engine_cs *engine,
9999
void intel_engine_add_retire(struct intel_engine_cs *engine,
100100
struct intel_timeline *tl)
101101
{
102+
/* We don't deal well with the engine disappearing beneath us */
103+
GEM_BUG_ON(intel_engine_is_virtual(engine));
104+
102105
if (add_retire(engine, tl))
103106
schedule_work(&engine->retire_work);
104107
}

0 commit comments

Comments
 (0)