amdgpu_trace.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. #if !defined(_AMDGPU_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  2. #define _AMDGPU_TRACE_H_
  3. #include <linux/stringify.h>
  4. #include <linux/types.h>
  5. #include <linux/tracepoint.h>
  6. #include <drm/drmP.h>
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM amdgpu
  9. #define TRACE_INCLUDE_FILE amdgpu_trace
  10. TRACE_EVENT(amdgpu_bo_create,
  11. TP_PROTO(struct amdgpu_bo *bo),
  12. TP_ARGS(bo),
  13. TP_STRUCT__entry(
  14. __field(struct amdgpu_bo *, bo)
  15. __field(u32, pages)
  16. ),
  17. TP_fast_assign(
  18. __entry->bo = bo;
  19. __entry->pages = bo->tbo.num_pages;
  20. ),
  21. TP_printk("bo=%p, pages=%u", __entry->bo, __entry->pages)
  22. );
  23. TRACE_EVENT(amdgpu_cs,
  24. TP_PROTO(struct amdgpu_cs_parser *p, int i),
  25. TP_ARGS(p, i),
  26. TP_STRUCT__entry(
  27. __field(struct amdgpu_bo_list *, bo_list)
  28. __field(u32, ring)
  29. __field(u32, dw)
  30. __field(u32, fences)
  31. ),
  32. TP_fast_assign(
  33. __entry->bo_list = p->bo_list;
  34. __entry->ring = p->ibs[i].ring->idx;
  35. __entry->dw = p->ibs[i].length_dw;
  36. __entry->fences = amdgpu_fence_count_emitted(
  37. p->ibs[i].ring);
  38. ),
  39. TP_printk("bo_list=%p, ring=%u, dw=%u, fences=%u",
  40. __entry->bo_list, __entry->ring, __entry->dw,
  41. __entry->fences)
  42. );
  43. TRACE_EVENT(amdgpu_cs_ioctl,
  44. TP_PROTO(struct amdgpu_job *job),
  45. TP_ARGS(job),
  46. TP_STRUCT__entry(
  47. __field(struct amdgpu_device *, adev)
  48. __field(struct amd_sched_job *, sched_job)
  49. __field(struct amdgpu_ib *, ib)
  50. __field(struct fence *, fence)
  51. __field(char *, ring_name)
  52. __field(u32, num_ibs)
  53. ),
  54. TP_fast_assign(
  55. __entry->adev = job->adev;
  56. __entry->sched_job = &job->base;
  57. __entry->ib = job->ibs;
  58. __entry->fence = &job->base.s_fence->base;
  59. __entry->ring_name = job->ibs[0].ring->name;
  60. __entry->num_ibs = job->num_ibs;
  61. ),
  62. TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
  63. __entry->adev, __entry->sched_job, __entry->ib,
  64. __entry->fence, __entry->ring_name, __entry->num_ibs)
  65. );
  66. TRACE_EVENT(amdgpu_sched_run_job,
  67. TP_PROTO(struct amdgpu_job *job),
  68. TP_ARGS(job),
  69. TP_STRUCT__entry(
  70. __field(struct amdgpu_device *, adev)
  71. __field(struct amd_sched_job *, sched_job)
  72. __field(struct amdgpu_ib *, ib)
  73. __field(struct fence *, fence)
  74. __field(char *, ring_name)
  75. __field(u32, num_ibs)
  76. ),
  77. TP_fast_assign(
  78. __entry->adev = job->adev;
  79. __entry->sched_job = &job->base;
  80. __entry->ib = job->ibs;
  81. __entry->fence = &job->base.s_fence->base;
  82. __entry->ring_name = job->ibs[0].ring->name;
  83. __entry->num_ibs = job->num_ibs;
  84. ),
  85. TP_printk("adev=%p, sched_job=%p, first ib=%p, sched fence=%p, ring name:%s, num_ibs:%u",
  86. __entry->adev, __entry->sched_job, __entry->ib,
  87. __entry->fence, __entry->ring_name, __entry->num_ibs)
  88. );
  89. TRACE_EVENT(amdgpu_vm_grab_id,
  90. TP_PROTO(unsigned vmid, int ring),
  91. TP_ARGS(vmid, ring),
  92. TP_STRUCT__entry(
  93. __field(u32, vmid)
  94. __field(u32, ring)
  95. ),
  96. TP_fast_assign(
  97. __entry->vmid = vmid;
  98. __entry->ring = ring;
  99. ),
  100. TP_printk("vmid=%u, ring=%u", __entry->vmid, __entry->ring)
  101. );
  102. TRACE_EVENT(amdgpu_vm_bo_map,
  103. TP_PROTO(struct amdgpu_bo_va *bo_va,
  104. struct amdgpu_bo_va_mapping *mapping),
  105. TP_ARGS(bo_va, mapping),
  106. TP_STRUCT__entry(
  107. __field(struct amdgpu_bo *, bo)
  108. __field(long, start)
  109. __field(long, last)
  110. __field(u64, offset)
  111. __field(u32, flags)
  112. ),
  113. TP_fast_assign(
  114. __entry->bo = bo_va->bo;
  115. __entry->start = mapping->it.start;
  116. __entry->last = mapping->it.last;
  117. __entry->offset = mapping->offset;
  118. __entry->flags = mapping->flags;
  119. ),
  120. TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
  121. __entry->bo, __entry->start, __entry->last,
  122. __entry->offset, __entry->flags)
  123. );
  124. TRACE_EVENT(amdgpu_vm_bo_unmap,
  125. TP_PROTO(struct amdgpu_bo_va *bo_va,
  126. struct amdgpu_bo_va_mapping *mapping),
  127. TP_ARGS(bo_va, mapping),
  128. TP_STRUCT__entry(
  129. __field(struct amdgpu_bo *, bo)
  130. __field(long, start)
  131. __field(long, last)
  132. __field(u64, offset)
  133. __field(u32, flags)
  134. ),
  135. TP_fast_assign(
  136. __entry->bo = bo_va->bo;
  137. __entry->start = mapping->it.start;
  138. __entry->last = mapping->it.last;
  139. __entry->offset = mapping->offset;
  140. __entry->flags = mapping->flags;
  141. ),
  142. TP_printk("bo=%p, start=%lx, last=%lx, offset=%010llx, flags=%08x",
  143. __entry->bo, __entry->start, __entry->last,
  144. __entry->offset, __entry->flags)
  145. );
  146. DECLARE_EVENT_CLASS(amdgpu_vm_mapping,
  147. TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
  148. TP_ARGS(mapping),
  149. TP_STRUCT__entry(
  150. __field(u64, soffset)
  151. __field(u64, eoffset)
  152. __field(u32, flags)
  153. ),
  154. TP_fast_assign(
  155. __entry->soffset = mapping->it.start;
  156. __entry->eoffset = mapping->it.last + 1;
  157. __entry->flags = mapping->flags;
  158. ),
  159. TP_printk("soffs=%010llx, eoffs=%010llx, flags=%08x",
  160. __entry->soffset, __entry->eoffset, __entry->flags)
  161. );
  162. DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_update,
  163. TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
  164. TP_ARGS(mapping)
  165. );
  166. DEFINE_EVENT(amdgpu_vm_mapping, amdgpu_vm_bo_mapping,
  167. TP_PROTO(struct amdgpu_bo_va_mapping *mapping),
  168. TP_ARGS(mapping)
  169. );
  170. TRACE_EVENT(amdgpu_vm_set_page,
  171. TP_PROTO(uint64_t pe, uint64_t addr, unsigned count,
  172. uint32_t incr, uint32_t flags),
  173. TP_ARGS(pe, addr, count, incr, flags),
  174. TP_STRUCT__entry(
  175. __field(u64, pe)
  176. __field(u64, addr)
  177. __field(u32, count)
  178. __field(u32, incr)
  179. __field(u32, flags)
  180. ),
  181. TP_fast_assign(
  182. __entry->pe = pe;
  183. __entry->addr = addr;
  184. __entry->count = count;
  185. __entry->incr = incr;
  186. __entry->flags = flags;
  187. ),
  188. TP_printk("pe=%010Lx, addr=%010Lx, incr=%u, flags=%08x, count=%u",
  189. __entry->pe, __entry->addr, __entry->incr,
  190. __entry->flags, __entry->count)
  191. );
  192. TRACE_EVENT(amdgpu_vm_flush,
  193. TP_PROTO(uint64_t pd_addr, unsigned ring, unsigned id),
  194. TP_ARGS(pd_addr, ring, id),
  195. TP_STRUCT__entry(
  196. __field(u64, pd_addr)
  197. __field(u32, ring)
  198. __field(u32, id)
  199. ),
  200. TP_fast_assign(
  201. __entry->pd_addr = pd_addr;
  202. __entry->ring = ring;
  203. __entry->id = id;
  204. ),
  205. TP_printk("pd_addr=%010Lx, ring=%u, id=%u",
  206. __entry->pd_addr, __entry->ring, __entry->id)
  207. );
  208. TRACE_EVENT(amdgpu_bo_list_set,
  209. TP_PROTO(struct amdgpu_bo_list *list, struct amdgpu_bo *bo),
  210. TP_ARGS(list, bo),
  211. TP_STRUCT__entry(
  212. __field(struct amdgpu_bo_list *, list)
  213. __field(struct amdgpu_bo *, bo)
  214. ),
  215. TP_fast_assign(
  216. __entry->list = list;
  217. __entry->bo = bo;
  218. ),
  219. TP_printk("list=%p, bo=%p", __entry->list, __entry->bo)
  220. );
  221. DECLARE_EVENT_CLASS(amdgpu_semaphore_request,
  222. TP_PROTO(int ring, struct amdgpu_semaphore *sem),
  223. TP_ARGS(ring, sem),
  224. TP_STRUCT__entry(
  225. __field(int, ring)
  226. __field(signed, waiters)
  227. __field(uint64_t, gpu_addr)
  228. ),
  229. TP_fast_assign(
  230. __entry->ring = ring;
  231. __entry->waiters = sem->waiters;
  232. __entry->gpu_addr = sem->gpu_addr;
  233. ),
  234. TP_printk("ring=%u, waiters=%d, addr=%010Lx", __entry->ring,
  235. __entry->waiters, __entry->gpu_addr)
  236. );
  237. DEFINE_EVENT(amdgpu_semaphore_request, amdgpu_semaphore_signale,
  238. TP_PROTO(int ring, struct amdgpu_semaphore *sem),
  239. TP_ARGS(ring, sem)
  240. );
  241. DEFINE_EVENT(amdgpu_semaphore_request, amdgpu_semaphore_wait,
  242. TP_PROTO(int ring, struct amdgpu_semaphore *sem),
  243. TP_ARGS(ring, sem)
  244. );
  245. #endif
  246. /* This part must be outside protection */
  247. #undef TRACE_INCLUDE_PATH
  248. #define TRACE_INCLUDE_PATH .
  249. #include <trace/define_trace.h>