linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Bean Huo <huobean@gmail.com>
Cc: daejun7.park@samsung.com, 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,
	ALIM AKHTAR <alim.akhtar@samsung.com>,
	linux-scsi@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 3/3] scsi: ufs: Prepare HPB read for cached sub-region
Date: Mon, 08 Feb 2021 17:58:47 +0800	[thread overview]
Message-ID: <8c79dfb0dc749c3c1362b57c5a9766c0@codeaurora.org> (raw)
In-Reply-To: <a95af313ee4dfb7173b0c5a23b52d2168a94f87a.camel@gmail.com>

On 2021-02-08 16:16, Bean Huo wrote:
> On Fri, 2021-02-05 at 11:29 +0800, Can Guo wrote:
>> > +     return ppn_table[offset];
>> > +}
>> > +
>> > +static void
>> > +ufshpb_get_pos_from_lpn(struct ufshpb_lu *hpb, unsigned long lpn,
>> > int
>> > *rgn_idx,
>> > +                     int *srgn_idx, int *offset)
>> > +{
>> > +     int rgn_offset;
>> > +
>> > +     *rgn_idx = lpn >> hpb->entries_per_rgn_shift;
>> > +     rgn_offset = lpn & hpb->entries_per_rgn_mask;
>> > +     *srgn_idx = rgn_offset >> hpb->entries_per_srgn_shift;
>> > +     *offset = rgn_offset & hpb->entries_per_srgn_mask;
>> > +}
>> > +
>> > +static void
>> > +ufshpb_set_hpb_read_to_upiu(struct ufshpb_lu *hpb, struct
>> > ufshcd_lrb
>> > *lrbp,
>> > +                               u32 lpn, u64 ppn,  unsigned int
>> > transfer_len)
>> > +{
>> > +     unsigned char *cdb = lrbp->cmd->cmnd;
>> > +
>> > +     cdb[0] = UFSHPB_READ;
>> > +
>> > +     put_unaligned_be64(ppn, &cdb[6]);
>> 
>> You are assuming the HPB entries read out by "HPB Read Buffer" cmd
>> are
>> in Little
>> Endian, which is why you are using put_unaligned_be64 here.
>> 
> 
> 
> Actaully, here uses put_unaligned_be64 is no problem. SCSI command
> should be big-endian filled. I Think the problem is that geting ppn
> from HPB cache in ufshpb_get_ppn().
> 

whatever...

> ...
> e0000001f: 12 34 56 78 90 fa de ef
> ...
> 
> +
> +static u64 ufshpb_get_ppn(struct ufshpb_lu *hpb,
> +			  struct ufshpb_map_ctx *mctx, int pos, int
> *error)
> +{
> +	u64 *ppn_table;  // It s a 64 bits pointer
> +	struct page *page;
> +	int index, offset;
> +
> +	index = pos / (PAGE_SIZE / HPB_ENTRY_SIZE);
> +	offset = pos % (PAGE_SIZE / HPB_ENTRY_SIZE);
> +
> +	page = mctx->m_page[index];
> +	if (unlikely(!page)) {
> +		*error = -ENOMEM;
> +		dev_err(&hpb->sdev_ufs_lu->sdev_dev,
> +			"error. cannot find page in mctx\n");
> +		return 0;
> +	}
> +
> +	ppn_table = page_address(page);
> +	if (unlikely(!ppn_table)) {
> +		*error = -ENOMEM;
> +		dev_err(&hpb->sdev_ufs_lu->sdev_dev,
> +			"error. cannot get ppn_table\n");
> +		return 0;
> +	}
> +
> +	return ppn_table[offset];
> +}
> 
> 
> 
> 
>> this assumption
>> is not right for all the other flash vendors - HPB entries read out
>> by
>> "HPB Read Buffer"
>> cmd may come in Big Endian, if so, their random read performance are
>> screwed.
>> Actually, I have seen at least two flash vendors acting so. I had to
>> modify this line
>> to get the code work properly on my setups.
>> 
>> Meanwhile, in your cover letter, you mentioned that the performance
>> data
>> is collected
>> on a UFS2.1 device. Please re-collect the data on a real UFS3.1
>> device
>> and let me
>> know the part number. Otherwise, the data is not quite convincing to
>> us.
>> 
>> Regards,
>> Can Guo.

  reply	other threads:[~2021-02-08 10:09 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
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 [this message]
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=8c79dfb0dc749c3c1362b57c5a9766c0@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=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 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).