gpu_scheduler_trace.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. #include <drm/drmP.h>
  29. #undef TRACE_SYSTEM
  30. #define TRACE_SYSTEM gpu_scheduler
  31. #define TRACE_INCLUDE_FILE gpu_scheduler_trace
  32. TRACE_EVENT(drm_sched_job,
  33. TP_PROTO(struct drm_sched_job *sched_job, struct drm_sched_entity *entity),
  34. TP_ARGS(sched_job, entity),
  35. TP_STRUCT__entry(
  36. __field(struct drm_sched_entity *, entity)
  37. __field(struct dma_fence *, fence)
  38. __field(const char *, name)
  39. __field(uint64_t, id)
  40. __field(u32, job_count)
  41. __field(int, hw_job_count)
  42. ),
  43. TP_fast_assign(
  44. __entry->entity = entity;
  45. __entry->id = sched_job->id;
  46. __entry->fence = &sched_job->s_fence->finished;
  47. __entry->name = sched_job->sched->name;
  48. __entry->job_count = spsc_queue_count(&entity->job_queue);
  49. __entry->hw_job_count = atomic_read(
  50. &sched_job->sched->hw_rq_count);
  51. ),
  52. TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d",
  53. __entry->entity, __entry->id,
  54. __entry->fence, __entry->name,
  55. __entry->job_count, __entry->hw_job_count)
  56. );
  57. TRACE_EVENT(drm_sched_process_job,
  58. TP_PROTO(struct drm_sched_fence *fence),
  59. TP_ARGS(fence),
  60. TP_STRUCT__entry(
  61. __field(struct dma_fence *, fence)
  62. ),
  63. TP_fast_assign(
  64. __entry->fence = &fence->finished;
  65. ),
  66. TP_printk("fence=%p signaled", __entry->fence)
  67. );
  68. TRACE_EVENT(drm_sched_job_wait_dep,
  69. TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence),
  70. TP_ARGS(sched_job, fence),
  71. TP_STRUCT__entry(
  72. __field(const char *,name)
  73. __field(uint64_t, id)
  74. __field(struct dma_fence *, fence)
  75. __field(uint64_t, ctx)
  76. __field(unsigned, seqno)
  77. ),
  78. TP_fast_assign(
  79. __entry->name = sched_job->sched->name;
  80. __entry->id = sched_job->id;
  81. __entry->fence = fence;
  82. __entry->ctx = fence->context;
  83. __entry->seqno = fence->seqno;
  84. ),
  85. TP_printk("job ring=%s, id=%llu, depends fence=%p, context=%llu, seq=%u",
  86. __entry->name, __entry->id,
  87. __entry->fence, __entry->ctx,
  88. __entry->seqno)
  89. );
  90. #endif
  91. /* This part must be outside protection */
  92. #undef TRACE_INCLUDE_PATH
  93. #define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/scheduler
  94. #include <trace/define_trace.h>