[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR04MB65755CF477FC3C10AADB9006FC6B9@DM6PR04MB6575.namprd04.prod.outlook.com>
Date: Tue, 16 Mar 2021 08:32:09 +0000
From: Avri Altman <Avri.Altman@....com>
To: Can Guo <cang@...eaurora.org>
CC: "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
Bart Van Assche <bvanassche@....org>,
yongmyung lee <ymhungry.lee@...sung.com>,
Daejun Park <daejun7.park@...sung.com>,
"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
Zang Leigang <zangleigang@...ilicon.com>,
Avi Shchislowski <Avi.Shchislowski@....com>,
Bean Huo <beanhuo@...ron.com>,
"stanley.chu@...iatek.com" <stanley.chu@...iatek.com>
Subject: RE: [PATCH v5 08/10] scsi: ufshpb: Limit the number of inflight map
requests
>
>
> On 2021-03-02 21:25, Avri Altman wrote:
> > in host control mode the host is the originator of map requests. To not
>
> in -> In
Done.
>
> Thanks,
> Can Guo.
>
> > flood the device with map requests, use a simple throttling mechanism
> > that limits the number of inflight map requests.
> >
> > Signed-off-by: Avri Altman <avri.altman@....com>
> > ---
> > drivers/scsi/ufs/ufshpb.c | 11 +++++++++++
> > drivers/scsi/ufs/ufshpb.h | 1 +
> > 2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
> > index 89a930e72cff..74da69727340 100644
> > --- a/drivers/scsi/ufs/ufshpb.c
> > +++ b/drivers/scsi/ufs/ufshpb.c
> > @@ -21,6 +21,7 @@
> > #define READ_TO_MS 1000
> > #define READ_TO_EXPIRIES 100
> > #define POLLING_INTERVAL_MS 200
> > +#define THROTTLE_MAP_REQ_DEFAULT 1
> >
> > /* memory management */
> > static struct kmem_cache *ufshpb_mctx_cache;
> > @@ -750,6 +751,14 @@ static struct ufshpb_req
> > *ufshpb_get_map_req(struct ufshpb_lu *hpb,
> > struct ufshpb_req *map_req;
> > struct bio *bio;
> >
> > + if (hpb->is_hcm &&
> > + hpb->num_inflight_map_req >= THROTTLE_MAP_REQ_DEFAULT) {
> > + dev_info(&hpb->sdev_ufs_lu->sdev_dev,
> > + "map_req throttle. inflight %d throttle %d",
> > + hpb->num_inflight_map_req, THROTTLE_MAP_REQ_DEFAULT);
> > + return NULL;
> > + }
> > +
> > map_req = ufshpb_get_req(hpb, srgn->rgn_idx, REQ_OP_SCSI_IN);
> > if (!map_req)
> > return NULL;
> > @@ -764,6 +773,7 @@ static struct ufshpb_req
> > *ufshpb_get_map_req(struct ufshpb_lu *hpb,
> >
> > map_req->rb.srgn_idx = srgn->srgn_idx;
> > map_req->rb.mctx = srgn->mctx;
> > + hpb->num_inflight_map_req++;
> >
> > return map_req;
> > }
> > @@ -773,6 +783,7 @@ static void ufshpb_put_map_req(struct ufshpb_lu
> > *hpb,
> > {
> > bio_put(map_req->bio);
> > ufshpb_put_req(hpb, map_req);
> > + hpb->num_inflight_map_req--;
> > }
> >
> > static int ufshpb_clear_dirty_bitmap(struct ufshpb_lu *hpb,
> > diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h
> > index b49e9a34267f..d83ab488688a 100644
> > --- a/drivers/scsi/ufs/ufshpb.h
> > +++ b/drivers/scsi/ufs/ufshpb.h
> > @@ -212,6 +212,7 @@ struct ufshpb_lu {
> > struct ufshpb_req *pre_req;
> > int num_inflight_pre_req;
> > int throttle_pre_req;
> > + int num_inflight_map_req;
> > struct list_head lh_pre_req_free;
> > int cur_read_id;
> > int pre_req_min_tr_len;
Powered by blists - more mailing lists