Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2017 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  */
0023 
0024 #if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
0025 #define _GPU_SCHED_TRACE_H_
0026 
0027 #include <linux/stringify.h>
0028 #include <linux/types.h>
0029 #include <linux/tracepoint.h>
0030 
0031 #undef TRACE_SYSTEM
0032 #define TRACE_SYSTEM gpu_scheduler
0033 #define TRACE_INCLUDE_FILE gpu_scheduler_trace
0034 
0035 DECLARE_EVENT_CLASS(drm_sched_job,
0036         TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
0037         TP_ARGS(sched_job, entity),
0038         TP_STRUCT__entry(
0039                  __field(struct drm_sched_entity *, entity)
0040                  __field(struct dma_fence *, fence)
0041                  __string(name, sched_job->sched->name)
0042                  __field(uint64_t, id)
0043                  __field(u32, job_count)
0044                  __field(int, hw_job_count)
0045                  ),
0046 
0047         TP_fast_assign(
0048                __entry->entity = entity;
0049                __entry->id = sched_job->id;
0050                __entry->fence = &sched_job->s_fence->finished;
0051                __assign_str(name, sched_job->sched->name);
0052                __entry->job_count = spsc_queue_count(&entity->job_queue);
0053                __entry->hw_job_count = atomic_read(
0054                    &sched_job->sched->hw_rq_count);
0055                ),
0056         TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d",
0057               __entry->entity, __entry->id,
0058               __entry->fence, __get_str(name),
0059               __entry->job_count, __entry->hw_job_count)
0060 );
0061 
0062 DEFINE_EVENT(drm_sched_job, drm_sched_job,
0063         TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
0064         TP_ARGS(sched_job, entity)
0065 );
0066 
0067 DEFINE_EVENT(drm_sched_job, drm_run_job,
0068         TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
0069         TP_ARGS(sched_job, entity)
0070 );
0071 
0072 TRACE_EVENT(drm_sched_process_job,
0073         TP_PROTO(struct drm_sched_fence *fence),
0074         TP_ARGS(fence),
0075         TP_STRUCT__entry(
0076             __field(struct dma_fence *, fence)
0077             ),
0078 
0079         TP_fast_assign(
0080             __entry->fence = &fence->finished;
0081             ),
0082         TP_printk("fence=%p signaled", __entry->fence)
0083 );
0084 
0085 TRACE_EVENT(drm_sched_job_wait_dep,
0086         TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence),
0087         TP_ARGS(sched_job, fence),
0088         TP_STRUCT__entry(
0089                  __string(name, sched_job->sched->name)
0090                  __field(uint64_t, id)
0091                  __field(struct dma_fence *, fence)
0092                  __field(uint64_t, ctx)
0093                  __field(unsigned, seqno)
0094                  ),
0095 
0096         TP_fast_assign(
0097                __assign_str(name, sched_job->sched->name);
0098                __entry->id = sched_job->id;
0099                __entry->fence = fence;
0100                __entry->ctx = fence->context;
0101                __entry->seqno = fence->seqno;
0102                ),
0103         TP_printk("job ring=%s, id=%llu, depends fence=%p, context=%llu, seq=%u",
0104               __get_str(name), __entry->id,
0105               __entry->fence, __entry->ctx,
0106               __entry->seqno)
0107 );
0108 
0109 #endif
0110 
0111 /* This part must be outside protection */
0112 #undef TRACE_INCLUDE_PATH
0113 #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/scheduler
0114 #include <trace/define_trace.h>