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

drm/amdgpu: add command submission workflow tracepoint

OGL needs these tracepoints to investigate performance issue.

Change-Id: I5e58187d061253f7d665dfce8e4e163ba91d3e2b
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>

authored by

Chunming Zhou and committed by
Alex Deucher
7034decf 5f2e816b

+76 -4
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
··· 888 888 ttm_eu_fence_buffer_objects(&parser.ticket, 889 889 &parser.validated, 890 890 &job->base.s_fence->base); 891 - 891 + trace_amdgpu_cs_ioctl(job); 892 892 mutex_unlock(&job->job_lock); 893 893 amdgpu_cs_parser_fini_late(&parser); 894 894 mutex_unlock(&vm->mutex);
+2
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
··· 26 26 #include <linux/sched.h> 27 27 #include <drm/drmP.h> 28 28 #include "amdgpu.h" 29 + #include "amdgpu_trace.h" 29 30 30 31 static struct fence *amdgpu_sched_dependency(struct amd_sched_job *sched_job) 31 32 { ··· 46 45 } 47 46 job = to_amdgpu_job(sched_job); 48 47 mutex_lock(&job->job_lock); 48 + trace_amdgpu_sched_run_job(job); 49 49 r = amdgpu_ib_schedule(job->adev, 50 50 job->num_ibs, 51 51 job->ibs,
+51
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
··· 48 48 __entry->fences) 49 49 ); 50 50 51 + TRACE_EVENT(amdgpu_cs_ioctl, 52 + TP_PROTO(struct amdgpu_job *job), 53 + TP_ARGS(job), 54 + TP_STRUCT__entry( 55 + __field(struct amdgpu_device *, adev) 56 + __field(struct amd_sched_job *, sched_job) 57 + __field(struct amdgpu_ib *, ib) 58 + __field(struct fence *, fence) 59 + __field(char *, ring_name) 60 + __field(u32, num_ibs) 61 + ), 62 + 63 + TP_fast_assign( 64 + __entry->adev = job->adev; 65 + __entry->sched_job = &job->base; 66 + __entry->ib = job->ibs; 67 + __entry->fence = &job->base.s_fence->base; 68 + __entry->ring_name = job->ibs[0].ring->name; 69 + __entry->num_ibs = job->num_ibs; 70 + ), 71 + TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u", 72 + __entry->adev, __entry->sched_job, __entry->ib, 73 + __entry->fence, __entry->ring_name, __entry->num_ibs) 74 + ); 75 + 76 + TRACE_EVENT(amdgpu_sched_run_job, 77 + TP_PROTO(struct amdgpu_job *job), 78 + TP_ARGS(job), 79 + TP_STRUCT__entry( 80 + __field(struct amdgpu_device *, adev) 81 + __field(struct amd_sched_job *, sched_job) 82 + __field(struct amdgpu_ib *, ib) 83 + __field(struct fence *, fence) 84 + __field(char *, ring_name) 85 + __field(u32, num_ibs) 86 + ), 87 + 88 + TP_fast_assign( 89 + __entry->adev = job->adev; 90 + __entry->sched_job = &job->base; 91 + __entry->ib = job->ibs; 92 + __entry->fence = &job->base.s_fence->base; 93 + __entry->ring_name = job->ibs[0].ring->name; 94 + __entry->num_ibs = job->num_ibs; 95 + ), 96 + TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u", 97 + __entry->adev, __entry->sched_job, __entry->ib, 98 + __entry->fence, __entry->ring_name, __entry->num_ibs) 99 + ); 100 + 101 + 51 102 TRACE_EVENT(amdgpu_vm_grab_id, 52 103 TP_PROTO(unsigned vmid, int ring), 53 104 TP_ARGS(vmid, ring),
+21 -3
drivers/gpu/drm/amd/scheduler/gpu_sched_trace.h
··· 16 16 TP_ARGS(sched_job), 17 17 TP_STRUCT__entry( 18 18 __field(struct amd_sched_entity *, entity) 19 + __field(struct amd_sched_job *, sched_job) 20 + __field(struct fence *, fence) 19 21 __field(const char *, name) 20 22 __field(u32, job_count) 21 23 __field(int, hw_job_count) ··· 25 23 26 24 TP_fast_assign( 27 25 __entry->entity = sched_job->s_entity; 26 + __entry->sched_job = sched_job; 27 + __entry->fence = &sched_job->s_fence->base; 28 28 __entry->name = sched_job->sched->name; 29 29 __entry->job_count = kfifo_len( 30 30 &sched_job->s_entity->job_queue) / sizeof(sched_job); 31 31 __entry->hw_job_count = atomic_read( 32 32 &sched_job->sched->hw_rq_count); 33 33 ), 34 - TP_printk("entity=%p, ring=%s, job count:%u, hw job count:%d", 35 - __entry->entity, __entry->name, __entry->job_count, 36 - __entry->hw_job_count) 34 + TP_printk("entity=%p, sched job=%p, fence=%p, ring=%s, job count:%u, hw job count:%d", 35 + __entry->entity, __entry->sched_job, __entry->fence, __entry->name, 36 + __entry->job_count, __entry->hw_job_count) 37 37 ); 38 + 39 + TRACE_EVENT(amd_sched_process_job, 40 + TP_PROTO(struct amd_sched_fence *fence), 41 + TP_ARGS(fence), 42 + TP_STRUCT__entry( 43 + __field(struct fence *, fence) 44 + ), 45 + 46 + TP_fast_assign( 47 + __entry->fence = &fence->base; 48 + ), 49 + TP_printk("fence=%p signaled", __entry->fence) 50 + ); 51 + 38 52 #endif 39 53 40 54 /* This part must be outside protection */
+1
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
··· 346 346 list_del_init(&s_fence->list); 347 347 spin_unlock_irqrestore(&sched->fence_list_lock, flags); 348 348 } 349 + trace_amd_sched_process_job(s_fence); 349 350 fence_put(&s_fence->base); 350 351 wake_up_interruptible(&sched->wake_up_worker); 351 352 }