soc: qcom: rpmh-rsc: Include state in trace event

Message ID 20230620230058.428833-1-quic_bjorande@quicinc.com
State New
Headers
Series soc: qcom: rpmh-rsc: Include state in trace event |

Commit Message

Bjorn Andersson June 20, 2023, 11 p.m. UTC
  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@quicinc.com>
---
 drivers/soc/qcom/rpmh-rsc.c   |  2 +-
 drivers/soc/qcom/trace-rpmh.h | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)
  

Comments

Konrad Dybcio June 21, 2023, 12:36 a.m. UTC | #1
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@quicinc.com>
> ---
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>

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)
>  );
>
  
Manivannan Sadhasivam July 7, 2023, 12:12 p.m. UTC | #2
On Tue, Jun 20, 2023 at 04:00:58PM -0700, 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@quicinc.com>

Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  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)
>  );
>  
> -- 
> 2.25.1
>
  
Bjorn Andersson July 10, 2023, 5:07 a.m. UTC | #3
On Tue, 20 Jun 2023 16:00:58 -0700, 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.
> 
> [...]

Applied, thanks!

[1/1] soc: qcom: rpmh-rsc: Include state in trace event
      commit: 1b06d8ca087a8fd9b395b577048636926db22f0e

Best regards,
  

Patch

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)
 );