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