All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bean Huo <huobean@gmail.com>
To: daejun7.park@samsung.com, Greg KH <gregkh@linuxfoundation.org>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"cang@codeaurora.org" <cang@codeaurora.org>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	ALIM AKHTAR <alim.akhtar@samsung.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sung-Jun Park <sungjun07.park@samsung.com>,
	yongmyung lee <ymhungry.lee@samsung.com>,
	Jinyoung CHOI <j-young.choi@samsung.com>,
	BoRam Shin <boram.shin@samsung.com>,
	SEUNGUK SHIN <seunguk.shin@samsung.com>
Subject: Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read
Date: Fri, 05 Feb 2021 12:15:39 +0100	[thread overview]
Message-ID: <218be362c71a9cdb8312f6d8156a0935985aae04.camel@gmail.com> (raw)
In-Reply-To: <20210129053005epcms2p323338fbb83459d2786fc0ef92701b147@epcms2p3>

On Fri, 2021-01-29 at 14:30 +0900, Daejun Park wrote:
> +static void ufshpb_set_read_buf_cmd(unsigned char *cdb, int rgn_idx,
> +                                          int srgn_idx, int
> srgn_mem_size)
> +{
> +       cdb[0] = UFSHPB_READ_BUFFER;
> +       cdb[1] = UFSHPB_READ_BUFFER_ID;
> +
> +       put_unaligned_be16(rgn_idx, &cdb[2]);
> +       put_unaligned_be16(srgn_idx, &cdb[4]);
> +       put_unaligned_be24(srgn_mem_size, &cdb[6]);
> +
> +       cdb[9] = 0x00;
> +}
> +
> +static int ufshpb_execute_map_req(struct ufshpb_lu *hpb,
> +                                 struct ufshpb_req *map_req)
> +{
> +       struct request_queue *q;
> +       struct request *req;
> +       struct scsi_request *rq;
> +       int ret = 0;
> +       int i;
> +
> +       q = hpb->sdev_ufs_lu->request_queue;
> +       for (i = 0; i < hpb->pages_per_srgn; i++) {
> +               ret = bio_add_pc_page(q, map_req->bio, map_req->mctx-
> >m_page[i],
> +                                     PAGE_SIZE, 0);
> +               if (ret != PAGE_SIZE) {
> +                       dev_err(&hpb->sdev_ufs_lu->sdev_dev,
> +                                  "bio_add_pc_page fail %d - %d\n",
> +                                  map_req->rgn_idx, map_req-
> >srgn_idx);
> +                       return ret;
> +               }
> +       }
> +
> +       req = map_req->req;
> +
> +       blk_rq_append_bio(req, &map_req->bio);
> +
> +       req->end_io_data = map_req;
> +
> +       rq = scsi_req(req);
> +       ufshpb_set_read_buf_cmd(rq->cmd, map_req->rgn_idx,
> +                               map_req->srgn_idx, hpb-
> >srgn_mem_size);

Hi Daejun

Thanks for your hard-working on the HPB driver.

I found you didn't take into account of allocation Length of the last
sub-region of the last region.

UFS HPB spec: 

"If the requested field of the HPB Region or HPB Sub-Region is out of
range, then the device shall terminate the command by sending RESPONSE
UPIU with CHECK CONDITION status, with the SENSE KEY set to ILLEGAL
REQUEST, and the additional sense code set to INVALID FIELD IN CDB"


Below codes are from my RFC HPB patchset:

https://patchwork.kernel.org/project/linux-scsi/patch/20200504142032.16619-6-beanhuo@micron.com/

+	alloc_len = hpb->hba->hpb_geo.subregion_entry_sz;
+	/*
+	 * HPB Sub-Regions are equally sized except for the last one
which is
+	 * smaller if the last hpb Region is not an integer multiple of
+	 * bHPBSubRegionSize.
+	 */
+	if (map_req->region == (hpb->lu_region_cnt - 1) &&
+	    map_req->subregion == (hpb->subregions_in_last_region - 1))
+		alloc_len = hpb->last_subregion_entry_size;
+
+	ufshpb_prepare_read_buf_cmd(ureq->cmd, map_req->region,
+				    map_req->subregion, alloc_len);
+	if (!ureq->req) {
+		ureq->req = blk_get_request(q, REQ_OP_SCSI_IN, 0);
+		if (IS_ERR(ureq->req)) {
+			ret =  PTR_ERR(ureq->req);
+			goto free_mem;
+		}
+	}

please fix it in your next version patch. thanks.


Kind regards,
Bean




  reply	other threads:[~2021-02-05 11:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5@epcms2p6>
2021-01-29  5:28 ` [PATCH v19 0/3] scsi: ufs: Add Host Performance Booster Support Daejun Park
     [not found]   ` <CGME20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5@epcms2p3>
2021-01-29  5:30     ` [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read Daejun Park
2021-02-05 11:15       ` Bean Huo [this message]
2021-02-05 11:42         ` Avri Altman
2021-02-05 11:54           ` Bean Huo
     [not found]           ` <CGME20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5@epcms2p2>
2021-02-08  8:00             ` Daejun Park
2021-02-06  7:23       ` Can Guo
2021-02-06  9:14         ` Bean Huo
2021-02-06 19:17         ` Avri Altman
2021-02-08  7:21       ` Can Guo
     [not found]   ` <CGME20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5@epcms2p5>
2021-01-29  5:30     ` [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region Daejun Park
2021-02-05  3:29       ` Can Guo
2021-02-05 12:35         ` Bean Huo
2021-02-05 14:06           ` Avri Altman
2021-02-05 15:08             ` Bean Huo
2021-02-07  7:36               ` Can Guo
2021-02-07 10:44                 ` Bean Huo
2021-02-09 13:25             ` Avri Altman
2021-02-09 14:21               ` Bean Huo
2021-02-10  5:32                 ` Can Guo
2021-02-08  8:16         ` Bean Huo
2021-02-08  9:58           ` Can Guo
2021-02-10  9:36       ` Avri Altman
2021-02-08  8:03     ` Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read Daejun Park
2021-02-08  8:34       ` Can Guo
     [not found]   ` <CGME20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5@epcms2p1>
2021-01-29  5:29     ` [PATCH v19 1/3] scsi: ufs: Introduce HPB feature Daejun Park
2021-02-02  7:46       ` Avri Altman
2021-02-02 11:12         ` Greg KH
2021-02-08  8:53     ` Re: [PATCH v19 2/3] scsi: ufs: L2P map management for HPB read Daejun Park
2021-02-08  9:23       ` Can Guo
     [not found]       ` <CGME20210129052848epcms2p6e5797efd94e6282b76ad9ae6c99e3ab5@epcms2p8>
2021-02-09  1:27         ` Daejun Park
2021-02-09  2:28           ` Can Guo
2021-02-08  8:01 ` 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=218be362c71a9cdb8312f6d8156a0935985aae04.camel@gmail.com \
    --to=huobean@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=boram.shin@samsung.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=daejun7.park@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=j-young.choi@samsung.com \
    --cc=jejb@linux.ibm.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 \
    --cc=ymhungry.lee@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.