From: Luke Parkin <luke.parkin@arm.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org
Cc: sudeep.holla@arm.com, cristian.marussi@arm.com,
Luke Parkin <luke.parkin@arm.com>
Subject: [PATCH v2 2/4] firmware: arm_scmi: Add support for tracking statistics
Date: Wed, 3 Jul 2024 15:37:36 +0100 [thread overview]
Message-ID: <20240703143738.2007457-3-luke.parkin@arm.com> (raw)
In-Reply-To: <20240703143738.2007457-1-luke.parkin@arm.com>
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
Signed-off-by: Luke Parkin <luke.parkin@arm.com>
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
---
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;
};
--
2.34.1
next prev parent reply other threads:[~2024-07-03 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 14:37 [PATCH v2 0/4] Add Per-transport SCMI debug statistics Luke Parkin
2024-07-03 14:37 ` [PATCH v2 1/4] firmware: arm_scmi: Remove superfluous handle_to_scmi_info Luke Parkin
2024-07-08 11:08 ` Cristian Marussi
2024-07-03 14:37 ` Luke Parkin [this message]
2024-07-08 13:01 ` [PATCH v2 2/4] firmware: arm_scmi: Add support for tracking statistics Cristian Marussi
2024-07-03 14:37 ` [PATCH v2 3/4] firmware: arm_scmi: Track basic SCMI statistics Luke Parkin
2024-07-08 14:00 ` Cristian Marussi
2024-07-03 14:37 ` [PATCH v2 4/4] firmware: arm_scmi: Create debugfs files for statistics Luke Parkin
2024-07-08 14:07 ` Cristian Marussi
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=20240703143738.2007457-3-luke.parkin@arm.com \
--to=luke.parkin@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=sudeep.holla@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®