[1/7] mm: vmap: Add alloc_vmap_area trace event

Message ID 20221017160233.16582-2-urezki@gmail.com
State New
Headers
Series Add basic trace events for vmap/vmalloc |

Commit Message

Uladzislau Rezki Oct. 17, 2022, 4:02 p.m. UTC
  It is for a debug purpose and for validation of passed parameters.

To: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
 include/trace/events/vmap.h | 56 +++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 include/trace/events/vmap.h
  

Comments

Steven Rostedt Oct. 18, 2022, 4:41 p.m. UTC | #1
On Mon, 17 Oct 2022 18:02:25 +0200
"Uladzislau Rezki (Sony)" <urezki@gmail.com> wrote:

> It is for a debug purpose and for validation of passed parameters.
> 
> To: Steven Rostedt <rostedt@goodmis.org>

FYI, it's "Cc:" not "To:" as I did not receive this email (nor patches 2 or 3).

> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>

-- Steve
  
Uladzislau Rezki Oct. 18, 2022, 4:57 p.m. UTC | #2
On Tue, Oct 18, 2022 at 12:41:27PM -0400, Steven Rostedt wrote:
> On Mon, 17 Oct 2022 18:02:25 +0200
> "Uladzislau Rezki (Sony)" <urezki@gmail.com> wrote:
> 
> > It is for a debug purpose and for validation of passed parameters.
> > 
> > To: Steven Rostedt <rostedt@goodmis.org>
> 
> FYI, it's "Cc:" not "To:" as I did not receive this email (nor patches 2 or 3).
> 
OK. I will resend it anyway and just put you in Cc instead.

Thanks!

--
Uladzislau Rezki
  

Patch

diff --git a/include/trace/events/vmap.h b/include/trace/events/vmap.h
new file mode 100644
index 000000000000..504870d95a4e
--- /dev/null
+++ b/include/trace/events/vmap.h
@@ -0,0 +1,56 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM vmap
+
+#if !defined(_TRACE_VMAP_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_VMAP_H
+
+#include <linux/tracepoint.h>
+
+/**
+ * alloc_vmap_area - called when a new vmap allocation occurs
+ * @addr:	an allocated address
+ * @size:	a requested size
+ * @align:	a requested alignment
+ * @vstart:	a requested start range
+ * @vend:	a requested end range
+ * @failed:	an allocation failed or not
+ *
+ * This event is used for a debug purpose, it can give an extra
+ * information for a developer about how often it occurs and which
+ * parameters are passed for further validation.
+ */
+TRACE_EVENT(alloc_vmap_area,
+
+	TP_PROTO(unsigned long addr, unsigned long size, unsigned long align,
+		unsigned long vstart, unsigned long vend, int failed),
+
+	TP_ARGS(addr, size, align, vstart, vend, failed),
+
+	TP_STRUCT__entry(
+		__field(unsigned long, addr)
+		__field(unsigned long, size)
+		__field(unsigned long, align)
+		__field(unsigned long, vstart)
+		__field(unsigned long, vend)
+		__field(int, failed)
+	),
+
+	TP_fast_assign(
+		__entry->addr = addr;
+		__entry->size = size;
+		__entry->align = align;
+		__entry->vstart = vstart;
+		__entry->vend = vend;
+		__entry->failed = failed;
+	),
+
+	TP_printk("va_start: %lu size=%lu align=%lu vstart=0x%lx vend=0x%lx failed=%d",
+		__entry->addr, __entry->size, __entry->align,
+		__entry->vstart, __entry->vend, __entry->failed)
+);
+
+#endif /*  _TRACE_VMAP_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>