From: Matthew Brost <matthew.brost@intel.com> To: <intel-gfx@lists.freedesktop.org>, <dri-devel@lists.freedesktop.org> Cc: daniele.ceraolospurio@intel.com, john.c.harrison@intel.com Subject: [PATCH] drm/i915: Rollback seqno when request creation fails Date: Fri, 3 Dec 2021 09:59:10 -0800 [thread overview] Message-ID: <20211203175910.28516-1-matthew.brost@intel.com> (raw) 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> --- drivers/gpu/drm/i915/gt/intel_timeline.c | 5 +++++ drivers/gpu/drm/i915/gt/intel_timeline.h | 1 + drivers/gpu/drm/i915/i915_request.c | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c b/drivers/gpu/drm/i915/gt/intel_timeline.c index 438bbc7b8147..64ea9a90c7a0 100644 --- a/drivers/gpu/drm/i915/gt/intel_timeline.c +++ b/drivers/gpu/drm/i915/gt/intel_timeline.c @@ -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) diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.h b/drivers/gpu/drm/i915/gt/intel_timeline.h index 57308c4d664a..a2f2e0ea186f 100644 --- a/drivers/gpu/drm/i915/gt/intel_timeline.h +++ b/drivers/gpu/drm/i915/gt/intel_timeline.h @@ -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); diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index a72c8f0346a0..86f32ee082f7 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -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)); -- 2.33.1
WARNING: multiple messages have this Message-ID (diff)
From: Matthew Brost <matthew.brost@intel.com> To: <intel-gfx@lists.freedesktop.org>, <dri-devel@lists.freedesktop.org> Subject: [Intel-gfx] [PATCH] drm/i915: Rollback seqno when request creation fails Date: Fri, 3 Dec 2021 09:59:10 -0800 [thread overview] Message-ID: <20211203175910.28516-1-matthew.brost@intel.com> (raw) 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> --- drivers/gpu/drm/i915/gt/intel_timeline.c | 5 +++++ drivers/gpu/drm/i915/gt/intel_timeline.h | 1 + drivers/gpu/drm/i915/i915_request.c | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.c b/drivers/gpu/drm/i915/gt/intel_timeline.c index 438bbc7b8147..64ea9a90c7a0 100644 --- a/drivers/gpu/drm/i915/gt/intel_timeline.c +++ b/drivers/gpu/drm/i915/gt/intel_timeline.c @@ -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) diff --git a/drivers/gpu/drm/i915/gt/intel_timeline.h b/drivers/gpu/drm/i915/gt/intel_timeline.h index 57308c4d664a..a2f2e0ea186f 100644 --- a/drivers/gpu/drm/i915/gt/intel_timeline.h +++ b/drivers/gpu/drm/i915/gt/intel_timeline.h @@ -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); diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index a72c8f0346a0..86f32ee082f7 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -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)); -- 2.33.1
next reply other threads:[~2021-12-03 18:05 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-03 17:59 Matthew Brost [this message] 2021-12-03 17:59 ` [Intel-gfx] [PATCH] drm/i915: Rollback seqno when request creation fails Matthew Brost 2021-12-03 22:14 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork 2021-12-04 0:50 ` [PATCH] " kernel test robot 2021-12-04 0:50 ` kernel test robot 2021-12-04 0:50 ` [Intel-gfx] " kernel test robot 2021-12-03 23:51 Matthew Brost
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211203175910.28516-1-matthew.brost@intel.com \ --to=matthew.brost@intel.com \ --cc=daniele.ceraolospurio@intel.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=intel-gfx@lists.freedesktop.org \ --cc=john.c.harrison@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.