Home | History | Annotate | Line # | Download | only in scheduler
      1  1.1  riastrad /*	$NetBSD: gpu_scheduler_trace.h,v 1.2 2021/12/18 23:45:43 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2017 Advanced Micro Devices, Inc.
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     14  1.1  riastrad  * all copies or substantial portions of the Software.
     15  1.1  riastrad  *
     16  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  1.1  riastrad  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  1.1  riastrad  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  1.1  riastrad  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  1.1  riastrad  * OTHER DEALINGS IN THE SOFTWARE.
     23  1.1  riastrad  *
     24  1.1  riastrad  */
     25  1.1  riastrad 
     26  1.1  riastrad #if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
     27  1.1  riastrad #define _GPU_SCHED_TRACE_H_
     28  1.1  riastrad 
     29  1.1  riastrad #include <linux/stringify.h>
     30  1.1  riastrad #include <linux/types.h>
     31  1.1  riastrad #include <linux/tracepoint.h>
     32  1.1  riastrad 
     33  1.1  riastrad #undef TRACE_SYSTEM
     34  1.1  riastrad #define TRACE_SYSTEM gpu_scheduler
     35  1.1  riastrad #define TRACE_INCLUDE_FILE gpu_scheduler_trace
     36  1.1  riastrad 
     37  1.1  riastrad TRACE_EVENT(drm_sched_job,
     38  1.1  riastrad 	    TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
     39  1.1  riastrad 	    TP_ARGS(sched_job, entity),
     40  1.1  riastrad 	    TP_STRUCT__entry(
     41  1.1  riastrad 			     __field(struct drm_sched_entity *, entity)
     42  1.1  riastrad 			     __field(struct dma_fence *, fence)
     43  1.1  riastrad 			     __field(const char *, name)
     44  1.1  riastrad 			     __field(uint64_t, id)
     45  1.1  riastrad 			     __field(u32, job_count)
     46  1.1  riastrad 			     __field(int, hw_job_count)
     47  1.1  riastrad 			     ),
     48  1.1  riastrad 
     49  1.1  riastrad 	    TP_fast_assign(
     50  1.1  riastrad 			   __entry->entity = entity;
     51  1.1  riastrad 			   __entry->id = sched_job->id;
     52  1.1  riastrad 			   __entry->fence = &sched_job->s_fence->finished;
     53  1.1  riastrad 			   __entry->name = sched_job->sched->name;
     54  1.1  riastrad 			   __entry->job_count = spsc_queue_count(&entity->job_queue);
     55  1.1  riastrad 			   __entry->hw_job_count = atomic_read(
     56  1.1  riastrad 				   &sched_job->sched->hw_rq_count);
     57  1.1  riastrad 			   ),
     58  1.1  riastrad 	    TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d",
     59  1.1  riastrad 		      __entry->entity, __entry->id,
     60  1.1  riastrad 		      __entry->fence, __entry->name,
     61  1.1  riastrad 		      __entry->job_count, __entry->hw_job_count)
     62  1.1  riastrad );
     63  1.1  riastrad 
     64  1.1  riastrad TRACE_EVENT(drm_sched_process_job,
     65  1.1  riastrad 	    TP_PROTO(struct drm_sched_fence *fence),
     66  1.1  riastrad 	    TP_ARGS(fence),
     67  1.1  riastrad 	    TP_STRUCT__entry(
     68  1.1  riastrad 		    __field(struct dma_fence *, fence)
     69  1.1  riastrad 		    ),
     70  1.1  riastrad 
     71  1.1  riastrad 	    TP_fast_assign(
     72  1.1  riastrad 		    __entry->fence = &fence->finished;
     73  1.1  riastrad 		    ),
     74  1.1  riastrad 	    TP_printk("fence=%p signaled", __entry->fence)
     75  1.1  riastrad );
     76  1.1  riastrad 
     77  1.1  riastrad TRACE_EVENT(drm_sched_job_wait_dep,
     78  1.1  riastrad 	    TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence),
     79  1.1  riastrad 	    TP_ARGS(sched_job, fence),
     80  1.1  riastrad 	    TP_STRUCT__entry(
     81  1.1  riastrad 			     __field(const char *,name)
     82  1.1  riastrad 			     __field(uint64_t, id)
     83  1.1  riastrad 			     __field(struct dma_fence *, fence)
     84  1.1  riastrad 			     __field(uint64_t, ctx)
     85  1.1  riastrad 			     __field(unsigned, seqno)
     86  1.1  riastrad 			     ),
     87  1.1  riastrad 
     88  1.1  riastrad 	    TP_fast_assign(
     89  1.1  riastrad 			   __entry->name = sched_job->sched->name;
     90  1.1  riastrad 			   __entry->id = sched_job->id;
     91  1.1  riastrad 			   __entry->fence = fence;
     92  1.1  riastrad 			   __entry->ctx = fence->context;
     93  1.1  riastrad 			   __entry->seqno = fence->seqno;
     94  1.1  riastrad 			   ),
     95  1.1  riastrad 	    TP_printk("job ring=%s, id=%llu, depends fence=%p, context=%llu, seq=%u",
     96  1.1  riastrad 		      __entry->name, __entry->id,
     97  1.1  riastrad 		      __entry->fence, __entry->ctx,
     98  1.1  riastrad 		      __entry->seqno)
     99  1.1  riastrad );
    100  1.1  riastrad 
    101  1.1  riastrad #endif
    102  1.1  riastrad 
    103  1.1  riastrad /* This part must be outside protection */
    104  1.1  riastrad #undef TRACE_INCLUDE_PATH
    105  1.1  riastrad #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/scheduler
    106  1.1  riastrad #include <trace/define_trace.h>
    107