Skip to content

Commit

Permalink
drm/i915: Rollback seqno when request creation fails
Browse files Browse the repository at this point in the history
gem_ctx_create.basic-files can slam on kernel contexts to the extent
where request creation fails because the ring is full. When this happens
seqno numbers are skipped which can result the below GEM_BUG_ON blowing
in gt/intel_engine_pm.c:__engine_unpark:

GEM_BUG_ON(ce->timeline->seqno !=
           READ_ONCE(*ce->timeline->hwsp_seqno));

Fixup request creation code to roll back seqno when request creation
fails.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
  • Loading branch information
mbrost05 authored and intel-lab-lkp committed Dec 3, 2021
1 parent d5ba72f commit af59022
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/i915/gt/intel_timeline.c
Expand Up @@ -301,6 +301,11 @@ static u32 timeline_advance(struct intel_timeline *tl)
return tl->seqno += 1 + tl->has_initial_breadcrumb;
}

void intel_timeline_rollback_seqno(struct intel_timeline *tl)
{
timeline_rollback(tl);
}

static noinline int
__intel_timeline_get_seqno(struct intel_timeline *tl,
u32 *seqno)
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/gt/intel_timeline.h
Expand Up @@ -72,6 +72,7 @@ void intel_timeline_enter(struct intel_timeline *tl);
int intel_timeline_get_seqno(struct intel_timeline *tl,
struct i915_request *rq,
u32 *seqno);
void intel_timeline_rollback_seqno(struct intel_timeline *tl);
void intel_timeline_exit(struct intel_timeline *tl);
void intel_timeline_unpin(struct intel_timeline *tl);

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/i915_request.c
Expand Up @@ -966,6 +966,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)

err_unwind:
ce->ring->emit = rq->head;
intel_timeline_rollback_seqno(tl);

/* Make sure we didn't add ourselves to external state before freeing */
GEM_BUG_ON(!list_empty(&rq->sched.signalers_list));
Expand Down

0 comments on commit af59022

Please sign in to comment.