lkml.org 
[lkml]   [2018]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/5] powerpc/ftw: Add a couple of trace points
Date
Add a couple of trace points in the FTW driver

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
drivers/misc/ftw/ftw-trace.h | 75 ++++++++++++++++++++++++++++++++++++++++++++
drivers/misc/ftw/ftw.c | 6 ++++
2 files changed, 81 insertions(+)
create mode 100644 drivers/misc/ftw/ftw-trace.h

diff --git a/drivers/misc/ftw/ftw-trace.h b/drivers/misc/ftw/ftw-trace.h
new file mode 100644
index 0000000..0d96046
--- /dev/null
+++ b/drivers/misc/ftw/ftw-trace.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2018 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM ftw
+
+#if !defined(_FTW_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+
+#define _FTW_TRACE_H
+#include <linux/tracepoint.h>
+#include <linux/sched.h>
+
+TRACE_EVENT( ftw_open_event,
+
+ TP_PROTO(struct task_struct *tsk,
+ int instid),
+
+ TP_ARGS(tsk, instid),
+
+ TP_STRUCT__entry(
+ __field(struct task_struct *, tsk)
+ __field(int, instid)
+ __field(int, pid)
+ ),
+
+ TP_fast_assign(
+ __entry->pid = tsk->pid;
+ __entry->instid = instid;
+ ),
+
+ TP_printk("pid=%d, inst=%d", __entry->pid, __entry->instid)
+);
+
+TRACE_EVENT( ftw_mmap_event,
+
+ TP_PROTO(struct task_struct *tsk,
+ int instid,
+ unsigned long paste_addr,
+ unsigned long vma_start),
+
+ TP_ARGS(tsk, instid, paste_addr, vma_start),
+
+ TP_STRUCT__entry(
+ __field(struct task_struct *, tsk)
+ __field(int, pid)
+ __field(int, instid)
+ __field(unsigned long, paste_addr)
+ __field(unsigned long, vma_start)
+ ),
+
+ TP_fast_assign(
+ __entry->pid = tsk->pid;
+ __entry->instid = instid;
+ __entry->paste_addr = paste_addr;
+ __entry->vma_start = vma_start;
+ ),
+
+ TP_printk(
+ "pid=%d, inst=%d, pasteaddr=0x%16lx, vma_start=0x%16lx",
+ __entry->pid, __entry->instid, __entry->paste_addr,
+ __entry->vma_start)
+);
+
+#endif /* _FTW_TRACE_H */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE ftw-trace
+#include <trace/define_trace.h>
diff --git a/drivers/misc/ftw/ftw.c b/drivers/misc/ftw/ftw.c
index 6fcb4e2..a01c9e6 100644
--- a/drivers/misc/ftw/ftw.c
+++ b/drivers/misc/ftw/ftw.c
@@ -21,6 +21,9 @@
#include <asm/vas.h>
#include <uapi/misc/ftw.h>

+#define CREATE_TRACE_POINTS
+#include "ftw-trace.h"
+
/*
* FTW is a device driver used to provide user space access to the
* Core-to-Core aka Fast Thread Wakeup (FTW) functionality provided by
@@ -81,6 +84,8 @@ static int ftw_open(struct inode *inode, struct file *fp)

fp->private_data = instance;

+ trace_ftw_open_event(current, instance->id);
+
return 0;
}

@@ -234,6 +239,7 @@ static int ftw_mmap(struct file *fp, struct vm_area_struct *vma)

pr_devel("paste addr %llx at %lx, rc %d\n", paste_addr, vma->vm_start,
rc);
+ trace_ftw_mmap_event(current, instance->id, paste_addr, vma->vm_start);

set_thread_uses_vas();

--
2.7.4
\
 
 \ /
  Last update: 2018-01-18 00:19    [W:0.077 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site