dma_buf.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM dma_buf
  4. #if !defined(_TRACE_DMA_BUF_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_DMA_BUF_H
  6. #include <linux/dma-buf.h>
  7. #include <linux/tracepoint.h>
  8. DECLARE_EVENT_CLASS(dma_buf,
  9. TP_PROTO(struct dma_buf *dmabuf),
  10. TP_ARGS(dmabuf),
  11. TP_STRUCT__entry(
  12. __string( exp_name, dmabuf->exp_name)
  13. __field( size_t, size)
  14. __field( ino_t, ino)
  15. ),
  16. TP_fast_assign(
  17. __assign_str(exp_name);
  18. __entry->size = dmabuf->size;
  19. __entry->ino = dmabuf->file->f_inode->i_ino;
  20. ),
  21. TP_printk("exp_name=%s size=%zu ino=%lu",
  22. __get_str(exp_name),
  23. __entry->size,
  24. __entry->ino)
  25. );
  26. DECLARE_EVENT_CLASS(dma_buf_attach_dev,
  27. TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach,
  28. bool is_dynamic, struct device *dev),
  29. TP_ARGS(dmabuf, attach, is_dynamic, dev),
  30. TP_STRUCT__entry(
  31. __string( dev_name, dev_name(dev))
  32. __string( exp_name, dmabuf->exp_name)
  33. __field( size_t, size)
  34. __field( ino_t, ino)
  35. __field( struct dma_buf_attachment *, attach)
  36. __field( bool, is_dynamic)
  37. ),
  38. TP_fast_assign(
  39. __assign_str(dev_name);
  40. __assign_str(exp_name);
  41. __entry->size = dmabuf->size;
  42. __entry->ino = dmabuf->file->f_inode->i_ino;
  43. __entry->is_dynamic = is_dynamic;
  44. __entry->attach = attach;
  45. ),
  46. TP_printk("exp_name=%s size=%zu ino=%lu attachment:%p is_dynamic=%d dev_name=%s",
  47. __get_str(exp_name),
  48. __entry->size,
  49. __entry->ino,
  50. __entry->attach,
  51. __entry->is_dynamic,
  52. __get_str(dev_name))
  53. );
  54. DECLARE_EVENT_CLASS(dma_buf_fd,
  55. TP_PROTO(struct dma_buf *dmabuf, int fd),
  56. TP_ARGS(dmabuf, fd),
  57. TP_STRUCT__entry(
  58. __string( exp_name, dmabuf->exp_name)
  59. __field( size_t, size)
  60. __field( ino_t, ino)
  61. __field( int, fd)
  62. ),
  63. TP_fast_assign(
  64. __assign_str(exp_name);
  65. __entry->size = dmabuf->size;
  66. __entry->ino = dmabuf->file->f_inode->i_ino;
  67. __entry->fd = fd;
  68. ),
  69. TP_printk("exp_name=%s size=%zu ino=%lu fd=%d",
  70. __get_str(exp_name),
  71. __entry->size,
  72. __entry->ino,
  73. __entry->fd)
  74. );
  75. DEFINE_EVENT(dma_buf, dma_buf_export,
  76. TP_PROTO(struct dma_buf *dmabuf),
  77. TP_ARGS(dmabuf)
  78. );
  79. DEFINE_EVENT(dma_buf, dma_buf_mmap_internal,
  80. TP_PROTO(struct dma_buf *dmabuf),
  81. TP_ARGS(dmabuf)
  82. );
  83. DEFINE_EVENT(dma_buf, dma_buf_mmap,
  84. TP_PROTO(struct dma_buf *dmabuf),
  85. TP_ARGS(dmabuf)
  86. );
  87. DEFINE_EVENT(dma_buf, dma_buf_put,
  88. TP_PROTO(struct dma_buf *dmabuf),
  89. TP_ARGS(dmabuf)
  90. );
  91. DEFINE_EVENT(dma_buf_attach_dev, dma_buf_dynamic_attach,
  92. TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach,
  93. bool is_dynamic, struct device *dev),
  94. TP_ARGS(dmabuf, attach, is_dynamic, dev)
  95. );
  96. DEFINE_EVENT(dma_buf_attach_dev, dma_buf_detach,
  97. TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach,
  98. bool is_dynamic, struct device *dev),
  99. TP_ARGS(dmabuf, attach, is_dynamic, dev)
  100. );
  101. DEFINE_EVENT_CONDITION(dma_buf_fd, dma_buf_fd,
  102. TP_PROTO(struct dma_buf *dmabuf, int fd),
  103. TP_ARGS(dmabuf, fd),
  104. TP_CONDITION(fd >= 0)
  105. );
  106. DEFINE_EVENT(dma_buf_fd, dma_buf_get,
  107. TP_PROTO(struct dma_buf *dmabuf, int fd),
  108. TP_ARGS(dmabuf, fd)
  109. );
  110. #endif /* _TRACE_DMA_BUF_H */
  111. /* This part must be outside protection */
  112. #include <trace/define_trace.h>