xref: /openbmc/linux/include/trace/events/vmalloc.h (revision 979ac5ef)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM vmalloc
4 
5 #if !defined(_TRACE_VMALLOC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_VMALLOC_H
7 
8 #include <linux/tracepoint.h>
9 
10 /**
11  * alloc_vmap_area - called when a new vmap allocation occurs
12  * @addr:	an allocated address
13  * @size:	a requested size
14  * @align:	a requested alignment
15  * @vstart:	a requested start range
16  * @vend:	a requested end range
17  * @failed:	an allocation failed or not
18  *
19  * This event is used for a debug purpose, it can give an extra
20  * information for a developer about how often it occurs and which
21  * parameters are passed for further validation.
22  */
23 TRACE_EVENT(alloc_vmap_area,
24 
25 	TP_PROTO(unsigned long addr, unsigned long size, unsigned long align,
26 		unsigned long vstart, unsigned long vend, int failed),
27 
28 	TP_ARGS(addr, size, align, vstart, vend, failed),
29 
30 	TP_STRUCT__entry(
31 		__field(unsigned long, addr)
32 		__field(unsigned long, size)
33 		__field(unsigned long, align)
34 		__field(unsigned long, vstart)
35 		__field(unsigned long, vend)
36 		__field(int, failed)
37 	),
38 
39 	TP_fast_assign(
40 		__entry->addr = addr;
41 		__entry->size = size;
42 		__entry->align = align;
43 		__entry->vstart = vstart;
44 		__entry->vend = vend;
45 		__entry->failed = failed;
46 	),
47 
48 	TP_printk("va_start: %lu size=%lu align=%lu vstart=0x%lx vend=0x%lx failed=%d",
49 		__entry->addr, __entry->size, __entry->align,
50 		__entry->vstart, __entry->vend, __entry->failed)
51 );
52 
53 /**
54  * purge_vmap_area_lazy - called when vmap areas were lazily freed
55  * @start:		purging start address
56  * @end:		purging end address
57  * @npurged:	numbed of purged vmap areas
58  *
59  * This event is used for a debug purpose. It gives some
60  * indication about start:end range and how many objects
61  * are released.
62  */
63 TRACE_EVENT(purge_vmap_area_lazy,
64 
65 	TP_PROTO(unsigned long start, unsigned long end,
66 		unsigned int npurged),
67 
68 	TP_ARGS(start, end, npurged),
69 
70 	TP_STRUCT__entry(
71 		__field(unsigned long, start)
72 		__field(unsigned long, end)
73 		__field(unsigned int, npurged)
74 	),
75 
76 	TP_fast_assign(
77 		__entry->start = start;
78 		__entry->end = end;
79 		__entry->npurged = npurged;
80 	),
81 
82 	TP_printk("start=0x%lx end=0x%lx num_purged=%u",
83 		__entry->start, __entry->end, __entry->npurged)
84 );
85 
86 /**
87  * free_vmap_area_noflush - called when a vmap area is freed
88  * @va_start:		a start address of VA
89  * @nr_lazy:		number of current lazy pages
90  * @nr_lazy_max:	number of maximum lazy pages
91  *
92  * This event is used for a debug purpose. It gives some
93  * indication about a VA that is released, number of current
94  * outstanding areas and a maximum allowed threshold before
95  * dropping all of them.
96  */
97 TRACE_EVENT(free_vmap_area_noflush,
98 
99 	TP_PROTO(unsigned long va_start, unsigned long nr_lazy,
100 		unsigned long nr_lazy_max),
101 
102 	TP_ARGS(va_start, nr_lazy, nr_lazy_max),
103 
104 	TP_STRUCT__entry(
105 		__field(unsigned long, va_start)
106 		__field(unsigned long, nr_lazy)
107 		__field(unsigned long, nr_lazy_max)
108 	),
109 
110 	TP_fast_assign(
111 		__entry->va_start = va_start;
112 		__entry->nr_lazy = nr_lazy;
113 		__entry->nr_lazy_max = nr_lazy_max;
114 	),
115 
116 	TP_printk("va_start=0x%lx nr_lazy=%lu nr_lazy_max=%lu",
117 		__entry->va_start, __entry->nr_lazy, __entry->nr_lazy_max)
118 );
119 
120 #endif /*  _TRACE_VMALLOC_H */
121 
122 /* This part must be outside protection */
123 #include <trace/define_trace.h>
124