blob: 9c134325d6b2c447363a3bd02e9ac54b1737d7df [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Stefan Strogin99e8ea62015-04-15 16:14:50 -07002#undef TRACE_SYSTEM
3#define TRACE_SYSTEM cma
4
5#if !defined(_TRACE_CMA_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_CMA_H
7
8#include <linux/types.h>
9#include <linux/tracepoint.h>
10
Liam Markc4536432021-04-12 00:02:38 -040011DECLARE_EVENT_CLASS(cma_alloc_class,
Stefan Strogin99e8ea62015-04-15 16:14:50 -070012
Minchan Kim76782b52021-04-12 00:02:38 -040013 TP_PROTO(const char *name, unsigned long pfn, const struct page *page,
Stefan Strogin99e8ea62015-04-15 16:14:50 -070014 unsigned int count, unsigned int align),
15
Minchan Kim76782b52021-04-12 00:02:38 -040016 TP_ARGS(name, pfn, page, count, align),
Stefan Strogin99e8ea62015-04-15 16:14:50 -070017
18 TP_STRUCT__entry(
Minchan Kim76782b52021-04-12 00:02:38 -040019 __string(name, name)
Stefan Strogin99e8ea62015-04-15 16:14:50 -070020 __field(unsigned long, pfn)
21 __field(const struct page *, page)
22 __field(unsigned int, count)
23 __field(unsigned int, align)
24 ),
25
26 TP_fast_assign(
Minchan Kim76782b52021-04-12 00:02:38 -040027 __assign_str(name, name);
Stefan Strogin99e8ea62015-04-15 16:14:50 -070028 __entry->pfn = pfn;
29 __entry->page = page;
30 __entry->count = count;
31 __entry->align = align;
32 ),
33
Minchan Kim76782b52021-04-12 00:02:38 -040034 TP_printk("name=%s pfn=%lx page=%p count=%u align=%u",
35 __get_str(name),
Stefan Strogin99e8ea62015-04-15 16:14:50 -070036 __entry->pfn,
37 __entry->page,
38 __entry->count,
39 __entry->align)
40);
41
42TRACE_EVENT(cma_release,
43
Minchan Kim76782b52021-04-12 00:02:38 -040044 TP_PROTO(const char *name, unsigned long pfn, const struct page *page,
Stefan Strogin99e8ea62015-04-15 16:14:50 -070045 unsigned int count),
46
Minchan Kim76782b52021-04-12 00:02:38 -040047 TP_ARGS(name, pfn, page, count),
Stefan Strogin99e8ea62015-04-15 16:14:50 -070048
49 TP_STRUCT__entry(
Minchan Kim76782b52021-04-12 00:02:38 -040050 __string(name, name)
Stefan Strogin99e8ea62015-04-15 16:14:50 -070051 __field(unsigned long, pfn)
52 __field(const struct page *, page)
53 __field(unsigned int, count)
54 ),
55
56 TP_fast_assign(
Minchan Kim76782b52021-04-12 00:02:38 -040057 __assign_str(name, name);
Stefan Strogin99e8ea62015-04-15 16:14:50 -070058 __entry->pfn = pfn;
59 __entry->page = page;
60 __entry->count = count;
61 ),
62
Minchan Kim76782b52021-04-12 00:02:38 -040063 TP_printk("name=%s pfn=%lx page=%p count=%u",
64 __get_str(name),
Stefan Strogin99e8ea62015-04-15 16:14:50 -070065 __entry->pfn,
66 __entry->page,
67 __entry->count)
68);
69
Liam Markc4536432021-04-12 00:02:38 -040070TRACE_EVENT(cma_alloc_start,
71
Georgi Djakov1cfa9bc2021-04-12 00:02:38 -040072 TP_PROTO(const char *name, unsigned int count, unsigned int align),
Liam Markc4536432021-04-12 00:02:38 -040073
Georgi Djakov1cfa9bc2021-04-12 00:02:38 -040074 TP_ARGS(name, count, align),
Liam Markc4536432021-04-12 00:02:38 -040075
76 TP_STRUCT__entry(
Georgi Djakov1cfa9bc2021-04-12 00:02:38 -040077 __string(name, name)
Liam Markc4536432021-04-12 00:02:38 -040078 __field(unsigned int, count)
79 __field(unsigned int, align)
80 ),
81
82 TP_fast_assign(
Georgi Djakov1cfa9bc2021-04-12 00:02:38 -040083 __assign_str(name, name);
Liam Markc4536432021-04-12 00:02:38 -040084 __entry->count = count;
85 __entry->align = align;
86 ),
87
Georgi Djakov1cfa9bc2021-04-12 00:02:38 -040088 TP_printk("name=%s count=%u align=%u",
89 __get_str(name),
Liam Markc4536432021-04-12 00:02:38 -040090 __entry->count,
91 __entry->align)
92);
93
Minchan Kim675e5042021-06-29 11:28:13 -070094TRACE_EVENT(cma_alloc_info,
95
96 TP_PROTO(const char *name, const struct page *page, unsigned int count, unsigned int align, struct cma_alloc_info *info),
97
98 TP_ARGS(name, page, count, align, info),
99
100 TP_STRUCT__entry(
101 __string(name, name)
102 __field(unsigned long, pfn)
103 __field(unsigned int, count)
104 __field(unsigned int, align)
105 __field(unsigned long, nr_migrated)
106 __field(unsigned long, nr_reclaimed)
107 __field(unsigned long, nr_mapped)
108 __field(unsigned int, err_iso)
109 __field(unsigned int, err_mig)
110 __field(unsigned int, err_test)
111 ),
112
113 TP_fast_assign(
114 __assign_str(name, name);
115 __entry->pfn = page ? page_to_pfn(page) : -1;
116 __entry->count = count;
117 __entry->align = align;
118 __entry->nr_migrated = info->nr_migrated;
119 __entry->nr_reclaimed = info->nr_reclaimed;
120 __entry->nr_mapped = info->nr_mapped;
121 __entry->err_iso = info->nr_isolate_fail;
122 __entry->err_mig = info->nr_migrate_fail;
123 __entry->err_test = info->nr_test_fail;
124 ),
125
126 TP_printk("name=%s pfn=0x%lx count=%u align=%u nr_migrated=%lu nr_reclaimed=%lu nr_mapped=%lu err_iso=%u err_mig=%u err_test=%u",
127 __get_str(name),
128 __entry->pfn,
129 __entry->count,
130 __entry->align,
131 __entry->nr_migrated,
132 __entry->nr_reclaimed,
133 __entry->nr_mapped,
134 __entry->err_iso,
135 __entry->err_mig,
136 __entry->err_test)
137);
138
Minchan Kim76782b52021-04-12 00:02:38 -0400139DEFINE_EVENT(cma_alloc_class, cma_alloc_finish,
Liam Markc4536432021-04-12 00:02:38 -0400140
Minchan Kim76782b52021-04-12 00:02:38 -0400141 TP_PROTO(const char *name, unsigned long pfn, const struct page *page,
Liam Markc4536432021-04-12 00:02:38 -0400142 unsigned int count, unsigned int align),
143
Minchan Kim76782b52021-04-12 00:02:38 -0400144 TP_ARGS(name, pfn, page, count, align)
Liam Markc4536432021-04-12 00:02:38 -0400145);
146
147DEFINE_EVENT(cma_alloc_class, cma_alloc_busy_retry,
148
Minchan Kim76782b52021-04-12 00:02:38 -0400149 TP_PROTO(const char *name, unsigned long pfn, const struct page *page,
Liam Markc4536432021-04-12 00:02:38 -0400150 unsigned int count, unsigned int align),
151
Minchan Kim76782b52021-04-12 00:02:38 -0400152 TP_ARGS(name, pfn, page, count, align)
Liam Markc4536432021-04-12 00:02:38 -0400153);
154
Stefan Strogin99e8ea62015-04-15 16:14:50 -0700155#endif /* _TRACE_CMA_H */
156
157/* This part must be outside protection */
158#include <trace/define_trace.h>