gpu_scheduler_trace.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. #if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  24. #define _GPU_SCHED_TRACE_H_
  25. #include <linux/stringify.h>
  26. #include <linux/types.h>
  27. #include <linux/tracepoint.h>
  28. #undef TRACE_SYSTEM
  29. #define TRACE_SYSTEM gpu_scheduler
  30. #define TRACE_INCLUDE_FILE gpu_scheduler_trace
  31. TRACE_EVENT(drm_sched_job,
  32. TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
  33. TP_ARGS(sched_job, entity),
  34. TP_STRUCT__entry(
  35. __field(struct drm_sched_entity *, entity)
  36. __field(struct dma_fence *, fence)
  37. __field(const char *, name)
  38. __field(uint64_t, id)
  39. __field(u32, job_count)
  40. __field(int, hw_job_count)
  41. ),
  42. TP_fast_assign(
  43. __entry->entity = entity;
  44. __entry->id = sched_job->id;
  45. __entry->fence = &sched_job->s_fence->finished;
  46. __entry->name = sched_job->sched->name;
  47. __entry->job_count = spsc_queue_count(&entity->job_queue);
  48. __entry->hw_job_count = atomic_read(
  49. &sched_job->sched->hw_rq_count);
  50. ),
  51. TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d",
  52. __entry->entity, __entry->id,
  53. __entry->fence, __entry->name,
  54. __entry->job_count, __entry->hw_job_count)
  55. );
  56. TRACE_EVENT(drm_run_job,
  57. TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
  58. TP_ARGS(sched_job, entity),
  59. TP_STRUCT__entry(
  60. __field(struct drm_sched_entity *, entity)
  61. __field(struct dma_fence *, fence)
  62. __field(const char *, name)
  63. __field(uint64_t, id)
  64. __field(u32, job_count)
  65. __field(int, hw_job_count)
  66. ),
  67. TP_fast_assign(
  68. __entry->entity = entity;
  69. __entry->id = sched_job->id;
  70. __entry->fence = &sched_job->s_fence->finished;
  71. __entry->name = sched_job->sched->name;
  72. __entry->job_count = spsc_queue_count(&entity->job_queue);
  73. __entry->hw_job_count = atomic_read(
  74. &sched_job->sched->hw_rq_count);
  75. ),
  76. TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d",
  77. __entry->entity, __entry->id,
  78. __entry->fence, __entry->name,
  79. __entry->job_count, __entry->hw_job_count)
  80. );
  81. TRACE_EVENT(drm_sched_process_job,
  82. TP_PROTO(struct drm_sched_fence *fence),
  83. TP_ARGS(fence),
  84. TP_STRUCT__entry(
  85. __field(struct dma_fence *, fence)
  86. ),
  87. TP_fast_assign(
  88. __entry->fence = &fence->finished;
  89. ),
  90. TP_printk("fence=%p signaled", __entry->fence)
  91. );
  92. TRACE_EVENT(drm_sched_job_wait_dep,
  93. TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence),
  94. TP_ARGS(sched_job, fence),
  95. TP_STRUCT__entry(
  96. __field(const char *,name)
  97. __field(uint64_t, id)
  98. __field(struct dma_fence *, fence)
  99. __field(uint64_t, ctx)
  100. __field(unsigned, seqno)
  101. ),
  102. TP_fast_assign(
  103. __entry->name = sched_job->sched->name;
  104. __entry->id = sched_job->id;
  105. __entry->fence = fence;
  106. __entry->ctx = fence->context;
  107. __entry->seqno = fence->seqno;
  108. ),
  109. TP_printk("job ring=%s, id=%llu, depends fence=%p, context=%llu, seq=%u",
  110. __entry->name, __entry->id,
  111. __entry->fence, __entry->ctx,
  112. __entry->seqno)
  113. );
  114. #endif
  115. /* This part must be outside protection */
  116. #undef TRACE_INCLUDE_PATH
  117. #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/scheduler
  118. #include <trace/define_trace.h>