From: Sudeep Holla <sudeep.holla@arm.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org
Cc: Sudeep Holla <sudeep.holla@arm.com>,
Cristian Marussi <cristian.marussi@arm.com>,
Luke Parkin <luke.parkin@arm.com>
Subject: [PATCH v5 2/5] firmware: arm_scmi: Add support for debug metrics at the interface
Date: Mon, 5 Aug 2024 14:10:09 +0100 [thread overview]
Message-ID: <20240805131013.587016-3-sudeep.holla@arm.com> (raw)
In-Reply-To: <20240805131013.587016-1-sudeep.holla@arm.com>
From: Luke Parkin <luke.parkin@arm.com>
Since SCMI involves interaction with the entity(software, firmware and/or
hardware) providing services or features, it is quite useful to track
certain metrics(for pure debugging purposes) like how many messages were
sent or received, were there any failures, what kind of failures, ..etc.
Add a new optional config option for the above purpose and the initial
support for counting such key debug metrics.
Signed-off-by: Luke Parkin <luke.parkin@arm.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/firmware/arm_scmi/Kconfig | 14 ++++++++++++++
drivers/firmware/arm_scmi/common.h | 10 ++++++++++
drivers/firmware/arm_scmi/driver.c | 2 ++
3 files changed, 26 insertions(+)
diff --git a/drivers/firmware/arm_scmi/Kconfig b/drivers/firmware/arm_scmi/Kconfig
index aa5842be19b2..f35784d0a8dd 100644
--- a/drivers/firmware/arm_scmi/Kconfig
+++ b/drivers/firmware/arm_scmi/Kconfig
@@ -55,6 +55,20 @@ 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_COUNTERS
+ bool "Enable SCMI communication debug metrics tracking"
+ select ARM_SCMI_NEED_DEBUGFS
+ depends on DEBUG_FS
+ default n
+ help
+ Enables tracking of some key communication metrics for debug
+ purposes. It may track metrics like how many messages were sent
+ or received, were there any failures, what kind of failures, ..etc.
+
+ Enable this option to create a new debugfs directory which contains
+ such useful debug counters. This can be helpful for debugging and
+ SCMI monitoring.
+
config ARM_SCMI_HAVE_TRANSPORT
bool
help
diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
index 4b8c5250cdb5..d414b0a43b3b 100644
--- a/drivers/firmware/arm_scmi/common.h
+++ b/drivers/firmware/arm_scmi/common.h
@@ -301,6 +301,16 @@ extern const struct scmi_desc scmi_optee_desc;
void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv);
+enum debug_counters {
+ SCMI_DEBUG_COUNTERS_LAST
+};
+
+static inline void scmi_inc_count(atomic_t *arr, int stat)
+{
+ if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS))
+ atomic_inc(&arr[stat]);
+}
+
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..958b2ac92050 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -117,12 +117,14 @@ struct scmi_protocol_instance {
* @name: Name of this SCMI instance
* @type: Type of this SCMI instance
* @is_atomic: Flag to state if the transport of this instance is atomic
+ * @counters: An array of atomic_c's used for tracking statistics (if enabled)
*/
struct scmi_debug_info {
struct dentry *top_dentry;
const char *name;
const char *type;
bool is_atomic;
+ atomic_t counters[SCMI_DEBUG_COUNTERS_LAST];
};
/**
--
2.46.0
next prev parent reply other threads:[~2024-08-05 13:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 13:10 [PATCH v5 0/5] Add per-transport SCMI communication debug statistics Sudeep Holla
2024-08-05 13:10 ` [PATCH v5 1/5] firmware: arm_scmi: Remove superfluous handle_to_scmi_info Sudeep Holla
2024-08-05 13:10 ` Sudeep Holla [this message]
2024-08-05 13:10 ` [PATCH v5 3/5] firmware: arm_scmi: Track basic SCMI communication debug metrics Sudeep Holla
2024-08-05 13:10 ` [PATCH v5 4/5] firmware: arm_scmi: Create debugfs files for " Sudeep Holla
2024-08-05 13:10 ` [PATCH v5 5/5] firmware: arm_scmi: Add support to reset the " Sudeep Holla
2024-08-05 15:12 ` [PATCH v5 0/5] Add per-transport SCMI communication debug statistics Cristian Marussi
2024-08-06 12:37 ` Sudeep Holla
2024-08-09 13:34 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240805131013.587016-3-sudeep.holla@arm.com \
--to=sudeep.holla@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke.parkin@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®