linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: daejun7.park@samsung.com
Cc: Greg KH <gregkh@linuxfoundation.org>,
	avri.altman@wdc.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, asutoshd@codeaurora.org,
	stanley.chu@mediatek.com, bvanassche@acm.org, huobean@gmail.com,
	ALIM AKHTAR <alim.akhtar@samsung.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	JinHwan Park <jh.i.park@samsung.com>,
	Javier Gonzalez <javier.gonz@samsung.com>,
	SEUNGUK SHIN <seunguk.shin@samsung.com>,
	Sung-Jun Park <sungjun07.park@samsung.com>,
	Jinyoung CHOI <j-young.choi@samsung.com>,
	BoRam Shin <boram.shin@samsung.com>
Subject: Re: [PATCH v26 2/4] scsi: ufs: L2P map management for HPB read
Date: Fri, 12 Mar 2021 09:19:58 +0800	[thread overview]
Message-ID: <27fe9c42f4b9539f07f75b7978ab305e@codeaurora.org> (raw)
In-Reply-To: <20210303062829epcms2p678450953f611c340a2b8e88b5542fe73@epcms2p6>

On 2021-03-03 14:28, Daejun Park wrote:
> This is a patch for managing L2P map in HPB module.
> 
> The HPB divides logical addresses into several regions. A region 
> consists
> of several sub-regions. The sub-region is a basic unit where L2P 
> mapping is
> managed. The driver loads L2P mapping data of each sub-region. The 
> loaded
> sub-region is called active-state. The HPB driver unloads L2P mapping 
> data
> as region unit. The unloaded region is called inactive-state.
> 
> Sub-region/region candidates to be loaded and unloaded are delivered 
> from
> the UFS device. The UFS device delivers the recommended active 
> sub-region
> and inactivate region to the driver using sensedata.
> The HPB module performs L2P mapping management on the host through the
> delivered information.
> 
> A pinned region is a pre-set regions on the UFS device that is always
> activate-state.
> 
> The data structure for map data request and L2P map uses mempool API,
> minimizing allocation overhead while avoiding static allocation.
> 
> The mininum size of the memory pool used in the HPB is implemented
> as a module parameter, so that it can be configurable by the user.
> 
> To gurantee a minimum memory pool size of 4MB: 
> ufshpb_host_map_kbytes=4096
> 
> The map_work manages active/inactive by 2 "to-do" lists.
> Each hpb lun maintains 2 "to-do" lists:
>   hpb->lh_inact_rgn - regions to be inactivated, and
>   hpb->lh_act_srgn - subregions to be activated
> Those lists are maintained on IO completion.
> 
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>
> Reviewed-by: Can Guo <cang@codeaurora.org>
> Acked-by: Avri Altman <Avri.Altman@wdc.com>
> Tested-by: Bean Huo <beanhuo@micron.com>
> Signed-off-by: Daejun Park <daejun7.park@samsung.com>
> ---
>  drivers/scsi/ufs/ufs.h    |   36 ++
>  drivers/scsi/ufs/ufshcd.c |    4 +
>  drivers/scsi/ufs/ufshpb.c | 1091 ++++++++++++++++++++++++++++++++++++-
>  drivers/scsi/ufs/ufshpb.h |   65 +++
>  4 files changed, 1181 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index 65563635e20e..957763db1006 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -472,6 +472,41 @@ struct utp_cmd_rsp {
>  	u8 sense_data[UFS_SENSE_SIZE];
>  };
> ...
> +/*
> + * This function will parse recommended active subregion information 
> in sense
> + * data field of response UPIU with SAM_STAT_GOOD state.
> + */
> +void ufshpb_rsp_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
> +{
> +	struct ufshpb_lu *hpb = ufshpb_get_hpb_data(lrbp->cmd->device);
> +	struct utp_hpb_rsp *rsp_field = &lrbp->ucd_rsp_ptr->hr;
> +	int data_seg_len;
> +
> +	if (unlikely(lrbp->lun != rsp_field->lun)) {
> +		struct scsi_device *sdev;
> +		bool found = false;
> +
> +		__shost_for_each_device(sdev, hba->host) {
> +			hpb = ufshpb_get_hpb_data(sdev);
> +
> +			if (!hpb)
> +				continue;
> +
> +			if (rsp_field->lun == hpb->lun) {
> +				found = true;
> +				break;
> +			}
> +		}
> +
> +		if (!found)
> +			return;
> +	}
> +
> +	if (!hpb)
> +		return;
> +
> +	if ((ufshpb_get_state(hpb) != HPB_PRESENT) &&
> +	    (ufshpb_get_state(hpb) != HPB_SUSPEND)) {
> +		dev_notice(&hpb->sdev_ufs_lu->sdev_dev,
> +			   "%s: ufshpb state is not PRESENT/SUSPEND\n",
> +			   __func__);

Please mute these prints before hpb is fully initilized, otherwise
there can be tons of these prints during bootup. Say set a flag in
ufshpb_hpb_lu_prepared() and check for that flag - just a rough idea.

Thanks,
Can Guo.

> +		return;
> +	}
> +

  parent reply	other threads:[~2021-03-12  1:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210303062633epcms2p252227acd30ad15c1ca821d7e3f547b9e@epcms2p2>
2021-03-03  6:26 ` [PATCH v26 0/4] scsi: ufs: Add Host Performance Booster Support Daejun Park
     [not found]   ` <CGME20210303062633epcms2p252227acd30ad15c1ca821d7e3f547b9e@epcms2p1>
2021-03-03  6:28     ` [PATCH v26 1/4] scsi: ufs: Introduce HPB feature Daejun Park
2021-03-09  3:15       ` [PATCH] [v26,1/4] " Wang Qing
2021-03-09  6:21       ` [Resend]Re: " Wang Qing
     [not found]   ` <CGME20210303062633epcms2p252227acd30ad15c1ca821d7e3f547b9e@epcms2p6>
2021-03-03  6:28     ` [PATCH v26 2/4] scsi: ufs: L2P map management for HPB read Daejun Park
2021-03-11  8:56       ` Can Guo
2021-03-12  1:19       ` Can Guo [this message]
     [not found]       ` <CGME20210303062633epcms2p252227acd30ad15c1ca821d7e3f547b9e@epcms2p8>
2021-03-12  1:23         ` Daejun Park
     [not found]       ` <CGME20210303062633epcms2p252227acd30ad15c1ca821d7e3f547b9e@epcms2p3>
2021-03-12  1:48         ` Daejun Park
2021-03-12  2:03           ` Can Guo
2021-03-12  7:17         ` Daejun Park
2021-03-15  1:54           ` Can Guo
2021-03-03  6:29     ` [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support Daejun Park
2021-03-03 14:50       ` Bean Huo
2021-03-04  8:37         ` Can Guo
2021-03-04  6:25       ` Can Guo
2021-03-04  8:21       ` Can Guo
2021-03-04  9:59       ` Bean Huo
2021-03-09  1:38       ` Can Guo
2021-03-10  9:14         ` Can Guo
     [not found]   ` <CGME20210303062633epcms2p252227acd30ad15c1ca821d7e3f547b9e@epcms2p5>
2021-03-03  6:28     ` [PATCH v26 3/4] scsi: ufs: Prepare HPB read for cached sub-region Daejun Park
2021-03-12  1:23       ` Can Guo
2021-03-05  0:35     ` Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support Daejun Park
2021-03-15  2:19     ` Re: [PATCH v26 2/4] scsi: ufs: L2P map management for HPB read Daejun Park
2021-03-05  0:24 ` Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support Daejun Park
2021-03-05  0:33 ` Daejun Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27fe9c42f4b9539f07f75b7978ab305e@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=boram.shin@samsung.com \
    --cc=bvanassche@acm.org \
    --cc=daejun7.park@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=huobean@gmail.com \
    --cc=j-young.choi@samsung.com \
    --cc=javier.gonz@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=jh.i.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=seunguk.shin@samsung.com \
    --cc=stanley.chu@mediatek.com \
    --cc=sungjun07.park@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).