diff mbox series

[RFC,v3,1/2] ufs: introduce a callback to get info of command completion

Message ID 93c364a2285a6c8eaaed6e0f68bbc8376ae7519e.1593752220.git.kwmad.kim@samsung.com (mailing list archive)
State Superseded
Headers show
Series ufs: introduce callbacks to get command information | expand

Commit Message

Kiwoong Kim July 3, 2020, 5:31 a.m. UTC
Some SoC specific might need command history for
various reasons, such as stacking command contexts
in system memory to check for debugging in the future
or scaling some DVFS knobs to boost IO throughput.

What you would do with the information could be
variant per SoC vendor.

Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 drivers/scsi/ufs/ufshcd.h | 8 ++++++++
 2 files changed, 10 insertions(+)

Comments

Stanley Chu July 3, 2020, 5:59 a.m. UTC | #1
Hi Kiwoong,

On Fri, 2020-07-03 at 14:31 +0900, Kiwoong Kim wrote:
> Some SoC specific might need command history for
> various reasons, such as stacking command contexts
> in system memory to check for debugging in the future
> or scaling some DVFS knobs to boost IO throughput.
> 
> What you would do with the information could be
> variant per SoC vendor.
> 
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> ---

Please help collect all tags received in previous versions and add them
to any future new versions, for example, for this patch,

Acked-By: Stanley Chu <stanley.chu@mediatek.com>
Kiwoong Kim July 3, 2020, 7:08 a.m. UTC | #2
> Hi Kiwoong,
> 
> On Fri, 2020-07-03 at 14:31 +0900, Kiwoong Kim wrote:
> > Some SoC specific might need command history for various reasons, such
> > as stacking command contexts in system memory to check for debugging
> > in the future or scaling some DVFS knobs to boost IO throughput.
> >
> > What you would do with the information could be variant per SoC
> > vendor.
> >
> > Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> > ---
> 
> Please help collect all tags received in previous versions and add them to
> any future new versions, for example, for this patch,
> 
> Acked-By: Stanley Chu <stanley.chu@mediatek.com>
> 
> 

Oh, got it.

