From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751838AbdIUIRV (ORCPT ); Thu, 21 Sep 2017 04:17:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45618 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751530AbdIUIRU (ORCPT ); Thu, 21 Sep 2017 04:17:20 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8DD3C7EA8F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=vkuznets@redhat.com From: Vitaly Kuznetsov To: Steven Rostedt Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Dexuan Cui Subject: Re: [PATCH 02/16] hyper-v: trace vmbus_on_message() References: <20170920172207.12622-1-vkuznets@redhat.com> <20170920172207.12622-3-vkuznets@redhat.com> <20170920135503.690cd21e@gandalf.local.home> Date: Thu, 21 Sep 2017 10:17:18 +0200 In-Reply-To: <20170920135503.690cd21e@gandalf.local.home> (Steven Rostedt's message of "Wed, 20 Sep 2017 13:55:03 -0400") Message-ID: <87wp4so48h.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 21 Sep 2017 08:17:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Vitaly