mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 13:30:45 -05:00
drm/i915: Protect access to driver and timeline name
Protect the access to driver and timeline name which otherwise could be freed as dma-fence exported is signalling fences. This prepares the code for incoming dma-fence API changes which will start asserting these accesses are done from a RCU locked section. Now that the safe access is handled in the dma-fence API, the external callers such as sync_file, and our internal code paths, we can drop the similar protection from i915_fence_get_timeline_name(). This prepares the code for incoming dma-fence API changes which will start asserting these accesses are done from a RCU locked section. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> # v1 Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net> Link: https://lore.kernel.org/r/20250610164226.10817-3-tvrtko.ursulin@igalia.com
This commit is contained in:
committed by
Tvrtko Ursulin
parent
ad10976d6c
commit
4d2f8bc628
@@ -250,11 +250,17 @@ void intel_gt_watchdog_work(struct work_struct *work)
|
||||
llist_for_each_entry_safe(rq, rn, first, watchdog.link) {
|
||||
if (!i915_request_completed(rq)) {
|
||||
struct dma_fence *f = &rq->fence;
|
||||
const char __rcu *timeline;
|
||||
const char __rcu *driver;
|
||||
|
||||
rcu_read_lock();
|
||||
driver = dma_fence_driver_name(f);
|
||||
timeline = dma_fence_timeline_name(f);
|
||||
pr_notice("Fence expiration time out i915-%s:%s:%llx!\n",
|
||||
dma_fence_driver_name(f),
|
||||
dma_fence_timeline_name(f),
|
||||
rcu_dereference(driver),
|
||||
rcu_dereference(timeline),
|
||||
f->seqno);
|
||||
rcu_read_unlock();
|
||||
i915_request_cancel(rq, -EINTR);
|
||||
}
|
||||
i915_request_put(rq);
|
||||
|
||||
@@ -2184,7 +2184,7 @@ 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);
|
||||
const char __rcu *timeline;
|
||||
char buf[80] = "";
|
||||
int x = 0;
|
||||
|
||||
@@ -2220,6 +2220,8 @@ void i915_request_show(struct drm_printer *m,
|
||||
|
||||
x = print_sched_attr(&rq->sched.attr, buf, x, sizeof(buf));
|
||||
|
||||
rcu_read_lock();
|
||||
timeline = dma_fence_timeline_name((struct dma_fence *)&rq->fence);
|
||||
drm_printf(m, "%s%.*s%c %llx:%lld%s%s %s @ %dms: %s\n",
|
||||
prefix, indent, " ",
|
||||
queue_status(rq),
|
||||
@@ -2228,7 +2230,8 @@ void i915_request_show(struct drm_printer *m,
|
||||
fence_status(rq),
|
||||
buf,
|
||||
jiffies_to_msecs(jiffies - rq->emitted_jiffies),
|
||||
name);
|
||||
rcu_dereference(timeline));
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
static bool engine_match_ring(struct intel_engine_cs *engine, struct i915_request *rq)
|
||||
|
||||
@@ -430,16 +430,22 @@ static void timer_i915_sw_fence_wake(struct timer_list *t)
|
||||
struct i915_sw_dma_fence_cb_timer *cb = timer_container_of(cb, t,
|
||||
timer);
|
||||
struct i915_sw_fence *fence;
|
||||
const char __rcu *timeline;
|
||||
const char __rcu *driver;
|
||||
|
||||
fence = xchg(&cb->base.fence, NULL);
|
||||
if (!fence)
|
||||
return;
|
||||
|
||||
rcu_read_lock();
|
||||
driver = dma_fence_driver_name(cb->dma);
|
||||
timeline = dma_fence_timeline_name(cb->dma);
|
||||
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),
|
||||
rcu_dereference(driver),
|
||||
rcu_dereference(timeline),
|
||||
cb->dma->seqno,
|
||||
i915_sw_fence_debug_hint(fence));
|
||||
rcu_read_unlock();
|
||||
|
||||
i915_sw_fence_set_error_once(fence, -ETIMEDOUT);
|
||||
i915_sw_fence_complete(fence);
|
||||
|
||||
Reference in New Issue
Block a user