All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: Avri Altman <Avri.Altman@wdc.com>,
	Daejun Park <daejun7.park@samsung.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	"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>,
	"huobean@gmail.com" <huobean@gmail.com>,
	ALIM AKHTAR <alim.akhtar@samsung.com>,
	Javier Gonzalez <javier.gonz@samsung.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	JinHwan Park <jh.i.park@samsung.com>,
	SEUNGUK SHIN <seunguk.shin@samsung.com>,
	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>
Subject: RE: RE: [PATCH v22 2/4] scsi: ufs: L2P map management for HPB read
Date: Tue, 23 Feb 2021 17:00:43 +0900	[thread overview]
Message-ID: <20210223080043epcms2p83f813841174ade50ef97481b3f4cdef7@epcms2p8> (raw)
In-Reply-To: <DM6PR04MB657508BC3F0D0240FDCBB043FC809@DM6PR04MB6575.namprd04.prod.outlook.com>

> +/*
> > + * 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;
> > +       struct scsi_device *sdev;
> > +       struct utp_hpb_rsp *rsp_field = &lrbp->ucd_rsp_ptr->hr;
> > +       int data_seg_len;
> > +       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;
> This piece of code looks awkward, although it is probably working.
> Why not just having a reference to the hpb luns, e.g. something like:
> struct ufshpb_lu *hpb_luns[8] in struct ufs_hba.
> Less elegant - but much more effective than iterating the scsi host on every completion interrupt.

OK,

> > +               }
> > +       }
> > +
> > +       if (!found)
> > +               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__);
> > +               return;
> > +       }
> > +
> > +       data_seg_len = be32_to_cpu(lrbp->ucd_rsp_ptr->header.dword_2)
> > +               & MASK_RSP_UPIU_DATA_SEG_LEN;
> > +
> > +       /* To flush remained rsp_list, we queue the map_work task */
> > +       if (!data_seg_len) {
> data_seg_len should be 0x14

It is checking non-HPB hint UPIU. It is used for kicking map work.

> > +               if (!ufshpb_is_general_lun(hpb->lun))
> > +                       return;
> > +
> > +               ufshpb_kick_map_work(hpb);
> > +               return;
> > +       }
> > +
> > +       /* Check HPB_UPDATE_ALERT */
> > +       if (!(lrbp->ucd_rsp_ptr->header.dword_2 &
> > +             UPIU_HEADER_DWORD(0, 2, 0, 0)))
> > +               return;
> > +
> > +       BUILD_BUG_ON(sizeof(struct utp_hpb_rsp) != UTP_HPB_RSP_SIZE);
> > +
> > +       if (!ufshpb_is_hpb_rsp_valid(hba, lrbp, rsp_field))
> > +               return;
> How about moving both the data_seg_len and alert bit checks into ufshpb_is_hpb_rsp_valid,
> And moving ufshpb_is_hpb_rsp_valid to the beginning of the function?
> This way you would save redundant stuff if not a valid response. 

I will move alert bit check into ufshpb_is_hpb_rsp_valid.

Thanks,
Daejun

  parent reply	other threads:[~2021-02-23  8:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210222092907epcms2p307f3c4116349ebde6eed05c767287449@epcms2p3>
2021-02-22  9:29 ` [PATCH v22 0/4] scsi: ufs: Add Host Performance Booster Support Daejun Park
     [not found]   ` <CGME20210222092907epcms2p307f3c4116349ebde6eed05c767287449@epcms2p8>
2021-02-22  9:31     ` [PATCH v22 3/4] scsi: ufs: Prepare HPB read for cached sub-region Daejun Park
2021-02-23  8:27       ` Avri Altman
2021-02-23 13:49       ` Avri Altman
     [not found]       ` <CGME20210222092907epcms2p307f3c4116349ebde6eed05c767287449@epcms2p5>
2021-02-23  8:43         ` Daejun Park
2021-02-23  9:07           ` Avri Altman
2021-02-23  9:24             ` Avri Altman
2021-02-23  9:49         ` Re: [PATCH v22 4/4] scsi: ufs: Add HPB 2.0 support Daejun Park
2021-02-25  2:50         ` Daejun Park
2021-02-23  8:00     ` Daejun Park [this message]
2021-02-23  8:31     ` RE: RE: [PATCH v22 2/4] scsi: ufs: L2P map management for HPB read Daejun Park
2021-02-23  8:46       ` Avri Altman
2021-02-23  9:51     ` RE: RE: [PATCH v22 3/4] scsi: ufs: Prepare HPB read for cached sub-region Daejun Park
     [not found]   ` <CGME20210222092907epcms2p307f3c4116349ebde6eed05c767287449@epcms2p6>
2021-02-22  9:30     ` [PATCH v22 2/4] scsi: ufs: L2P map management for HPB read Daejun Park
2021-02-23  7:50       ` Avri Altman
2021-02-23  7:54       ` Avri Altman
     [not found]       ` <CGME20210222092907epcms2p307f3c4116349ebde6eed05c767287449@epcms2p4>
2021-02-23  8:01         ` Daejun Park
2021-02-23  8:04         ` RE: [PATCH v22 4/4] scsi: ufs: Add HPB 2.0 support Daejun Park
2021-02-23  8:02     ` Daejun Park
2021-02-23 23:54     ` Daejun Park
2021-02-24  8:20       ` Avri Altman
2021-02-24  9:06         ` Avri Altman
     [not found]   ` <CGME20210222092907epcms2p307f3c4116349ebde6eed05c767287449@epcms2p1>
2021-02-22  9:31     ` Daejun Park
2021-02-22 11:57       ` Bean Huo
2021-02-22 19:29       ` Avri Altman
2021-02-23  9:25       ` Bean Huo
2021-02-23 12:46       ` Avri Altman
2021-02-24  8:11       ` Avri Altman
2021-02-23 23:38     ` RE: [PATCH v22 3/4] scsi: ufs: Prepare HPB read for cached sub-region Daejun Park
     [not found]   ` <CGME20210222092907epcms2p307f3c4116349ebde6eed05c767287449@epcms2p7>
2021-02-22  9:29     ` [PATCH v22 1/4] scsi: ufs: Introduce HPB feature Daejun Park
2021-02-25  2:42     ` RE: RE: [PATCH v22 4/4] scsi: ufs: Add HPB 2.0 support Daejun Park
2021-02-25  7:51       ` Avri Altman
2021-02-23  8:55 ` RE: RE: RE: [PATCH v22 2/4] scsi: ufs: L2P map management for HPB read 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=20210223080043epcms2p83f813841174ade50ef97481b3f4cdef7@epcms2p8 \
    --to=daejun7.park@samsung.com \
    --cc=Avri.Altman@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=boram.shin@samsung.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --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 \
    --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.