Thanks.
Kiwoong Kim
Avri Altman July 5, 2020, 11:37 a.m. UTC | #3
> 
> 
> Some SoC specific might need command history for
> various reasons, such as stacking command contexts
> in system memory to check for debugging in the future
> or scaling some DVFS knobs to boost IO throughput.
> 
> What you would do with the information could be
> variant per SoC vendor.
> 
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 2 ++
>  drivers/scsi/ufs/ufshcd.h | 8 ++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 52abe82..3326236 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -4882,6 +4882,7 @@ static void __ufshcd_transfer_req_compl(struct
> ufs_hba *hba,
>         for_each_set_bit(index, &completed_reqs, hba->nutrs) {
>                 lrbp = &hba->lrb[index];
>                 cmd = lrbp->cmd;
> +               ufshcd_vops_compl_xfer_req(hba, index, (cmd) ? true : false);
>                 if (cmd) {
>                         ufshcd_add_command_trace(hba, index, "complete");
>                         result = ufshcd_transfer_rsp_status(hba, lrbp);
> @@ -4890,6 +4891,7 @@ static void __ufshcd_transfer_req_compl(struct
> ufs_hba *hba,
>                         /* Mark completed command as NULL in LRB */
>                         lrbp->cmd = NULL;
>                         lrbp->compl_time_stamp = ktime_get();
> +
>                         /* Do not touch lrbp after scsi done */
>                         cmd->scsi_done(cmd);
>                         __ufshcd_release(hba);
> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
> index c774012..5cf9f99 100644
> --- a/drivers/scsi/ufs/ufshcd.h
> +++ b/drivers/scsi/ufs/ufshcd.h
> @@ -307,6 +307,7 @@ struct ufs_hba_variant_ops {
>         void    (*config_scaling_param)(struct ufs_hba *hba,
>                                         struct devfreq_dev_profile *profile,
>                                         void *data);
> +       void    (*compl_xfer_req)(struct ufs_hba *hba, int tag, bool is_scsi);
Maybe add it right after setup_xfer_req?
Makes more sense as it is its counterpart.

Thanks,
Avri

>  };
Kiwoong Kim July 6, 2020, 6:41 a.m. UTC | #4
> > Some SoC specific might need command history for various reasons, such
> > as stacking command contexts in system memory to check for debugging
> > in the future or scaling some DVFS knobs to boost IO throughput.
> >
> > What you would do with the information could be variant per SoC
> > vendor.
> >
> > Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> > ---
> >  drivers/scsi/ufs/ufshcd.c | 2 ++
> >  drivers/scsi/ufs/ufshcd.h | 8 ++++++++
> >  2 files changed, 10 insertions(+)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index 52abe82..3326236 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -4882,6 +4882,7 @@ static void __ufshcd_transfer_req_compl(struct
> > ufs_hba *hba,
> >         for_each_set_bit(index, &completed_reqs, hba->nutrs) {
> >                 lrbp = &hba->lrb[index];
> >                 cmd = lrbp->cmd;
> > +               ufshcd_vops_compl_xfer_req(hba, index, (cmd) ? true :
> > + false);
> >                 if (cmd) {
> >                         ufshcd_add_command_trace(hba, index, "complete");
> >                         result = ufshcd_transfer_rsp_status(hba,
> > lrbp); @@ -4890,6 +4891,7 @@ static void
> > __ufshcd_transfer_req_compl(struct
> > ufs_hba *hba,
> >                         /* Mark completed command as NULL in LRB */
> >                         lrbp->cmd = NULL;
> >                         lrbp->compl_time_stamp = ktime_get();
> > +
> >                         /* Do not touch lrbp after scsi done */
> >                         cmd->scsi_done(cmd);
> >                         __ufshcd_release(hba); diff --git
> > a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index
> > c774012..5cf9f99 100644
> > --- a/drivers/scsi/ufs/ufshcd.h
> > +++ b/drivers/scsi/ufs/ufshcd.h
> > @@ -307,6 +307,7 @@ struct ufs_hba_variant_ops {
> >         void    (*config_scaling_param)(struct ufs_hba *hba,
> >                                         struct devfreq_dev_profile *profile,
> >                                         void *data);
> > +       void    (*compl_xfer_req)(struct ufs_hba *hba, int tag, bool
> is_scsi);
> Maybe add it right after setup_xfer_req?
> Makes more sense as it is its counterpart.
> 
> Thanks,
> Avri
> 
> >  };

Got it

Thanks.
Kiwoong Kim
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 52abe82..3326236 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4882,6 +4882,7 @@  static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 	for_each_set_bit(index, &completed_reqs, hba->nutrs) {
 		lrbp = &hba->lrb[index];
 		cmd = lrbp->cmd;
+		ufshcd_vops_compl_xfer_req(hba, index, (cmd) ? true : false);
 		if (cmd) {
 			ufshcd_add_command_trace(hba, index, "complete");
 			result = ufshcd_transfer_rsp_status(hba, lrbp);
@@ -4890,6 +4891,7 @@  static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
 			/* Mark completed command as NULL in LRB */
 			lrbp->cmd = NULL;
 			lrbp->compl_time_stamp = ktime_get();
+
 			/* Do not touch lrbp after scsi done */
 			cmd->scsi_done(cmd);
 			__ufshcd_release(hba);
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index c774012..5cf9f99 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -307,6 +307,7 @@  struct ufs_hba_variant_ops {
 	void	(*config_scaling_param)(struct ufs_hba *hba,
 					struct devfreq_dev_profile *profile,
 					void *data);
+	void	(*compl_xfer_req)(struct ufs_hba *hba, int tag, bool is_scsi);
 };
 
 /* clock gating state  */
@@ -1137,6 +1138,13 @@  static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba,
 		hba->vops->config_scaling_param(hba, profile, data);
 }
 
+static inline void ufshcd_vops_compl_xfer_req(struct ufs_hba *hba,
+					      int tag, bool is_scsi)
+{
+	if (hba->vops && hba->vops->compl_xfer_req)
+		hba->vops->compl_xfer_req(hba, tag, is_scsi);
+}
+
 extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
 
 /*