Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp916235rwb; Thu, 15 Dec 2022 04:18:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf6hm5geJ7MJ9CD+gc/mLE1XmgX3ndiXkNGCsnlo1JlglctzRkmBmoIAkdL6sdhyIkiOF2rE X-Received: by 2002:a17:903:2445:b0:189:c6fb:c215 with SMTP id l5-20020a170903244500b00189c6fbc215mr49027955pls.62.1671106702606; Thu, 15 Dec 2022 04:18:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671106702; cv=none; d=google.com; s=arc-20160816; b=BeyyAlff6tuCE2M6SNCJlwkUclI72w6FV0E+XKE5rC1+vME4bGmBOkyuCol7CO/eDA nb4ZqvydEoaH3IzvfmdYpITzFoSclvo3trbLmqWd2vCs5MeIU+9yiRedAKF18iSncYq7 Yhla9C9Aj4zIXv9CIVqR5oIZwFTz8JiUE5M2ju8g5mfQADeEg2VZKeQK1kabSFCECNRc yEPqpThP/0St6Y7md+roeaT9paNdPehe0yWIf7ghd6Ud4aVT+2xll2md8vzGgG7U6kxe gJTcml7ZrxOc1iwOeckPxYzAx/LOB4dLMZfN09pQBhBHv35xgMN8oAwWkmJGxW5xz8eo lAvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=V9DYf8klbeiWPPqglMwocOMY3Pr9Fy1i+hsB43lJ17A=; b=WuBVnAbuUEO//W2KmhUDJgi0+HvPhrHmA9SZTFB7fjU4+PLCc2+S7eY3Ek50Hc7GHX 4UTJN0MtOdxdn48ewq9d3lzZZG02ji2qY7b9qGAxhHg0P/CSQGJy/9w6BoktlJpxiGTH Wgr8R1LsT6jtnPzBZH0bpE1gSauxeeFPSqwPwGL0JXIswogKMw3E+g4wRk8/eqP79jNG AtOgGEYWNkDZsBpGPyFULD4bKCuJvj4ho54TzFrfI+s0hcYlE8hyb5EytcEdW0H6Yz4X gB+/467BEdLnUMwAnSAQOlOvQwI6Mk8uKlUWg3qc/0D1PdrFg5XsE+vGjB14SAQY2DC4 kqTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a170902c95100b001786b70f913si6480915pla.164.2022.12.15.04.18.13; Thu, 15 Dec 2022 04:18:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbiLOMJ2 (ORCPT + 68 others); Thu, 15 Dec 2022 07:09:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbiLOMJY (ORCPT ); Thu, 15 Dec 2022 07:09:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D0F02DAB2; Thu, 15 Dec 2022 04:09:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE60861DB1; Thu, 15 Dec 2022 12:09:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF162C433EF; Thu, 15 Dec 2022 12:09:21 +0000 (UTC) Date: Thu, 15 Dec 2022 07:09:19 -0500 From: Steven Rostedt To: Linyu Yuan Cc: Masami Hiramatsu , , Subject: Re: [PATCH v2 2/2] trace: allocate space from temparary trace sequence buffer Message-ID: <20221215070919.52c899c3@gandalf.local.home> In-Reply-To: References: <1671078807-20748-1-git-send-email-quic_linyyuan@quicinc.com> <1671078807-20748-2-git-send-email-quic_linyyuan@quicinc.com> <20221214235402.5ea7489e@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Dec 2022 13:08:21 +0800 Linyu Yuan wrote: > On 12/15/2022 12:54 PM, Steven Rostedt wrote: > > On Thu, 15 Dec 2022 12:33:27 +0800 > > Linyu Yuan wrote: > > > >> there is one dwc3 trace event declare as below, > >> DECLARE_EVENT_CLASS(dwc3_log_event, > >> TP_PROTO(u32 event, struct dwc3 *dwc), > >> TP_ARGS(event, dwc), > >> TP_STRUCT__entry( > >> __field(u32, event) > >> __field(u32, ep0state) > >> __dynamic_array(char, str, DWC3_MSG_MAX) > >> ), > >> TP_fast_assign( > >> __entry->event = event; > >> __entry->ep0state = dwc->ep0state; > >> ), > >> TP_printk("event (%08x): %s", __entry->event, > >> dwc3_decode_event(__get_str(str), DWC3_MSG_MAX, > >> __entry->event, __entry->ep0state)) > >> ); > >> the problem is when trace function called, it will allocate up to > >> DWC3_MSG_MAX bytes from trace event buffer, but never fill the buffer > >> during fast assignment, it only fill the buffer when output function are > >> called, so this means if output function are not called, the buffer will > >> never used. > >> > >> add __get_buf(len) which allocate space from iter->tmp_seq when trace > >> output function called, it allow user write any data to allocatd space. > >> > >> the mentioned dwc3 trace event will changed as below, > >> DECLARE_EVENT_CLASS(dwc3_log_event, > >> TP_PROTO(u32 event, struct dwc3 *dwc), > >> TP_ARGS(event, dwc), > >> TP_STRUCT__entry( > >> __field(u32, event) > >> __field(u32, ep0state) > >> ), > >> TP_fast_assign( > >> __entry->event = event; > >> __entry->ep0state = dwc->ep0state; > >> ), > >> TP_printk("event (%08x): %s", __entry->event, > >> dwc3_decode_event(__get_buf(DWC3_MSG_MAX), DWC3_MSG_MAX, > >> __entry->event, __entry->ep0state)) > >> );. > >> > >> Signed-off-by: Linyu Yuan > > > > No! > ok, so you don't like a common function in trace_seq.c ? Ah sorry, I got confused by the name "alloc" thinking you allocated a new trace_seq. I misread your patch (it was late and I was about to go to bed when I replied). Let me look at it again when I'm more awake ;-) -- Steve