hyper-v: trace vmbus_on_msg_dpc()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Sun, 29 Oct 2017 19:21:00 +0000 (12:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Nov 2017 11:04:24 +0000 (12:04 +0100)
Add tracing subsystem to Hyper-V VMBus module and add tracepoint
to vmbus_on_msg_dpc() which is called when we receive a message from host.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/Makefile
drivers/hv/hv_trace.c [new file with mode: 0644]
drivers/hv/hv_trace.h [new file with mode: 0644]
drivers/hv/hyperv_vmbus.h
drivers/hv/vmbus_drv.c

index 39c9b2c08d33743c340d7717cd5ecf3876a5f52f..ad791e00230fa086700fcce1a204c2107d7d5cd6 100644 (file)
@@ -2,7 +2,9 @@ obj-$(CONFIG_HYPERV)            += hv_vmbus.o
 obj-$(CONFIG_HYPERV_UTILS)     += hv_utils.o
 obj-$(CONFIG_HYPERV_BALLOON)   += hv_balloon.o
 
+CFLAGS_hv_trace.o = -I$(src)
+
 hv_vmbus-y := vmbus_drv.o \
                 hv.o connection.o channel.o \
-                channel_mgmt.o ring_buffer.o
+                channel_mgmt.o ring_buffer.o hv_trace.o
 hv_utils-y := hv_util.o hv_kvp.o hv_snapshot.o hv_fcopy.o hv_utils_transport.o
diff --git a/drivers/hv/hv_trace.c b/drivers/hv/hv_trace.c
new file mode 100644 (file)
index 0000000..df47acd
--- /dev/null
@@ -0,0 +1,4 @@
+#include "hyperv_vmbus.h"
+
+#define CREATE_TRACE_POINTS
+#include "hv_trace.h"
diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
new file mode 100644 (file)
index 0000000..9c27729
--- /dev/null
@@ -0,0 +1,29 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM hyperv
+
+#if !defined(_HV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _HV_TRACE_H
+
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(vmbus_hdr_msg,
+       TP_PROTO(const struct vmbus_channel_message_header *hdr),
+       TP_ARGS(hdr),
+       TP_STRUCT__entry(__field(unsigned int, msgtype)),
+       TP_fast_assign(__entry->msgtype = hdr->msgtype;),
+       TP_printk("msgtype=%u", __entry->msgtype)
+);
+
+DEFINE_EVENT(vmbus_hdr_msg, vmbus_on_msg_dpc,
+       TP_PROTO(const struct vmbus_channel_message_header *hdr),
+       TP_ARGS(hdr)
+);
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE hv_trace
+#endif /* _HV_TRACE_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
index de6f01df9592cf377f6a0fb971c6fab58a04d8b1..22300ec7b5567478bbeb607b84a0c6f6cd94c785 100644 (file)
@@ -31,6 +31,8 @@
 #include <linux/hyperv.h>
 #include <linux/interrupt.h>
 
+#include "hv_trace.h"
+
 /*
  * Timeout for services such as KVP and fcopy.
  */
index 8fe13cd76acf14c49bd0554936737287e9fecf8c..8f9293a87c6bd43fdd6684975080e5e3fbfde633 100644 (file)
@@ -835,6 +835,8 @@ void vmbus_on_msg_dpc(unsigned long data)
 
        hdr = (struct vmbus_channel_message_header *)msg->u.payload;
 
+       trace_vmbus_on_msg_dpc(hdr);
+
        if (hdr->msgtype >= CHANNELMSG_COUNT) {
                WARN_ONCE(1, "unknown msgtype=%d\n", hdr->msgtype);
                goto msg_handled;