Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735952 > unrolled thread

[PATCH 02/16] hyper-v: trace vmbus_on_message()

Started byVitaly Kuznetsov <vkuznets@redhat.com>
First post2017-09-20 19:30 +0200
Last post2017-09-21 10:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 02/16] hyper-v: trace vmbus_on_message() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-09-20 19:30 +0200
    Re: [PATCH 02/16] hyper-v: trace vmbus_on_message() Steven Rostedt <rostedt@goodmis.org> - 2017-09-20 20:00 +0200
      Re: [PATCH 02/16] hyper-v: trace vmbus_on_message() Vitaly Kuznetsov <vkuznets@redhat.com> - 2017-09-21 10:20 +0200

#1735952 — [PATCH 02/16] hyper-v: trace vmbus_on_message()

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2017-09-20 19:30 +0200
Subject[PATCH 02/16] hyper-v: trace vmbus_on_message()
Message-ID<urQYW-63Y-33@gated-at.bofh.it>
Add tracepoint to vmbus_on_message() which is called when we start
processing a blocking from work context.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 drivers/hv/channel_mgmt.c | 2 ++
 drivers/hv/hv_trace.h     | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 060df71c2e8b..ddeebba8971e 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -1170,6 +1170,8 @@ void vmbus_onmessage(void *context)
 	hdr = (struct vmbus_channel_message_header *)msg->u.payload;
 	size = msg->header.payload_size;
 
+	trace_vmbus_on_message(hdr);
+
 	if (hdr->msgtype >= CHANNELMSG_COUNT) {
 		pr_err("Received invalid channel message type %d size %d\n",
 			   hdr->msgtype, size);
diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
index 9a29ef55477d..72911dfc9682 100644
--- a/drivers/hv/hv_trace.h
+++ b/drivers/hv/hv_trace.h
@@ -14,6 +14,14 @@ TRACE_EVENT(vmbus_on_msg_dpc,
 	    TP_printk("message %u received", __entry->msgtype)
 	);
 
+TRACE_EVENT(vmbus_on_message,
+	    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("processing message %u", __entry->msgtype)
+	);
+
 #undef TRACE_INCLUDE_PATH
 #define TRACE_INCLUDE_PATH .
 #undef TRACE_INCLUDE_FILE
-- 
2.13.5

[toc] | [next] | [standalone]


#1735973

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-09-20 20:00 +0200
Message-ID<urRrX-6fs-15@gated-at.bofh.it>
In reply to#1735952
On Wed, 20 Sep 2017 19:21:53 +0200
Vitaly Kuznetsov <vkuznets@redhat.com> wrote:

> diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
> index 9a29ef55477d..72911dfc9682 100644
> --- a/drivers/hv/hv_trace.h
> +++ b/drivers/hv/hv_trace.h
> @@ -14,6 +14,14 @@ TRACE_EVENT(vmbus_on_msg_dpc,
>  	    TP_printk("message %u received", __entry->msgtype)
>  	);
>  
> +TRACE_EVENT(vmbus_on_message,
> +	    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("processing message %u", __entry->msgtype)
> +	);

Whenever you have two trace events with everything the same but the
TP_printk(), you can save a little space by using DEFINE_EVENT_PRINT()

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->msg = hdr->msgtype;),
	TP_printk("msgtype=%d", __entry->msgtype)
);

DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_msg_dpc,
	TP_PROTO(const struct vmbus_channel_message_header *hdr),
	TP_ARGS(hdr),
	TP_printk("message %u received", __entry->msgtype));

DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_message,
	TP_PROTO(const struct vmbus_channel_message_header *hdr),
	TP_ARGS(hdr),
	TP_printk("processing message %u", __entry->msgtype));

This will use the same functions required to save and record the
message but will use a different function to output it to the trace.

-- Steve

[toc] | [prev] | [next] | [standalone]


#1736448

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2017-09-21 10:20 +0200
Message-ID<us4Se-6Mz-7@gated-at.bofh.it>
In reply to#1735973
Steven Rostedt <rostedt@goodmis.org> writes:

> On Wed, 20 Sep 2017 19:21:53 +0200
> Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
>> diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
>> index 9a29ef55477d..72911dfc9682 100644
>> --- a/drivers/hv/hv_trace.h
>> +++ b/drivers/hv/hv_trace.h
>> @@ -14,6 +14,14 @@ TRACE_EVENT(vmbus_on_msg_dpc,
>>  	    TP_printk("message %u received", __entry->msgtype)
>>  	);
>>  
>> +TRACE_EVENT(vmbus_on_message,
>> +	    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("processing message %u", __entry->msgtype)
>> +	);
>
> Whenever you have two trace events with everything the same but the
> TP_printk(), you can save a little space by using DEFINE_EVENT_PRINT()
>
> 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->msg = hdr->msgtype;),
> 	TP_printk("msgtype=%d", __entry->msgtype)
> );
>
> DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_msg_dpc,
> 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
> 	TP_ARGS(hdr),
> 	TP_printk("message %u received", __entry->msgtype));
>
> DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_message,
> 	TP_PROTO(const struct vmbus_channel_message_header *hdr),
> 	TP_ARGS(hdr),
> 	TP_printk("processing message %u", __entry->msgtype));
>
> This will use the same functions required to save and record the
> message but will use a different function to output it to the trace.

Oh, thanks! This seems to be useful for
vmbus_on_msg_dpc/vmbus_on_message only as all the rest needs to parse
different structures. Will use it in v2.

-- 
  Vitaly

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web