All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Jeanson <mjeanson@efficios.com>
To: lttng-dev@lists.lttng.org
Subject: [PATCH lttng-modules] Add 9p probe
Date: Thu,  7 Jun 2018 15:49:11 -0400	[thread overview]
Message-ID: <20180607194911.20752-1-mjeanson__46599.5475221009$1528400846$gmane$org@efficios.com> (raw)

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 instrumentation/events/lttng-module/9p.h | 57 ++++++++++++++++++++++++
 probes/Kbuild                            |  7 +++
 probes/lttng-probe-9p.c                  | 38 ++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 instrumentation/events/lttng-module/9p.h
 create mode 100644 probes/lttng-probe-9p.c

diff --git a/instrumentation/events/lttng-module/9p.h b/instrumentation/events/lttng-module/9p.h
new file mode 100644
index 0000000..ab58bac
--- /dev/null
+++ b/instrumentation/events/lttng-module/9p.h
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1) */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM 9p
+
+#if !defined(LTTNG_TRACE_9P_H) || defined(TRACE_HEADER_MULTI_READ)
+#define LTTNG_TRACE_9P_H
+
+#include <probes/lttng-tracepoint-event.h>
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+LTTNG_TRACEPOINT_EVENT(9p_client_req,
+
+	TP_PROTO(struct p9_client *clnt, int8_t type, int tag),
+
+	TP_ARGS(clnt, type, tag),
+
+	TP_FIELDS(
+		ctf_integer_hex(void *, clnt, clnt)
+		ctf_integer(u8, type, type)
+		ctf_integer(u32, tag, tag)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT(9p_client_res,
+
+	TP_PROTO(struct p9_client *clnt, int8_t type, int tag, int err),
+
+	TP_ARGS(clnt, type, tag, err),
+
+	TP_FIELDS(
+		ctf_integer_hex(void *, clnt, clnt)
+		ctf_integer(u8, type, type)
+		ctf_integer(u32, tag, tag)
+		ctf_integer(u32, err, err)
+	)
+)
+
+LTTNG_TRACEPOINT_EVENT(9p_protocol_dump,
+
+	TP_PROTO(struct p9_client *clnt, struct p9_fcall *pdu),
+
+	TP_ARGS(clnt, pdu),
+
+	TP_FIELDS(
+		ctf_integer_hex(void *, clnt, clnt)
+		ctf_integer(u8, type, pdu->id)
+		ctf_integer(u16, tag, pdu->tag)
+		ctf_array(unsigned char, line, pdu->sdata, P9_PROTO_DUMP_SZ)
+	)
+)
+#endif
+
+#endif /* LTTNG_TRACE_9P_H */
+
+/* This part must be outside protection */
+#include <probes/define_trace.h>
diff --git a/probes/Kbuild b/probes/Kbuild
index ff9c5f5..7a0b650 100644
--- a/probes/Kbuild
+++ b/probes/Kbuild
@@ -12,6 +12,13 @@ obj-$(CONFIG_LTTNG) += lttng-probe-module.o
 obj-$(CONFIG_LTTNG) += lttng-probe-power.o
 obj-$(CONFIG_LTTNG) += lttng-probe-statedump.o
 
+ifneq ($(CONFIG_NET_9P),)
+  obj-$(CONFIG_LTTNG) +=  $(shell \
+    if [ $(VERSION) -ge 4 \
+      -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 10 \) ] ; then \
+      echo "lttng-probe-9p.o" ; fi;)
+endif # CONFIG_NET_9P
+
 i2c_dep = $(srctree)/include/trace/events/i2c.h
 ifneq ($(wildcard $(i2c_dep)),)
   obj-$(CONFIG_LTTNG) += lttng-probe-i2c.o
diff --git a/probes/lttng-probe-9p.c b/probes/lttng-probe-9p.c
new file mode 100644
index 0000000..25dba4f
--- /dev/null
+++ b/probes/lttng-probe-9p.c
@@ -0,0 +1,38 @@
+/*
+ * probes/lttng-probe-9p.c
+ *
+ * LTTng 9p probes.
+ *
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright (C) 2018 Michael Jeanson <mjeanson@efficios.com>
+ *
+ * SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+ */
+
+#include <linux/module.h>
+#include <net/9p/9p.h>
+#include <net/9p/client.h>
+#include <lttng-tracer.h>
+
+/*
+ * Create the tracepoint static inlines from the kernel to validate that our
+ * trace event macros match the kernel we run on.
+ */
+#include <trace/events/9p.h>
+
+/*
+ * Create LTTng tracepoint probes.
+ */
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH instrumentation/events/lttng-module
+
+#include <instrumentation/events/lttng-module/9p.h>
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Michael Jeanson <mjeanson@efficios.com>");
+MODULE_DESCRIPTION("LTTng 9p probes");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+	__stringify(LTTNG_MODULES_MINOR_VERSION) "."
+	__stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+	LTTNG_MODULES_EXTRAVERSION);
-- 
2.17.1

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

             reply	other threads:[~2018-06-07 19:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 19:49 Michael Jeanson [this message]
     [not found] <20180607194911.20752-1-mjeanson@efficios.com>
2018-06-07 20:11 ` [PATCH lttng-modules] Add 9p probe Mathieu Desnoyers

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='20180607194911.20752-1-mjeanson__46599.5475221009$1528400846$gmane$org@efficios.com' \
    --to=mjeanson@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.