From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 016D9C3271E for ; Mon, 8 Jul 2024 13:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=34Zkt4/g2fi7Mnksa6QjgH+WT6EpCUFPP4LlqENZkbg=; b=jKq5dryF//+ASE38O0ZUnn1ZQ/ mDCdnX4xRuoQOtN5YSkgleMOuQuIhlcMQ4ZsE6PBiFEZczztuHk0YE8YzNwvWQ/D6mfAtyikuHAzh Tf0ga7Al/T9H76DCC71nk2LfXLYkpjbjdZ+2r5h05R9bGu9xh0bvqRiBf04hl/7xOkddnh4IuS4Lp vh2lwSK/Ran3ri4XY1Y2/sImnQ9ZX/HStR5J0Pgj25hAQ2Cyys2a4RWi1PKdM3nMfE0t/g9pKsFm6 R6CbkHRt6j5KRN0LlMMS77YKTQcTyODUkIJfLLbHC6iQi/T3FURjKgdccEU+AIieHahz/jFKGTqai dEhNMLnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQnze-00000003rvp-3ykt; Mon, 08 Jul 2024 13:01:22 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQnzP-00000003rsy-2Zyk for linux-arm-kernel@lists.infradead.org; Mon, 08 Jul 2024 13:01:09 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4C8BB1042; Mon, 8 Jul 2024 06:01:31 -0700 (PDT) Received: from pluto (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4E74C3F766; Mon, 8 Jul 2024 06:01:05 -0700 (PDT) Date: Mon, 8 Jul 2024 14:01:03 +0100 From: Cristian Marussi To: Luke Parkin Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org, sudeep.holla@arm.com, cristian.marussi@arm.com Subject: Re: [PATCH v2 2/4] firmware: arm_scmi: Add support for tracking statistics Message-ID: References: <20240703143738.2007457-1-luke.parkin@arm.com> <20240703143738.2007457-3-luke.parkin@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240703143738.2007457-3-luke.parkin@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240708_060107_765529_F341E461 X-CRM114-Status: GOOD ( 28.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 03, 2024 at 03:37:36PM +0100, Luke Parkin wrote: > Add a new config option for statistic tracking in SCMI subsystem > Add a struct for tracking statistics > Add scmi_log_stats op/no-op function for incrementing statistics > Hi Luke, good that you keep a summary of viersion changes in the series you are posting to aid in review....but... > Signed-off-by: Luke Parkin ...you need a --- ...separator here before the summary > v1->v2 > Config option now depends on DEBUG_FS > Add scmi_log_stats rather than if(IS_ENABLED) > Move location of scmi_debug_stats in the scmi_info struct ...if not this sumamry info will be kept in the final merged commit message, which is not what we want...this is only for the sake of reviews... > --- > drivers/firmware/arm_scmi/Kconfig | 11 +++++++++++ > drivers/firmware/arm_scmi/common.h | 9 +++++++++ > drivers/firmware/arm_scmi/driver.c | 18 ++++++++++++++++++ > 3 files changed, 38 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/Kconfig > index aa5842be19b2..45e8e7df927e 100644 > --- a/drivers/firmware/arm_scmi/Kconfig > +++ b/drivers/firmware/arm_scmi/Kconfig > @@ -55,6 +55,17 @@ config ARM_SCMI_RAW_MODE_SUPPORT_COEX > operate normally, thing which could make an SCMI test suite using the > SCMI Raw mode support unreliable. If unsure, say N. > > +config ARM_SCMI_DEBUG_STATISTICS > + bool "Enable SCMI Raw mode statistic tracking" > + select ARM_SCMI_NEED_DEBUGFS > + depends on DEBUG_FS > + help > + Enables statistic tracking for the SCMI subsystem. > + > + Enable this option to create a new debugfs directory which contains > + several useful statistics on various SCMI features. This can be useful > + for debugging and SCMI monitoring. If unsure, say N. > + > config ARM_SCMI_HAVE_TRANSPORT > bool > help > diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h > index b5ac25dbc1ca..1f50c4a209d7 100644 > --- a/drivers/firmware/arm_scmi/common.h > +++ b/drivers/firmware/arm_scmi/common.h > @@ -301,6 +301,15 @@ extern const struct scmi_desc scmi_optee_desc; > > void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv); > > +#ifdef CONFIG_ARM_SCMI_DEBUG_STATISTICS > +static inline void scmi_log_stats(atomic_t *atm) > +{ > + atomic_inc(atm); > +} > +#else > +static inline void scmi_log_stats(atomic_t *atm) {} > +#endif > + > enum scmi_bad_msg { > MSG_UNEXPECTED = -1, > MSG_INVALID = -2, > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index 56a93d20bf23..df3eb17cf439 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -125,6 +125,22 @@ struct scmi_debug_info { > bool is_atomic; > }; > > +/** > + * struct scmi_debug_stats - Debug statistics > + * @sent_ok: Count of successful sends > + * @sent_fail: Count of failed sends > + * @response_ok: Count of successful responses > + * @dlyd_response_ok: Count of successful delayed responses > + * @xfers_response_timeout: Count of xfer response timeouts > + */ > +struct scmi_debug_stats { > + atomic_t sent_ok; > + atomic_t sent_fail; > + atomic_t response_ok; > + atomic_t dlyd_response_ok; > + atomic_t xfers_response_timeout; > +}; > + > /** > * struct scmi_info - Structure representing a SCMI instance > * > @@ -161,6 +177,7 @@ struct scmi_debug_info { > * bus > * @devreq_mtx: A mutex to serialize device creation for this SCMI instance > * @dbg: A pointer to debugfs related data (if any) > + * @stats: Contains several atomic_t's for tracking various statistics > * @raw: An opaque reference handle used by SCMI Raw mode. > */ > struct scmi_info { > @@ -187,6 +204,7 @@ struct scmi_info { > /* Serialize device creation process for this instance */ > struct mutex devreq_mtx; > struct scmi_debug_info *dbg; > + struct scmi_debug_stats stats; > void *raw; > }; Once the above nitpicks are fixed, I think this is good enough for our purposes for now; optionally we could quickly move to a macro-based machinery to avoid carrying the stats field in full even when STATS=n if someone prefers that way... .... but...I will ask you anyway to add a few more stats in the next patch by splitting a few of the existing ones... Thanks, Cristian