Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 2 | #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 Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 11 | DECLARE_EVENT_CLASS(cma_alloc_class, |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 12 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 13 | TP_PROTO(const char *name, unsigned long pfn, const struct page *page, |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 14 | unsigned int count, unsigned int align), |
| 15 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 16 | TP_ARGS(name, pfn, page, count, align), |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 17 | |
| 18 | TP_STRUCT__entry( |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 19 | __string(name, name) |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 20 | __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 Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 27 | __assign_str(name, name); |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 28 | __entry->pfn = pfn; |
| 29 | __entry->page = page; |
| 30 | __entry->count = count; |
| 31 | __entry->align = align; |
| 32 | ), |
| 33 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 34 | TP_printk("name=%s pfn=%lx page=%p count=%u align=%u", |
| 35 | __get_str(name), |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 36 | __entry->pfn, |
| 37 | __entry->page, |
| 38 | __entry->count, |
| 39 | __entry->align) |
| 40 | ); |
| 41 | |
| 42 | TRACE_EVENT(cma_release, |
| 43 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 44 | TP_PROTO(const char *name, unsigned long pfn, const struct page *page, |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 45 | unsigned int count), |
| 46 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 47 | TP_ARGS(name, pfn, page, count), |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 48 | |
| 49 | TP_STRUCT__entry( |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 50 | __string(name, name) |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 51 | __field(unsigned long, pfn) |
| 52 | __field(const struct page *, page) |
| 53 | __field(unsigned int, count) |
| 54 | ), |
| 55 | |
| 56 | TP_fast_assign( |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 57 | __assign_str(name, name); |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 58 | __entry->pfn = pfn; |
| 59 | __entry->page = page; |
| 60 | __entry->count = count; |
| 61 | ), |
| 62 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 63 | TP_printk("name=%s pfn=%lx page=%p count=%u", |
| 64 | __get_str(name), |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 65 | __entry->pfn, |
| 66 | __entry->page, |
| 67 | __entry->count) |
| 68 | ); |
| 69 | |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 70 | TRACE_EVENT(cma_alloc_start, |
| 71 | |
Georgi Djakov | 1cfa9bc | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 72 | TP_PROTO(const char *name, unsigned int count, unsigned int align), |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 73 | |
Georgi Djakov | 1cfa9bc | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 74 | TP_ARGS(name, count, align), |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 75 | |
| 76 | TP_STRUCT__entry( |
Georgi Djakov | 1cfa9bc | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 77 | __string(name, name) |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 78 | __field(unsigned int, count) |
| 79 | __field(unsigned int, align) |
| 80 | ), |
| 81 | |
| 82 | TP_fast_assign( |
Georgi Djakov | 1cfa9bc | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 83 | __assign_str(name, name); |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 84 | __entry->count = count; |
| 85 | __entry->align = align; |
| 86 | ), |
| 87 | |
Georgi Djakov | 1cfa9bc | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 88 | TP_printk("name=%s count=%u align=%u", |
| 89 | __get_str(name), |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 90 | __entry->count, |
| 91 | __entry->align) |
| 92 | ); |
| 93 | |
Minchan Kim | 675e504 | 2021-06-29 11:28:13 -0700 | [diff] [blame] | 94 | TRACE_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 Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 139 | DEFINE_EVENT(cma_alloc_class, cma_alloc_finish, |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 140 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 141 | TP_PROTO(const char *name, unsigned long pfn, const struct page *page, |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 142 | unsigned int count, unsigned int align), |
| 143 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 144 | TP_ARGS(name, pfn, page, count, align) |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 145 | ); |
| 146 | |
| 147 | DEFINE_EVENT(cma_alloc_class, cma_alloc_busy_retry, |
| 148 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 149 | TP_PROTO(const char *name, unsigned long pfn, const struct page *page, |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 150 | unsigned int count, unsigned int align), |
| 151 | |
Minchan Kim | 76782b5 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 152 | TP_ARGS(name, pfn, page, count, align) |
Liam Mark | c453643 | 2021-04-12 00:02:38 -0400 | [diff] [blame] | 153 | ); |
| 154 | |
Stefan Strogin | 99e8ea6 | 2015-04-15 16:14:50 -0700 | [diff] [blame] | 155 | #endif /* _TRACE_CMA_H */ |
| 156 | |
| 157 | /* This part must be outside protection */ |
| 158 | #include <trace/define_trace.h> |