Until the switch from kthread to workqueue, a userspace application could
determine the device index from the pid of the thread sending this event.

With workqueues this is not possible anymore, so the event needs to contain
this information (the ring name alone is not enough, because they're not
unique).

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-pra...@amd.com>
---
 drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h 
b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h
index c75302ca3427..0a19c121bda5 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h
@@ -28,6 +28,9 @@
 #include <linux/types.h>
 #include <linux/tracepoint.h>
 
+#include "drm/drm_device.h"
+#include "drm/drm_file.h"
+
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM gpu_scheduler
 #define TRACE_INCLUDE_FILE gpu_scheduler_trace
@@ -42,6 +45,7 @@ DECLARE_EVENT_CLASS(drm_sched_job,
                             __field(uint64_t, id)
                             __field(u32, job_count)
                             __field(int, hw_job_count)
+                            __field(int, dev_index)
                             ),
 
            TP_fast_assign(
@@ -52,6 +56,7 @@ DECLARE_EVENT_CLASS(drm_sched_job,
                           __entry->job_count = 
spsc_queue_count(&entity->job_queue);
                           __entry->hw_job_count = atomic_read(
                                   &sched_job->sched->credit_count);
+                          __entry->dev_index = 
sched_job->sched->dev->primary->index;
                           ),
            TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw 
job count:%d",
                      __entry->entity, __entry->id,
@@ -64,9 +69,13 @@ DEFINE_EVENT(drm_sched_job, drm_sched_job,
            TP_ARGS(sched_job, entity)
 );
 
-DEFINE_EVENT(drm_sched_job, drm_run_job,
+DEFINE_EVENT_PRINT(drm_sched_job, drm_run_job,
            TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity 
*entity),
-           TP_ARGS(sched_job, entity)
+           TP_ARGS(sched_job, entity),
+           TP_printk("dev_index=%d entity=%p id=%llu, fence=%p, ring=%s, job 
count:%u, hw job count:%d",
+                     __entry->dev_index, __entry->entity, __entry->id,
+                     __entry->fence, __get_str(name),
+                     __entry->job_count, __entry->hw_job_count)
 );
 
 TRACE_EVENT(drm_sched_process_job,
-- 
2.40.1

Reply via email to