mirror of
https://github.com/torvalds/linux.git
synced 2025-11-01 00:58:39 +02:00
include: trace: Add tracepoint support for inflight xfer count
Enhance the existing SCMI transfer tracepoints by including the current in-flight transfer count in `scmi_xfer_begin` and `scmi_xfer_end`. Introduce a new helper `scmi_inflight_count()` to retrieve the active transfer count from the SCMI debug counters when debug is enabled. This trace data is useful for visualizing transfer activity over time and identifying congestion or unexpected behavior in SCMI messaging. Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Signed-off-by: Philip Radford <philip.radford@arm.com> Message-Id: <20250630105544.531723-4-philip.radford@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
parent
a9cd861e61
commit
f8e656382b
4 changed files with 34 additions and 14 deletions
|
|
@ -505,4 +505,5 @@ static struct platform_driver __drv = { \
|
|||
void scmi_notification_instance_data_set(const struct scmi_handle *handle,
|
||||
void *priv);
|
||||
void *scmi_notification_instance_data_get(const struct scmi_handle *handle);
|
||||
int scmi_inflight_count(const struct scmi_handle *handle);
|
||||
#endif /* _SCMI_COMMON_H */
|
||||
|
|
|
|||
|
|
@ -1443,7 +1443,8 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
|
|||
|
||||
trace_scmi_xfer_begin(xfer->transfer_id, xfer->hdr.id,
|
||||
xfer->hdr.protocol_id, xfer->hdr.seq,
|
||||
xfer->hdr.poll_completion);
|
||||
xfer->hdr.poll_completion,
|
||||
scmi_inflight_count(&info->handle));
|
||||
|
||||
/* Clear any stale status */
|
||||
xfer->hdr.status = SCMI_SUCCESS;
|
||||
|
|
@ -1479,7 +1480,8 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
|
|||
info->desc->ops->mark_txdone(cinfo, ret, xfer);
|
||||
|
||||
trace_scmi_xfer_end(xfer->transfer_id, xfer->hdr.id,
|
||||
xfer->hdr.protocol_id, xfer->hdr.seq, ret);
|
||||
xfer->hdr.protocol_id, xfer->hdr.seq, ret,
|
||||
scmi_inflight_count(&info->handle));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -3416,6 +3418,17 @@ static struct dentry *scmi_debugfs_init(void)
|
|||
return d;
|
||||
}
|
||||
|
||||
int scmi_inflight_count(const struct scmi_handle *handle)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS)) {
|
||||
struct scmi_info *info = handle_to_scmi_info(handle);
|
||||
|
||||
return atomic_read(&info->dbg->counters[XFERS_INFLIGHT]);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int __init scmi_driver_init(void)
|
||||
{
|
||||
scmi_quirks_initialize();
|
||||
|
|
|
|||
|
|
@ -475,7 +475,8 @@ static void scmi_xfer_raw_worker(struct work_struct *work)
|
|||
raw->desc->ops->mark_txdone(rw->cinfo, ret, xfer);
|
||||
|
||||
trace_scmi_xfer_end(xfer->transfer_id, xfer->hdr.id,
|
||||
xfer->hdr.protocol_id, xfer->hdr.seq, ret);
|
||||
xfer->hdr.protocol_id, xfer->hdr.seq,
|
||||
ret, scmi_inflight_count(raw->handle));
|
||||
|
||||
/* Wait also for an async delayed response if needed */
|
||||
if (!ret && xfer->async_done) {
|
||||
|
|
@ -642,7 +643,8 @@ static int scmi_do_xfer_raw_start(struct scmi_raw_mode_info *raw,
|
|||
|
||||
trace_scmi_xfer_begin(xfer->transfer_id, xfer->hdr.id,
|
||||
xfer->hdr.protocol_id, xfer->hdr.seq,
|
||||
xfer->hdr.poll_completion);
|
||||
xfer->hdr.poll_completion,
|
||||
scmi_inflight_count(raw->handle));
|
||||
|
||||
ret = raw->desc->ops->send_message(rw->cinfo, xfer);
|
||||
if (ret) {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ TRACE_EVENT(scmi_fc_call,
|
|||
|
||||
TRACE_EVENT(scmi_xfer_begin,
|
||||
TP_PROTO(int transfer_id, u8 msg_id, u8 protocol_id, u16 seq,
|
||||
bool poll),
|
||||
TP_ARGS(transfer_id, msg_id, protocol_id, seq, poll),
|
||||
bool poll, int inflight),
|
||||
TP_ARGS(transfer_id, msg_id, protocol_id, seq, poll, inflight),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(int, transfer_id)
|
||||
|
|
@ -45,6 +45,7 @@ TRACE_EVENT(scmi_xfer_begin,
|
|||
__field(u8, protocol_id)
|
||||
__field(u16, seq)
|
||||
__field(bool, poll)
|
||||
__field(int, inflight)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
|
|
@ -53,11 +54,12 @@ TRACE_EVENT(scmi_xfer_begin,
|
|||
__entry->protocol_id = protocol_id;
|
||||
__entry->seq = seq;
|
||||
__entry->poll = poll;
|
||||
__entry->inflight = inflight;
|
||||
),
|
||||
|
||||
TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X poll=%u",
|
||||
__entry->protocol_id, __entry->msg_id, __entry->seq,
|
||||
__entry->transfer_id, __entry->poll)
|
||||
TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X poll=%u inflight=%d",
|
||||
__entry->protocol_id, __entry->msg_id, __entry->seq,
|
||||
__entry->transfer_id, __entry->poll, __entry->inflight)
|
||||
);
|
||||
|
||||
TRACE_EVENT(scmi_xfer_response_wait,
|
||||
|
|
@ -90,8 +92,8 @@ TRACE_EVENT(scmi_xfer_response_wait,
|
|||
|
||||
TRACE_EVENT(scmi_xfer_end,
|
||||
TP_PROTO(int transfer_id, u8 msg_id, u8 protocol_id, u16 seq,
|
||||
int status),
|
||||
TP_ARGS(transfer_id, msg_id, protocol_id, seq, status),
|
||||
int status, int inflight),
|
||||
TP_ARGS(transfer_id, msg_id, protocol_id, seq, status, inflight),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(int, transfer_id)
|
||||
|
|
@ -99,6 +101,7 @@ TRACE_EVENT(scmi_xfer_end,
|
|||
__field(u8, protocol_id)
|
||||
__field(u16, seq)
|
||||
__field(int, status)
|
||||
__field(int, inflight)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
|
|
@ -107,11 +110,12 @@ TRACE_EVENT(scmi_xfer_end,
|
|||
__entry->protocol_id = protocol_id;
|
||||
__entry->seq = seq;
|
||||
__entry->status = status;
|
||||
__entry->inflight = inflight;
|
||||
),
|
||||
|
||||
TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X s=%d",
|
||||
__entry->protocol_id, __entry->msg_id, __entry->seq,
|
||||
__entry->transfer_id, __entry->status)
|
||||
TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X s=%d inflight=%d",
|
||||
__entry->protocol_id, __entry->msg_id, __entry->seq,
|
||||
__entry->transfer_id, __entry->status, __entry->inflight)
|
||||
);
|
||||
|
||||
TRACE_EVENT(scmi_rx_done,
|
||||
|
|
|
|||
Loading…
Reference in a new issue