linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	mikey@neuling.org, hbabu@us.ibm.com, linuxppc-dev@ozlabs.org,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH 4/5] powerpc/ftw: Add a couple of trace points
Date: Tue, 16 Jan 2018 18:50:42 -0800	[thread overview]
Message-ID: <1516157443-17716-5-git-send-email-sukadev@linux.vnet.ibm.com> (raw)
In-Reply-To: <1516157443-17716-1-git-send-email-sukadev@linux.vnet.ibm.com>

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

  parent reply	other threads:[~2018-01-17  2:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17  2:50 [PATCH 0/5] Implement FTW driver Sukadev Bhattiprolu
2018-01-17  2:50 ` [PATCH 1/5] powerpc/vas: Remove a stray line in Makefile Sukadev Bhattiprolu
2018-03-14  9:27   ` [1/5] " Michael Ellerman
2018-01-17  2:50 ` [PATCH 2/5] powerpc/ftw: Define FTW_SETUP ioctl API Sukadev Bhattiprolu
2018-01-17 18:23   ` Randy Dunlap
2018-01-18 16:41     ` Sukadev Bhattiprolu
2018-01-17  2:50 ` [PATCH 3/5] powerpc/ftw: Implement a simple FTW driver Sukadev Bhattiprolu
2018-01-17 18:30   ` Randy Dunlap
2018-01-18 16:45     ` Sukadev Bhattiprolu
2018-01-17  2:50 ` Sukadev Bhattiprolu [this message]
2018-01-17  2:50 ` [PATCH 5/5] powerpc/ftw: Document FTW API/usage Sukadev Bhattiprolu
2018-01-25  0:48   ` Randy Dunlap
2018-01-25  3:05     ` Sukadev Bhattiprolu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516157443-17716-5-git-send-email-sukadev@linux.vnet.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=hbabu@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).