diff mbox series

[v2,2/2] scsi: pm80xx: Add pm80xx_mpi_build_cmd tracepoint

Message ID 20211115215750.131696-3-changyuanl@google.com (mailing list archive)
State Accepted
Headers show
Series This patchset adds tracepoints to pm80xx | expand

Commit Message

Changyuan Lyu Nov. 15, 2021, 9:57 p.m. UTC
pm8001_mpi_build_cmd() prepares and sends all commands to a controller.
Having pm80xx_mpi_build_cmd tracepoint can help us with latency issues.

this patch depends on patch "scsi: pm80xx: Add tracepoints".

Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
---
 drivers/scsi/pm8001/pm8001_hwi.c         |  5 +++++
 drivers/scsi/pm8001/pm80xx_tracepoints.h | 28 ++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

Comments

Jinpu Wang Nov. 16, 2021, 8:15 a.m. UTC | #1
On Mon, Nov 15, 2021 at 10:57 PM Changyuan Lyu <changyuanl@google.com> wrote:
>
> pm8001_mpi_build_cmd() prepares and sends all commands to a controller.
> Having pm80xx_mpi_build_cmd tracepoint can help us with latency issues.
>
> this patch depends on patch "scsi: pm80xx: Add tracepoints".
>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
> Signed-off-by: Changyuan Lyu <changyuanl@google.com>
looks ok, thx.
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/scsi/pm8001/pm8001_hwi.c         |  5 +++++
>  drivers/scsi/pm8001/pm80xx_tracepoints.h | 28 ++++++++++++++++++++++++
>  2 files changed, 33 insertions(+)
>
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index 124cb69740c6..a63362bdd884 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -42,6 +42,7 @@
>   #include "pm8001_hwi.h"
>   #include "pm8001_chips.h"
>   #include "pm8001_ctl.h"
> + #include "pm80xx_tracepoints.h"
>
>  /**
>   * read_main_config_table - read the configure table and save it.
> @@ -1324,6 +1325,10 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
>         unsigned long flags;
>         int q_index = circularQ - pm8001_ha->inbnd_q_tbl;
>         int rv;
> +       u32 htag = le32_to_cpu(*(__le32 *)payload);
> +
> +       trace_pm80xx_mpi_build_cmd(pm8001_ha->id, opCode, htag, q_index,
> +               circularQ->producer_idx, le32_to_cpu(circularQ->consumer_index));
>
>         WARN_ON(q_index >= PM8001_MAX_INB_NUM);
>         spin_lock_irqsave(&circularQ->iq_lock, flags);
> diff --git a/drivers/scsi/pm8001/pm80xx_tracepoints.h b/drivers/scsi/pm8001/pm80xx_tracepoints.h
> index 84fcfecfd624..5e669a8a9344 100644
> --- a/drivers/scsi/pm8001/pm80xx_tracepoints.h
> +++ b/drivers/scsi/pm8001/pm80xx_tracepoints.h
> @@ -75,6 +75,34 @@ TRACE_EVENT(pm80xx_request_complete,
>                     __entry->running_req)
>  );
>
> +TRACE_EVENT(pm80xx_mpi_build_cmd,
> +           TP_PROTO(u32 id, u32 opc, u32 htag, u32 qi, u32 pi, u32 ci),
> +
> +           TP_ARGS(id, opc, htag, qi, pi, ci),
> +
> +           TP_STRUCT__entry(
> +                   __field(u32, id)
> +                   __field(u32, opc)
> +                   __field(u32, htag)
> +                   __field(u32, qi)
> +                   __field(u32, pi)
> +                   __field(u32, ci)
> +                   ),
> +
> +           TP_fast_assign(
> +                   __entry->id = id;
> +                   __entry->opc = opc;
> +                   __entry->htag = htag;
> +                   __entry->qi = qi;
> +                   __entry->pi = pi;
> +                   __entry->ci = ci;
> +                   ),
> +
> +           TP_printk("ctlr_id = %u opc = %#x htag = %#x QI = %u PI = %u CI = %u",
> +                   __entry->id, __entry->opc, __entry->htag, __entry->qi,
> +                   __entry->pi, __entry->ci)
> +);
> +
>  #endif /* _TRACE_PM80XX_H_ */
>
>  #undef TRACE_INCLUDE_PATH
> --
> 2.34.0.rc1.387.gb447b232ab-goog
>
diff mbox series

Patch

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 124cb69740c6..a63362bdd884 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -42,6 +42,7 @@ 
  #include "pm8001_hwi.h"
  #include "pm8001_chips.h"
  #include "pm8001_ctl.h"
+ #include "pm80xx_tracepoints.h"
 
 /**
  * read_main_config_table - read the configure table and save it.
@@ -1324,6 +1325,10 @@  int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
 	unsigned long flags;
 	int q_index = circularQ - pm8001_ha->inbnd_q_tbl;
 	int rv;
+	u32 htag = le32_to_cpu(*(__le32 *)payload);
+
+	trace_pm80xx_mpi_build_cmd(pm8001_ha->id, opCode, htag, q_index,
+		circularQ->producer_idx, le32_to_cpu(circularQ->consumer_index));
 
 	WARN_ON(q_index >= PM8001_MAX_INB_NUM);
 	spin_lock_irqsave(&circularQ->iq_lock, flags);
diff --git a/drivers/scsi/pm8001/pm80xx_tracepoints.h b/drivers/scsi/pm8001/pm80xx_tracepoints.h
index 84fcfecfd624..5e669a8a9344 100644
--- a/drivers/scsi/pm8001/pm80xx_tracepoints.h
+++ b/drivers/scsi/pm8001/pm80xx_tracepoints.h
@@ -75,6 +75,34 @@  TRACE_EVENT(pm80xx_request_complete,
 		    __entry->running_req)
 );
 
+TRACE_EVENT(pm80xx_mpi_build_cmd,
+	    TP_PROTO(u32 id, u32 opc, u32 htag, u32 qi, u32 pi, u32 ci),
+
+	    TP_ARGS(id, opc, htag, qi, pi, ci),
+
+	    TP_STRUCT__entry(
+		    __field(u32, id)
+		    __field(u32, opc)
+		    __field(u32, htag)
+		    __field(u32, qi)
+		    __field(u32, pi)
+		    __field(u32, ci)
+		    ),
+
+	    TP_fast_assign(
+		    __entry->id = id;
+		    __entry->opc = opc;
+		    __entry->htag = htag;
+		    __entry->qi = qi;
+		    __entry->pi = pi;
+		    __entry->ci = ci;
+		    ),
+
+	    TP_printk("ctlr_id = %u opc = %#x htag = %#x QI = %u PI = %u CI = %u",
+		    __entry->id, __entry->opc, __entry->htag, __entry->qi,
+		    __entry->pi, __entry->ci)
+);
+
 #endif /* _TRACE_PM80XX_H_ */
 
 #undef TRACE_INCLUDE_PATH