summaryrefslogtreecommitdiffstats
path: root/include/trace/events/dma_buf.h
blob: 3bb88d05bcc83bf0160ffc62662b64661180bc38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM dma_buf

#if !defined(_TRACE_DMA_BUF_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_DMA_BUF_H

#include <linux/dma-buf.h>
#include <linux/tracepoint.h>

DECLARE_EVENT_CLASS(dma_buf,

	TP_PROTO(struct dma_buf *dmabuf),

	TP_ARGS(dmabuf),

	TP_STRUCT__entry(
		__string(	exp_name,		dmabuf->exp_name)
		__field(	size_t,			size)
		__field(	ino_t,			ino)
	),

	TP_fast_assign(
		__assign_str(exp_name);
		__entry->size	= dmabuf->size;
		__entry->ino	= dmabuf->file->f_inode->i_ino;
	),

	TP_printk("exp_name=%s size=%zu ino=%lu",
		  __get_str(exp_name),
		  __entry->size,
		  __entry->ino)
);

DECLARE_EVENT_CLASS(dma_buf_attach_dev,

	TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach,
		bool is_dynamic, struct device *dev),

	TP_ARGS(dmabuf, attach, is_dynamic, dev),

	TP_STRUCT__entry(
		__string(	dev_name,			dev_name(dev))
		__string(	exp_name,			dmabuf->exp_name)
		__field(	size_t,				size)
		__field(	ino_t,				ino)
		__field(	struct dma_buf_attachment *,	attach)
		__field(	bool,				is_dynamic)
	),

	TP_fast_assign(
		__assign_str(dev_name);
		__assign_str(exp_name);
		__entry->size		= dmabuf->size;
		__entry->ino		= dmabuf->file->f_inode->i_ino;
		__entry->is_dynamic	= is_dynamic;
		__entry->attach		= attach;
	),

	TP_printk("exp_name=%s size=%zu ino=%lu attachment:%p is_dynamic=%d dev_name=%s",
		  __get_str(exp_name),
		  __entry->size,
		  __entry->ino,
		  __entry->attach,
		  __entry->is_dynamic,
		  __get_str(dev_name))
);

DECLARE_EVENT_CLASS(dma_buf_fd,

	TP_PROTO(struct dma_buf *dmabuf, int fd),

	TP_ARGS(dmabuf, fd),

	TP_STRUCT__entry(
		__string(	exp_name,		dmabuf->exp_name)
		__field(	size_t,			size)
		__field(	ino_t,			ino)
		__field(	int,			fd)
	),

	TP_fast_assign(
		__assign_str(exp_name);
		__entry->size	= dmabuf->size;
		__entry->ino	= dmabuf->file->f_inode->i_ino;
		__entry->fd	= fd;
	),

	TP_printk("exp_name=%s size=%zu ino=%lu fd=%d",
		  __get_str(exp_name),
		  __entry->size,
		  __entry->ino,
		  __entry->fd)
);

DEFINE_EVENT(dma_buf, dma_buf_export,

	TP_PROTO(struct dma_buf *dmabuf),

	TP_ARGS(dmabuf)
);

DEFINE_EVENT(dma_buf, dma_buf_mmap_internal,

	TP_PROTO(struct dma_buf *dmabuf),

	TP_ARGS(dmabuf)
);

DEFINE_EVENT(dma_buf, dma_buf_mmap,

	TP_PROTO(struct dma_buf *dmabuf),

	TP_ARGS(dmabuf)
);

DEFINE_EVENT(dma_buf, dma_buf_put,

	TP_PROTO(struct dma_buf *dmabuf),

	TP_ARGS(dmabuf)
);

DEFINE_EVENT(dma_buf_attach_dev, dma_buf_dynamic_attach,

	TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach,
		bool is_dynamic, struct device *dev),

	TP_ARGS(dmabuf, attach, is_dynamic, dev)
);

DEFINE_EVENT(dma_buf_attach_dev, dma_buf_detach,

	TP_PROTO(struct dma_buf *dmabuf, struct dma_buf_attachment *attach,
		bool is_dynamic, struct device *dev),

	TP_ARGS(dmabuf, attach, is_dynamic, dev)
);

DEFINE_EVENT_CONDITION(dma_buf_fd, dma_buf_fd,

	TP_PROTO(struct dma_buf *dmabuf, int fd),

	TP_ARGS(dmabuf, fd),

	TP_CONDITION(fd >= 0)
);

DEFINE_EVENT(dma_buf_fd, dma_buf_get,

	TP_PROTO(struct dma_buf *dmabuf, int fd),

	TP_ARGS(dmabuf, fd)
);

#endif /* _TRACE_DMA_BUF_H */

/* This part must be outside protection */
#include <trace/define_trace.h>