[CI 10/11] trace
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Wed Feb 15 14:57:59 UTC 2023
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
drivers/dma-buf/dma-fence.c | 14 ++++++++++++++
drivers/gpu/drm/i915/i915_active.c | 8 ++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index bdba5a8e21b1..d961460944f6 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -350,6 +350,7 @@ static void incr_wait_count(struct dma_fence *fence, struct dma_fence_cb *cb)
__set_bit(DMA_FENCE_CB_FLAG_WAITCOUNT_BIT, &cb->flags);
fence->waitcount++;
+ trace_printk(" ++ %llx:%llu -> %u [%p]\n", fence->context, fence->seqno, fence->waitcount, cb);
WARN_ON_ONCE(!fence->waitcount);
}
@@ -357,8 +358,11 @@ static void decr_wait_count(struct dma_fence *fence, struct dma_fence_cb *cb)
{
lockdep_assert_held(fence->lock);
+ trace_printk(" -- %llx:%llu @ %u (%lx]) [%p]\n", fence->context, fence->seqno, fence->waitcount, cb->flags, cb);
if (__test_and_clear_bit(DMA_FENCE_CB_FLAG_WAITCOUNT_BIT, &cb->flags)) {
WARN_ON_ONCE(!fence->waitcount);
+ if (!fence->waitcount)
+ ftrace_dump(DUMP_ALL);
fence->waitcount--;
}
}
@@ -382,6 +386,7 @@ __dma_fence_signal__notify(struct dma_fence *fence,
lockdep_assert_held(fence->lock);
list_for_each_entry_safe(cur, tmp, list, node) {
+ trace_printk(" S %llx:%llu @ %u [%p]\n", fence->context, fence->seqno, fence->waitcount, cur);
decr_wait_count(fence, cur);
INIT_LIST_HEAD(&cur->node);
cur->func(fence, cur);
@@ -571,6 +576,8 @@ void dma_fence_release(struct kref *kref)
trace_dma_fence_destroy(fence);
+ trace_printk(" r %llx:%llu @ %u\n", fence->context, fence->seqno, fence->waitcount);
+
if (WARN(!list_empty(&fence->cb_list) &&
!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags),
"Fence %s:%s:%llx:%llx released with pending signals!\n",
@@ -608,6 +615,7 @@ EXPORT_SYMBOL(dma_fence_release);
*/
void dma_fence_free(struct dma_fence *fence)
{
+ trace_printk(" f %llx:%llu @ %u\n", fence->context, fence->seqno, fence->waitcount);
kfree_rcu(fence, rcu);
}
EXPORT_SYMBOL(dma_fence_free);
@@ -676,8 +684,10 @@ static int add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,
incr_wait_count(fence, cb);
if (__dma_fence_enable_signaling(fence)) {
+ trace_printk(" A %llx:%llu @ %u [%p]\n", fence->context, fence->seqno, fence->waitcount, cb);
list_add_tail(&cb->node, &fence->cb_list);
} else {
+ trace_printk(" a- %llx:%llu @ %u [%p]\n", fence->context, fence->seqno, fence->waitcount, cb);
decr_wait_count(fence, cb);
ret = -ENOENT;
}
@@ -777,6 +787,7 @@ dma_fence_remove_callback(struct dma_fence *fence, struct dma_fence_cb *cb)
ret = !list_empty(&cb->node);
if (ret) {
+ trace_printk(" R %llx:%llu @ %u [%p]\n", fence->context, fence->seqno, fence->waitcount, cb);
decr_wait_count(fence, cb);
list_del_init(&cb->node);
}
@@ -837,6 +848,7 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
__dma_fence_cb_init(&cb.base, dma_fence_default_wait_cb);
cb.task = current;
+ trace_printk(" W %llx:%llu @ %u [%p]\n", fence->context, fence->seqno, fence->waitcount, &cb.base);
incr_wait_count(fence, &cb.base);
list_add(&cb.base.node, &fence->cb_list);
@@ -1020,6 +1032,8 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
fence->waitcount = 0;
fence->error = 0;
+ trace_printk(" I %llx:%llu @ %u\n", fence->context, fence->seqno, fence->waitcount);
+
trace_dma_fence_init(fence);
}
EXPORT_SYMBOL(dma_fence_init);
diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index a9483aadb0ff..0ac530bdd6bb 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -1003,8 +1003,12 @@ void i915_request_add_active_barriers(struct i915_request *rq)
*/
spin_lock_irqsave(&rq->lock, flags);
llist_for_each_safe(node, next, node) {
+ struct active_node *active_node = barrier_from_ll(node);
+
/* serialise with reuse_idle_barrier */
smp_store_mb(*ll_to_fence_slot(node), &rq->fence);
+ trace_printk(" Ab %llx:%llu @ %u [%p] (i915) (%lx)\n",
+ rq->fence.context, rq->fence.seqno, rq->fence.waitcount, &active_node->base.cb, active_node->base.cb.flags);
list_add_tail((struct list_head *)node, &rq->fence.cb_list);
}
spin_unlock_irqrestore(&rq->lock, flags);
@@ -1060,8 +1064,12 @@ __i915_active_fence_set(struct i915_active_fence *active,
GEM_BUG_ON(prev == fence);
spin_lock_nested(prev->lock, SINGLE_DEPTH_NESTING);
__list_del_entry(&active->cb.node);
+ trace_printk(" x %llx:%llu @ %u [%p] (i915) (%lx)\n",
+ prev->context, prev->seqno, prev->waitcount, &active->cb, active->cb.flags);
spin_unlock(prev->lock); /* serialise with prev->cb_list */
}
+ trace_printk(" X %llx:%llu @ %u [%p] (i915) (%lx)\n",
+ fence->context, fence->seqno, fence->waitcount, &active->cb, active->cb.flags);
list_add_tail(&active->cb.node, &fence->cb_list);
spin_unlock_irqrestore(fence->lock, flags);
--
2.34.1
More information about the Intel-gfx-trybot
mailing list