Message ID | 20221116112532.36253-3-janusz.krzysztofik@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915: Fix timeout handling when retiring requests | expand |
On 16.11.2022 12:25, Janusz Krzysztofik wrote: > Users of intel_gt_retire_requests_timeout() expect 0 return value on > success. However, we have no protection from passing back 0 potentially > returned by dma_fence_wait_timeout() on timeout. > > Replace 0 with -ETIME before using timeout as return value. > > Fixes: f33a8a51602c ("drm/i915: Merge wait_for_timelines with retire_request") > Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> > Cc: stable@vger.kernel.org # v5.5+ > --- > drivers/gpu/drm/i915/gt/intel_gt_requests.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c > index ccaf2fd80625b..ac6b2b1861397 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c > +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c > @@ -213,6 +213,9 @@ out_active: spin_lock(&timelines->lock); > list_for_each_entry_safe(tl, tn, &free, link) > __intel_timeline_free(&tl->kref); > > + if (!timeout) > + timeout = -ETIME; > + Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Regards Andrzej > if (flush_submission(gt, timeout)) /* Wait, there's more! */ > active_count++; >
Looks very relevant to our recent hangcheck failures. Acked-by: Nirmoy Das <nirmoy.das@intel.com> On 11/16/2022 12:25 PM, Janusz Krzysztofik wrote: > Users of intel_gt_retire_requests_timeout() expect 0 return value on > success. However, we have no protection from passing back 0 potentially > returned by dma_fence_wait_timeout() on timeout. > > Replace 0 with -ETIME before using timeout as return value. > > Fixes: f33a8a51602c ("drm/i915: Merge wait_for_timelines with retire_request") > Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> > Cc: stable@vger.kernel.org # v5.5+ > --- > drivers/gpu/drm/i915/gt/intel_gt_requests.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c > index ccaf2fd80625b..ac6b2b1861397 100644 > --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c > +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c > @@ -213,6 +213,9 @@ out_active: spin_lock(&timelines->lock); > list_for_each_entry_safe(tl, tn, &free, link) > __intel_timeline_free(&tl->kref); > > + if (!timeout) > + timeout = -ETIME; > + > if (flush_submission(gt, timeout)) /* Wait, there's more! */ > active_count++; >
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c index ccaf2fd80625b..ac6b2b1861397 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c @@ -213,6 +213,9 @@ out_active: spin_lock(&timelines->lock); list_for_each_entry_safe(tl, tn, &free, link) __intel_timeline_free(&tl->kref); + if (!timeout) + timeout = -ETIME; + if (flush_submission(gt, timeout)) /* Wait, there's more! */ active_count++;
Users of intel_gt_retire_requests_timeout() expect 0 return value on success. However, we have no protection from passing back 0 potentially returned by dma_fence_wait_timeout() on timeout. Replace 0 with -ETIME before using timeout as return value. Fixes: f33a8a51602c ("drm/i915: Merge wait_for_timelines with retire_request") Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com> Cc: stable@vger.kernel.org # v5.5+ --- drivers/gpu/drm/i915/gt/intel_gt_requests.c | 3 +++ 1 file changed, 3 insertions(+)