[PATCH 22/25] dept: Apply Dept to dma fence's default wait and wakeup

Gwan-gyeong Mun gwan-gyeong.mun at intel.com
Thu Nov 3 05:42:39 UTC 2022


From: Byungchul Park <byungchul.park at lge.com>

Makes Dept able to track dma fence things. Let's start with applying to
default wait and default wait callback(wakeup).

Signed-off-by: Byungchul Park <byungchul.park at lge.com>
Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>
---
 drivers/dma-buf/dma-fence.c | 4 ++++
 include/linux/dma-fence.h   | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 406b4e26f538..e832967c261d 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -16,6 +16,7 @@
 #include <linux/dma-fence.h>
 #include <linux/sched/signal.h>
 #include <linux/seq_file.h>
+#include <linux/dept_sdt.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/dma_fence.h>
@@ -741,6 +742,7 @@ dma_fence_default_wait_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
 	struct default_wait_cb *wait =
 		container_of(cb, struct default_wait_cb, base);
 
+	sdt_event(&fence->dmap);
 	wake_up_state(wait->task, TASK_NORMAL);
 }
 
@@ -789,6 +791,7 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
 			__set_current_state(TASK_UNINTERRUPTIBLE);
 		spin_unlock_irqrestore(fence->lock, flags);
 
+		sdt_wait(&fence->dmap);
 		ret = schedule_timeout(ret);
 
 		spin_lock_irqsave(fence->lock, flags);
@@ -950,6 +953,7 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
 	BUG_ON(!lock);
 	BUG_ON(!ops || !ops->get_driver_name || !ops->get_timeline_name);
 
+	sdt_map_init(&fence->dmap);
 	kref_init(&fence->refcount);
 	fence->ops = ops;
 	INIT_LIST_HEAD(&fence->cb_list);
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 775cdc0b4f24..591f381da465 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -21,6 +21,7 @@
 #include <linux/sched.h>
 #include <linux/printk.h>
 #include <linux/rcupdate.h>
+#include <linux/dept.h>
 
 struct dma_fence;
 struct dma_fence_ops;
@@ -93,6 +94,7 @@ struct dma_fence {
 	unsigned long flags;
 	struct kref refcount;
 	int error;
+	struct dept_map dmap;
 };
 
 enum dma_fence_flag_bits {
-- 
2.37.1



More information about the Intel-gfx-trybot mailing list