mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
firmware: arm_scmi: Track number of inflight SCMI transfers
Add a new debug counter, `XFERS_INFLIGHT`, to track the number of currently active in-flight SCMI message transfers. This helps in understanding system behavior and diagnosing potential issues with pending or stuck messages. The counter is incremented when a transfer is registered as in-flight, and decremented when it completes and is released. It is automatically added to debugfs for visibility through SCMI debugfs. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Philip Radford <philip.radford@arm.com> Message-Id: <20250630105544.531723-3-philip.radford@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
parent
555e9174ef
commit
a9cd861e61
|
|
@ -305,6 +305,7 @@ enum debug_counters {
|
|||
ERR_MSG_INVALID,
|
||||
ERR_MSG_NOMEM,
|
||||
ERR_PROTOCOL,
|
||||
XFERS_INFLIGHT,
|
||||
SCMI_DEBUG_COUNTERS_LAST
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ struct scmi_info {
|
|||
};
|
||||
|
||||
#define handle_to_scmi_info(h) container_of(h, struct scmi_info, handle)
|
||||
#define tx_minfo_to_scmi_info(h) container_of(h, struct scmi_info, tx_minfo)
|
||||
#define bus_nb_to_scmi_info(nb) container_of(nb, struct scmi_info, bus_nb)
|
||||
#define req_nb_to_scmi_info(nb) container_of(nb, struct scmi_info, dev_req_nb)
|
||||
|
||||
|
|
@ -603,9 +604,14 @@ static inline void
|
|||
scmi_xfer_inflight_register_unlocked(struct scmi_xfer *xfer,
|
||||
struct scmi_xfers_info *minfo)
|
||||
{
|
||||
/* In this context minfo will be tx_minfo due to the xfer pending */
|
||||
struct scmi_info *info = tx_minfo_to_scmi_info(minfo);
|
||||
|
||||
/* Set in-flight */
|
||||
set_bit(xfer->hdr.seq, minfo->xfer_alloc_table);
|
||||
hash_add(minfo->pending_xfers, &xfer->node, xfer->hdr.seq);
|
||||
scmi_inc_count(info->dbg->counters, XFERS_INFLIGHT);
|
||||
|
||||
xfer->pending = true;
|
||||
}
|
||||
|
||||
|
|
@ -807,9 +813,13 @@ __scmi_xfer_put(struct scmi_xfers_info *minfo, struct scmi_xfer *xfer)
|
|||
spin_lock_irqsave(&minfo->xfer_lock, flags);
|
||||
if (refcount_dec_and_test(&xfer->users)) {
|
||||
if (xfer->pending) {
|
||||
struct scmi_info *info = tx_minfo_to_scmi_info(minfo);
|
||||
|
||||
scmi_xfer_token_clear(minfo, xfer);
|
||||
hash_del(&xfer->node);
|
||||
xfer->pending = false;
|
||||
|
||||
scmi_dec_count(info->dbg->counters, XFERS_INFLIGHT);
|
||||
}
|
||||
hlist_add_head(&xfer->node, &minfo->free_xfers);
|
||||
}
|
||||
|
|
@ -2912,6 +2922,7 @@ static const char * const dbg_counter_strs[] = {
|
|||
"err_msg_invalid",
|
||||
"err_msg_nomem",
|
||||
"err_protocol",
|
||||
"xfers_inflight",
|
||||
};
|
||||
|
||||
static ssize_t reset_all_on_write(struct file *filp, const char __user *buf,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user