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 2770FC3DA64 for ; Wed, 31 Jul 2024 12:55:47 +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=mZZpyzLHyyEhV3Y8TSUKg7182k5lHEaYYF5UgYpGVz0=; b=dst979fjGALr9p7G5LmIUq7OFy AJbFoEeEws+9y8fL+KZNGNQhmmdNnZoOY3EWxTIOQyRariC4odEAfkGfevrpIEuE0EIBpbpIPDwrK 7kUWnXTJw5AbRngkG0GjaIaLMR29d0uQIHlqKXdipUjQSC+JSpOjT5b8G7pjlhvYr05wR4u+ejI/a hZ2z3EkfZQU7R0Ik58ijB+mulEHSiV6zrg8XMgCvIWBA2MuWTAYCnGyOrCMgF11P1eT0BCJ1KSTNO KLXBNyATQABsN5wSwFUSFU5HvFYovnXweAk1RuMlXnmTZmR/J+bM0ZfYj5PDf0dcoLz2P+asyt6KS LBHCsb7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ8ra-00000001C1Z-3kxT; Wed, 31 Jul 2024 12:55:30 +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 1sZ8r7-00000001Bsm-0ERp for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2024 12:55:02 +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 170CE1007; Wed, 31 Jul 2024 05:55:26 -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 80E553F766; Wed, 31 Jul 2024 05:54:59 -0700 (PDT) Date: Wed, 31 Jul 2024 13:54:57 +0100 From: Cristian Marussi To: Sudeep Holla Cc: Cristian Marussi , Luke Parkin , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org Subject: Re: [PATCH v4 4/5] firmware: arm_scmi: Create debugfs files for counts Message-ID: References: <20240730093342.3558162-1-luke.parkin@arm.com> <20240730093342.3558162-5-luke.parkin@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_055501_206460_DA21D399 X-CRM114-Status: GOOD ( 28.62 ) 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 31, 2024 at 01:40:49PM +0100, Sudeep Holla wrote: > On Wed, Jul 31, 2024 at 01:32:00PM +0100, Cristian Marussi wrote: > > On Wed, Jul 31, 2024 at 01:11:22PM +0100, Sudeep Holla wrote: > > > On Tue, Jul 30, 2024 at 10:33:41AM +0100, Luke Parkin wrote: > > > > Create debugfs files for the metrics in the debug_counters array > > > > > > > > Signed-off-by: Luke Parkin > > > > --- > > > > v3->v4 > > > > Use new locations for debug array > > > > Use counter instead of stats > > > > v2->v3 > > > > Add extra statistics also added in v3 > > > > v1->v2 > > > > Only create stats pointer if stats are enabled > > > > Move stats debugfs creation into a seperate helper function > > > > --- > > > > drivers/firmware/arm_scmi/driver.c | 38 ++++++++++++++++++++++++++++++ > > > > 1 file changed, 38 insertions(+) > > > > > > > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > > > > index 5acd3d324def..ec6434692d1a 100644 > > > > --- a/drivers/firmware/arm_scmi/driver.c > > > > +++ b/drivers/firmware/arm_scmi/driver.c > > > > @@ -2847,6 +2847,41 @@ static int scmi_device_request_notifier(struct notifier_block *nb, > > > > return NOTIFY_OK; > > > > } > > > > > > > > +static void scmi_debugfs_counters_setup(struct scmi_debug_info *dbg, > > > > + struct dentry *trans) > > > > +{ > > > > + struct dentry *counters; > > > > + > > > > + counters = debugfs_create_dir("counters", trans); > > > > + > > > > + debugfs_create_atomic_t("sent_ok", 0400, counters, > > > > + &dbg->counters[SENT_OK]); > > > > + debugfs_create_atomic_t("sent_fail", 0400, counters, > > > > + &dbg->counters[SENT_FAIL]); > > > > + debugfs_create_atomic_t("sent_fail_polling_unsupported", 0400, counters, > > > > + &dbg->counters[SENT_FAIL_POLLING_UNSUPPORTED]); > > > > + debugfs_create_atomic_t("sent_fail_channel_not_found", 0400, counters, > > > > + &dbg->counters[SENT_FAIL_CHANNEL_NOT_FOUND]); > > > > + debugfs_create_atomic_t("response_ok", 0400, counters, > > > > + &dbg->counters[RESPONSE_OK]); > > > > + debugfs_create_atomic_t("notif_ok", 0400, counters, > > > > + &dbg->counters[NOTIF_OK]); > > > > + debugfs_create_atomic_t("dlyd_resp_ok", 0400, counters, > > > > + &dbg->counters[DLYD_RESPONSE_OK]); > > > > + debugfs_create_atomic_t("xfers_resp_timeout", 0400, counters, > > > > + &dbg->counters[XFERS_RESPONSE_TIMEOUT]); > > > > + debugfs_create_atomic_t("response_polled_ok", 0400, counters, > > > > + &dbg->counters[RESPONSE_POLLED_OK]); > > > > + debugfs_create_atomic_t("err_msg_unexpected", 0400, counters, > > > > + &dbg->counters[ERR_MSG_UNEXPECTED]); > > > > + debugfs_create_atomic_t("err_msg_invalid", 0400, counters, > > > > + &dbg->counters[ERR_MSG_INVALID]); > > > > + debugfs_create_atomic_t("err_msg_nomem", 0400, counters, > > > > + &dbg->counters[ERR_MSG_NOMEM]); > > > > + debugfs_create_atomic_t("err_protocol", 0400, counters, > > > > + &dbg->counters[ERR_PROTOCOL]); > > > > > > Just curious and wonder if we can keep all these read-only and have another > > > debugfs file which is write only to just reset the counters ? > > > > > > Cristian, > > > > > > Thoughts ? Or am I missing somthing ? > > > > Do you mean creating a bunch of additional reset_sent_ok > > reset_ that are just WO and used to reset each single > > counter ? > > No, not at all. Sorry if my response meant that. > > > (...I suppose because a global WO reset-all is already there...) > > > > Indeed, I hadn't seen it carefully. Do we really need per counter reset ? > For me one global reset all with all files read-only should suffice. > Let me know if and why you think otherwise. Well we don't need strictly anything since it is a debug/devel feat, it just seemed handy to have a way to just reset one of the counters you are actively working on, if you think about a testing or live devel scenario...but it is not really needed and I have no strong opinion about this...it was just a nice to have I asked Luke to add last minute... ...patch 5 indeed already adds also a global WO reset, beside switching all the above counters to RW...it is just a matter to drop those RO->RW perms changes in patch 5. Thanks, Cristian