From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752368AbdJCQy4 (ORCPT ); Tue, 3 Oct 2017 12:54:56 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:49856 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbdJCQyz (ORCPT ); Tue, 3 Oct 2017 12:54:55 -0400 X-Google-Smtp-Source: AOwi7QAknTRKJ2VCzHcOMRgJ5iGK1go73zjpstiJyZP/tEMMlGvFXVpzC9IekWRTU9JmG52LGyxi6w== Date: Tue, 3 Oct 2017 09:54:47 -0700 From: Stephen Hemminger To: Vitaly Kuznetsov Cc: Steven Rostedt , Stephen Hemminger , Haiyang Zhang , linux-kernel@vger.kernel.org, devel@linuxdriverproject.org Subject: Re: [PATCH 02/16] hyper-v: trace vmbus_on_message() Message-ID: <20171003095447.1e99069c@xeon-e3> In-Reply-To: <87wp4so48h.fsf@vitty.brq.redhat.com> References: <20170920172207.12622-1-vkuznets@redhat.com> <20170920172207.12622-3-vkuznets@redhat.com> <20170920135503.690cd21e@gandalf.local.home> <87wp4so48h.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v93Gt1ws007040 On Thu, 21 Sep 2017 10:17:18 +0200 Vitaly Kuznetsov wrote: > Steven Rostedt writes: > > > On Wed, 20 Sep 2017 19:21:53 +0200 > > Vitaly Kuznetsov 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. > I just used this patch. Since function name is already in the trace message no need to have different print's for each one. >>From ff85967810c216eb01d181789af4f56bd00dc9b9 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 3 Oct 2017 09:24:11 -0700 Subject: [PATCH 3/4] hyperv: fix warnings in trace print This gets rid of the build warnings from unused printf format. And uses common class for print. --- drivers/hv/hv_trace.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h index be7762955650..4755c4640e39 100644 --- a/drivers/hv/hv_trace.h +++ b/drivers/hv/hv_trace.h @@ -11,18 +11,18 @@ DECLARE_EVENT_CLASS(vmbus_hdr_msg, TP_ARGS(hdr), TP_STRUCT__entry(__field(unsigned int, msgtype)), TP_fast_assign(__entry->msgtype = hdr->msgtype;), - TP_printk("msgtype=%d", __entry->msgtype) + TP_printk("msgtype=%u", __entry->msgtype) ); -DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_msg_dpc, +DEFINE_EVENT(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)); + TP_ARGS(hdr) +); -DEFINE_EVENT_PRINT(vmbus_hdr_msg, vmbus_on_message, +DEFINE_EVENT(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)); + TP_ARGS(hdr) +); TRACE_EVENT(vmbus_onoffer, TP_PROTO(const struct vmbus_channel_offer_channel *offer), -- 2.11.0