Re: [PATCH] soc: qcom: rpmh-rsc: Include state in trace event

From: Konrad Dybcio
Date: Tue Jun 20 2023 - 20:36:59 EST


On 21.06.2023 01:00, Bjorn Andersson wrote:
> When tracing messages written to the RSC it's very useful to know the
> type of TCS being targeted, in particular if/when the code borrows a
> WAKE TCS for ACTIVE votes.
>
> Add the "state" of the message to the traced information.
>
> While at it, drop the "send-msg:" substring, as this is already captured
> by the trace event itself.
>
> Signed-off-by: Bjorn Andersson <quic_bjorande@xxxxxxxxxxx>
> ---
Acked-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>

Konrad
> drivers/soc/qcom/rpmh-rsc.c | 2 +-
> drivers/soc/qcom/trace-rpmh.h | 16 ++++++++++++----
> 2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index 0dd4363ebac8..a021dc71807b 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -516,7 +516,7 @@ static void __tcs_buffer_write(struct rsc_drv *drv, int tcs_id, int cmd_id,
> write_tcs_cmd(drv, drv->regs[RSC_DRV_CMD_MSGID], tcs_id, j, msgid);
> write_tcs_cmd(drv, drv->regs[RSC_DRV_CMD_ADDR], tcs_id, j, cmd->addr);
> write_tcs_cmd(drv, drv->regs[RSC_DRV_CMD_DATA], tcs_id, j, cmd->data);
> - trace_rpmh_send_msg(drv, tcs_id, j, msgid, cmd);
> + trace_rpmh_send_msg(drv, tcs_id, msg->state, j, msgid, cmd);
> }
>
> cmd_enable |= read_tcs_reg(drv, drv->regs[RSC_DRV_CMD_ENABLE], tcs_id);
> diff --git a/drivers/soc/qcom/trace-rpmh.h b/drivers/soc/qcom/trace-rpmh.h
> index 12b676b20cb2..be6b42ecc1f8 100644
> --- a/drivers/soc/qcom/trace-rpmh.h
> +++ b/drivers/soc/qcom/trace-rpmh.h
> @@ -38,14 +38,15 @@ TRACE_EVENT(rpmh_tx_done,
>
> TRACE_EVENT(rpmh_send_msg,
>
> - TP_PROTO(struct rsc_drv *d, int m, int n, u32 h,
> + TP_PROTO(struct rsc_drv *d, int m, enum rpmh_state state, int n, u32 h,
> const struct tcs_cmd *c),
>
> - TP_ARGS(d, m, n, h, c),
> + TP_ARGS(d, m, state, n, h, c),
>
> TP_STRUCT__entry(
> __string(name, d->name)
> __field(int, m)
> + __field(u32, state)
> __field(int, n)
> __field(u32, hdr)
> __field(u32, addr)
> @@ -56,6 +57,7 @@ TRACE_EVENT(rpmh_send_msg,
> TP_fast_assign(
> __assign_str(name, d->name);
> __entry->m = m;
> + __entry->state = state;
> __entry->n = n;
> __entry->hdr = h;
> __entry->addr = c->addr;
> @@ -63,8 +65,14 @@ TRACE_EVENT(rpmh_send_msg,
> __entry->wait = c->wait;
> ),
>
> - TP_printk("%s: send-msg: tcs(m): %d cmd(n): %d msgid: %#x addr: %#x data: %#x complete: %d",
> - __get_str(name), __entry->m, __entry->n, __entry->hdr,
> + TP_printk("%s: tcs(m): %d [%s] cmd(n): %d msgid: %#x addr: %#x data: %#x complete: %d",
> + __get_str(name), __entry->m,
> + __print_symbolic(__entry->state,
> + { RPMH_SLEEP_STATE, "sleep" },
> + { RPMH_WAKE_ONLY_STATE, "wake" },
> + { RPMH_ACTIVE_ONLY_STATE, "active" }),
> + __entry->n,
> + __entry->hdr,
> __entry->addr, __entry->data, __entry->wait)
> );
>