drm/lima: add trace point for tasks
Subsystems (3)
Qiang Yu
maintainerPATCH 1/1 drm/lima: add trace point for tasks
track lima task start which can be combined withdma_fence_signal to identify task execution time.
example command to record:
trace-cmd record -i \
-e "lima:lima_task_submit" -e "lima:lima_task_run" \
-e "*fence:*fence_signaled" -e "drm:drm_vblank_event" \
-e "drm:drm_vblank_event_queued" sleep 4
--- drivers/gpu/drm/lima/Makefile | 3 +- drivers/gpu/drm/lima/lima_sched.c | 5 +++- drivers/gpu/drm/lima/lima_sched.h | 1 + drivers/gpu/drm/lima/lima_trace.c | 7 +++++ drivers/gpu/drm/lima/lima_trace.h | 50 +++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/lima/lima_trace.c create mode 100644 drivers/gpu/drm/lima/lima_trace.h
drivers/gpu/drm/lima/Makefile +2 -1
@@ -14,6 +14,7 @@ lima-y := \ lima_sched.o \ lima_ctx.o \ lima_dlbu.o \ - lima_bcast.o + lima_bcast.o \ + lima_trace.o obj-$(CONFIG_DRM_LIMA) += lima.o
drivers/gpu/drm/lima/lima_sched.c +4 -1
@@ -3,7 +3,6 @@#include <linux/kthread.h> #include <linux/slab.h> -#include <linux/xarray.h> #include <linux/vmalloc.h> #include "lima_drv.h"
@@ -12,6 +11,7 @@#include "lima_mmu.h" #include "lima_l2_cache.h" #include "lima_gem.h" +#include "lima_trace.h" struct lima_fence {struct dma_fence base;
@@ -177,6 +177,7 @@ struct dma_fence *lima_sched_context_queue_task(struct lima_sched_context *conte {struct dma_fence *fence =dma_fence_get (&task->base.s_fence->finished); +trace_lima_task_submit (task);drm_sched_entity_push_job (&task->base, &context->base);return fence; }
@@ -251,6 +252,8 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job)if (last_vm)lima_vm_put (last_vm); +trace_lima_task_run (task); + pipe->error = false; pipe->task_run (pipe, task);
drivers/gpu/drm/lima/lima_sched.h +1 -0
@@ -6,6 +6,7 @@#include <drm/gpu_scheduler.h> #include <linux/list.h> +#include <linux/xarray.h> struct lima_vm ;
drivers/gpu/drm/lima/lima_trace.c new file +7 -0
@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* Copyright 2020 Qiang Yu <[email protected]> */ + +#include "lima_sched.h" + +#define CREATE_TRACE_POINTS +#include "lima_trace.h"
drivers/gpu/drm/lima/lima_trace.h new file +50 -0
50 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Qiang Yu
track lima task start which can be combined with
dma_fence_signalto identify task execution time.example command to record:
trace-cmd record -i \
-e "lima:lima_task_submit" -e "lima:lima_task_run" \
-e "*fence:*fence_signaled" -e "drm:drm_vblank_event" \
-e "drm:drm_vblank_event_queued" sleep 4
LGTM. Out of curiosity, is there any reason for not adding one more event for task completion?
Quoted 143 lines
Signed-off-by Qiang Yu <[email protected]>--- drivers/gpu/drm/lima/Makefile | 3 +- drivers/gpu/drm/lima/lima_sched.c | 5 +++- drivers/gpu/drm/lima/lima_sched.h | 1 + drivers/gpu/drm/lima/lima_trace.c | 7 +++++ drivers/gpu/drm/lima/lima_trace.h | 50 +++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/lima/lima_trace.c create mode 100644 drivers/gpu/drm/lima/lima_trace.hdrivers/gpu/drm/lima/Makefile +2
-1@@ -14,6 +14,7 @@ lima-y := \ lima_sched.o \ lima_ctx.o \ lima_dlbu.o \ - lima_bcast.o + lima_bcast.o \ + lima_trace.o obj-$(CONFIG_DRM_LIMA) += lima.odrivers/gpu/drm/lima/lima_sched.c +4
-1@@ -3,7 +3,6 @@#include <linux/kthread.h> #include <linux/slab.h> -#include <linux/xarray.h> #include <linux/vmalloc.h> #include "lima_drv.h" @@ -12,6 +11,7 @@#include "lima_mmu.h" #include "lima_l2_cache.h" #include "lima_gem.h" +#include "lima_trace.h" struct lima_fence {struct dma_fence base;@@ -177,6 +177,7 @@ struct dma_fence *lima_sched_context_queue_task(struct lima_sched_context *conte {struct dma_fence *fence =dma_fence_get (&task->base.s_fence->finished); +trace_lima_task_submit (task);drm_sched_entity_push_job (&task->base, &context->base);return fence; }@@ -251,6 +252,8 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job)if (last_vm)lima_vm_put (last_vm); +trace_lima_task_run (task); + pipe->error = false; pipe->task_run (pipe, task);drivers/gpu/drm/lima/lima_sched.h +1
-0@@ -6,6 +6,7 @@#include <drm/gpu_scheduler.h> #include <linux/list.h> +#include <linux/xarray.h> struct lima_vm ;drivers/gpu/drm/lima/lima_trace.c new file +7
-0@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* Copyright 2020 Qiang Yu <[email protected]> */ + +#include "lima_sched.h" + +#define CREATE_TRACE_POINTS +#include "lima_trace.h" drivers/gpu/drm/lima/lima_trace.h new file +50
-1@@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* Copyright 2020 Qiang Yu <[email protected]> */ + +#if !defined(_LIMA_TRACE_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _LIMA_TRACE_H_ + +#include <linux/tracepoint.h> + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM lima +#define TRACE_INCLUDE_FILE lima_trace + +DECLARE_EVENT_CLASS (lima_task, + TP_PROTO(struct lima_sched_task *task), +TP_ARGS (task), +TP_STRUCT__entry ( + __field(uint64_t, task_id) + __field(unsigned int, context) + __field(unsigned int, seqno) +__string (pipe, task->base.sched->name) + ), + +TP_fast_assign ( + __entry->task_id = task->base.id; + __entry->context = task->base.s_fence->finished.context; + __entry->seqno = task->base.s_fence->finished.seqno; +__assign_str (pipe, task->base.sched->name) + ), + +TP_printk ("task=%llu, context=%u seqno=%u pipe=%s" , + __entry->task_id, __entry->context, __entry->seqno, +__get_str (pipe)) +); + +DEFINE_EVENT (lima_task, lima_task_submit, + TP_PROTO(struct lima_sched_task *task), +TP_ARGS (task) +); + +DEFINE_EVENT (lima_task, lima_task_run, + TP_PROTO(struct lima_sched_task *task), +TP_ARGS (task) +); + +#endif + +/* This part must be outside protection */ +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/lima +#include <trace/define_trace.h> --
Quoted 2 lines
2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Qiang Yu
maintainerQuoted 8 lines · Vasily Khoruzhick
Quoted 6 lines · Qiang Yu
track lima task start which can be combined with
dma_fence_signalto identify task execution time.example command to record:
Quoted 7 lines
Quoted 4 lines
trace-cmd record -i \
-e "lima:lima_task_submit" -e "lima:lima_task_run" \
-e "*fence:*fence_signaled" -e "drm:drm_vblank_event" \
-e "drm:drm_vblank_event_queued" sleep 4LGTM. Out of curiosity, is there any reason for not adding one more event for task completion?
Not concrete reason, as the comment, trace point when dma_fence_signal act as the task completion event, so not add duplicate one.
Regards,
Qiang
Quoted 138 lines
Quoted 138 lines
Signed-off-by Qiang Yu <[email protected]>--- drivers/gpu/drm/lima/Makefile | 3 +- drivers/gpu/drm/lima/lima_sched.c | 5 +++- drivers/gpu/drm/lima/lima_sched.h | 1 + drivers/gpu/drm/lima/lima_trace.c | 7 +++++ drivers/gpu/drm/lima/lima_trace.h | 50 +++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/lima/lima_trace.c create mode 100644 drivers/gpu/drm/lima/lima_trace.hdrivers/gpu/drm/lima/Makefile +2
-1@@ -14,6 +14,7 @@ lima-y := \ lima_sched.o \ lima_ctx.o \ lima_dlbu.o \ - lima_bcast.o + lima_bcast.o \ + lima_trace.o obj-$(CONFIG_DRM_LIMA) += lima.odrivers/gpu/drm/lima/lima_sched.c +4
-1@@ -3,7 +3,6 @@#include <linux/kthread.h> #include <linux/slab.h> -#include <linux/xarray.h> #include <linux/vmalloc.h> #include "lima_drv.h" @@ -12,6 +11,7 @@#include "lima_mmu.h" #include "lima_l2_cache.h" #include "lima_gem.h" +#include "lima_trace.h" struct lima_fence {struct dma_fence base;@@ -177,6 +177,7 @@ struct dma_fence *lima_sched_context_queue_task(struct lima_sched_context *conte {struct dma_fence *fence =dma_fence_get (&task->base.s_fence->finished); +trace_lima_task_submit (task);drm_sched_entity_push_job (&task->base, &context->base);return fence; }@@ -251,6 +252,8 @@ static struct dma_fence *lima_sched_run_job(struct drm_sched_job *job)if (last_vm)lima_vm_put (last_vm); +trace_lima_task_run (task); + pipe->error = false; pipe->task_run (pipe, task);drivers/gpu/drm/lima/lima_sched.h +1
-0@@ -6,6 +6,7 @@#include <drm/gpu_scheduler.h> #include <linux/list.h> +#include <linux/xarray.h> struct lima_vm ;drivers/gpu/drm/lima/lima_trace.c new file +7
-0@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* Copyright 2020 Qiang Yu <[email protected]> */ + +#include "lima_sched.h" + +#define CREATE_TRACE_POINTS +#include "lima_trace.h" drivers/gpu/drm/lima/lima_trace.h new file +45
-0@@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* Copyright 2020 Qiang Yu <[email protected]> */ + +#if !defined(_LIMA_TRACE_H) || defined(TRACE_HEADER_MULTI_READ ) +#define _LIMA_TRACE_H_ + +#include <linux/tracepoint.h> + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM lima +#define TRACE_INCLUDE_FILE lima_trace + +DECLARE_EVENT_CLASS (lima_task, + TP_PROTO(struct lima_sched_task *task), +TP_ARGS (task), +TP_STRUCT__entry ( + __field(uint64_t, task_id) + __field(unsigned int, context) + __field(unsigned int, seqno) +__string (pipe, task->base.sched->name) + ), + +TP_fast_assign ( + __entry->task_id = task->base.id; + __entry->context = task->base.s_fence->finished.context; + __entry->seqno = task->base.s_fence->finished.seqno; +__assign_str (pipe, task->base.sched->name) + ), + +TP_printk ("task=%llu, context=%u seqno=%u pipe=%s" , + __entry->task_id, __entry->context, __entry->seqno, +__get_str (pipe)) +); + +DEFINE_EVENT (lima_task, lima_task_submit, + TP_PROTO(struct lima_sched_task *task), +TP_ARGS (task) +); + +DEFINE_EVENT (lima_task, lima_task_run, + TP_PROTO(struct lima_sched_task *task), +TP_ARGS (task) +); + +#endif
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/lima/lima_trace.h new file +5
-1+ +/* This part must be outside protection */ +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/lima +#include <trace/define_trace.h> --2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Vasily Khoruzhick
Reviewed-byQuoted 3 lines · Qiang Yu
Not concrete reason, as the comment, trace point when
dma_fence_signalact as the task completion event, so not add duplicate one.
I see. Patch is:
Regards,
Vasily
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Applied to drm-misc-next.
Regards,
Qiang
Quoted 7 lines · Vasily Khoruzhick
Quoted 3 lines · Qiang Yu
Not concrete reason, as the comment, trace point when
dma_fence_signalact as the task completion event, so not add duplicate one.
Quoted 6 lines
I see. Patch is:
Reviewed-by Vasily Khoruzhick <[email protected]>Regards,
Vasily
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel