Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/lima: add trace point for tasks

track lima task start which can be combined with
dma_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

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200307135438.9981-1-yuq825@gmail.com

Qiang Yu 7f60c4b9 57b517ce

+64 -2
+2 -1
drivers/gpu/drm/lima/Makefile
··· 14 14 lima_sched.o \ 15 15 lima_ctx.o \ 16 16 lima_dlbu.o \ 17 - lima_bcast.o 17 + lima_bcast.o \ 18 + lima_trace.o 18 19 19 20 obj-$(CONFIG_DRM_LIMA) += lima.o
+4 -1
drivers/gpu/drm/lima/lima_sched.c
··· 3 3 4 4 #include <linux/kthread.h> 5 5 #include <linux/slab.h> 6 - #include <linux/xarray.h> 7 6 #include <linux/vmalloc.h> 8 7 9 8 #include "lima_drv.h" ··· 11 12 #include "lima_mmu.h" 12 13 #include "lima_l2_cache.h" 13 14 #include "lima_gem.h" 15 + #include "lima_trace.h" 14 16 15 17 struct lima_fence { 16 18 struct dma_fence base; ··· 177 177 { 178 178 struct dma_fence *fence = dma_fence_get(&task->base.s_fence->finished); 179 179 180 + trace_lima_task_submit(task); 180 181 drm_sched_entity_push_job(&task->base, &context->base); 181 182 return fence; 182 183 } ··· 251 250 252 251 if (last_vm) 253 252 lima_vm_put(last_vm); 253 + 254 + trace_lima_task_run(task); 254 255 255 256 pipe->error = false; 256 257 pipe->task_run(pipe, task);
+1
drivers/gpu/drm/lima/lima_sched.h
··· 6 6 7 7 #include <drm/gpu_scheduler.h> 8 8 #include <linux/list.h> 9 + #include <linux/xarray.h> 9 10 10 11 struct lima_vm; 11 12
+7
drivers/gpu/drm/lima/lima_trace.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 OR MIT 2 + /* Copyright 2020 Qiang Yu <yuq825@gmail.com> */ 3 + 4 + #include "lima_sched.h" 5 + 6 + #define CREATE_TRACE_POINTS 7 + #include "lima_trace.h"
+50
drivers/gpu/drm/lima/lima_trace.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 OR MIT */ 2 + /* Copyright 2020 Qiang Yu <yuq825@gmail.com> */ 3 + 4 + #if !defined(_LIMA_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 5 + #define _LIMA_TRACE_H_ 6 + 7 + #include <linux/tracepoint.h> 8 + 9 + #undef TRACE_SYSTEM 10 + #define TRACE_SYSTEM lima 11 + #define TRACE_INCLUDE_FILE lima_trace 12 + 13 + DECLARE_EVENT_CLASS(lima_task, 14 + TP_PROTO(struct lima_sched_task *task), 15 + TP_ARGS(task), 16 + TP_STRUCT__entry( 17 + __field(uint64_t, task_id) 18 + __field(unsigned int, context) 19 + __field(unsigned int, seqno) 20 + __string(pipe, task->base.sched->name) 21 + ), 22 + 23 + TP_fast_assign( 24 + __entry->task_id = task->base.id; 25 + __entry->context = task->base.s_fence->finished.context; 26 + __entry->seqno = task->base.s_fence->finished.seqno; 27 + __assign_str(pipe, task->base.sched->name) 28 + ), 29 + 30 + TP_printk("task=%llu, context=%u seqno=%u pipe=%s", 31 + __entry->task_id, __entry->context, __entry->seqno, 32 + __get_str(pipe)) 33 + ); 34 + 35 + DEFINE_EVENT(lima_task, lima_task_submit, 36 + TP_PROTO(struct lima_sched_task *task), 37 + TP_ARGS(task) 38 + ); 39 + 40 + DEFINE_EVENT(lima_task, lima_task_run, 41 + TP_PROTO(struct lima_sched_task *task), 42 + TP_ARGS(task) 43 + ); 44 + 45 + #endif 46 + 47 + /* This part must be outside protection */ 48 + #undef TRACE_INCLUDE_PATH 49 + #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/lima 50 + #include <trace/define_trace.h>