Protect the access to driver and timeline name which otherwise could be freed as dma-fence exported is signalling fences.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursu...@igalia.com> --- drivers/gpu/drm/i915/gt/intel_gt_requests.c | 2 ++ drivers/gpu/drm/i915/i915_request.c | 5 +++-- drivers/gpu/drm/i915/i915_sw_fence.c | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c index ae3557ed6c1e..11fca24c8b5b 100644 --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c @@ -251,10 +251,12 @@ void intel_gt_watchdog_work(struct work_struct *work) if (!i915_request_completed(rq)) { struct dma_fence *f = &rq->fence; + dma_fence_access_begin(); pr_notice("Fence expiration time out i915-%s:%s:%llx!\n", dma_fence_driver_name(f), dma_fence_timeline_name(f), f->seqno); + dma_fence_access_end(); i915_request_cancel(rq, -EINTR); } i915_request_put(rq); diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c index 4874c4f1e4ab..8008b7767641 100644 --- a/drivers/gpu/drm/i915/i915_request.c +++ b/drivers/gpu/drm/i915/i915_request.c @@ -2184,7 +2184,6 @@ void i915_request_show(struct drm_printer *m, const char *prefix, int indent) { - const char *name = dma_fence_timeline_name((struct dma_fence *)&rq->fence); char buf[80] = ""; int x = 0; @@ -2220,6 +2219,7 @@ void i915_request_show(struct drm_printer *m, x = print_sched_attr(&rq->sched.attr, buf, x, sizeof(buf)); + dma_fence_access_begin(); drm_printf(m, "%s%.*s%c %llx:%lld%s%s %s @ %dms: %s\n", prefix, indent, " ", queue_status(rq), @@ -2228,7 +2228,8 @@ void i915_request_show(struct drm_printer *m, fence_status(rq), buf, jiffies_to_msecs(jiffies - rq->emitted_jiffies), - name); + dma_fence_timeline_name((struct dma_fence *)&rq->fence)); + dma_fence_access_end(); } static bool engine_match_ring(struct intel_engine_cs *engine, struct i915_request *rq) diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c index e51ca7e50a4e..e7bdc1165b90 100644 --- a/drivers/gpu/drm/i915/i915_sw_fence.c +++ b/drivers/gpu/drm/i915/i915_sw_fence.c @@ -434,11 +434,13 @@ static void timer_i915_sw_fence_wake(struct timer_list *t) if (!fence) return; + dma_fence_access_begin(); pr_notice("Asynchronous wait on fence %s:%s:%llx timed out (hint:%ps)\n", dma_fence_driver_name(cb->dma), dma_fence_timeline_name(cb->dma), cb->dma->seqno, i915_sw_fence_debug_hint(fence)); + dma_fence_access_end(); i915_sw_fence_set_error_once(fence, -ETIMEDOUT); i915_sw_fence_complete(fence); -- 2.48.0