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, huobean@gmail.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 2/3] scsi: ufs: L2P map management for HPB read
Date: Mon, 08 Feb 2021 17:23:12 +0800 [thread overview]
Message-ID: <5b9f5edbe26930765ee4adaa786db7da@codeaurora.org> (raw)
In-Reply-To: <20210208085346epcms2p1c11b70be9d258df66cb2ca4542835fac@epcms2p1>
On 2021-02-08 16:53, Daejun Park wrote:
>>>> @@ -342,13 +1208,14 @@ void ufshpb_suspend(struct ufs_hba *hba)
>>>> > struct scsi_device *sdev;
>>>> >
>>>> > shost_for_each_device(sdev, hba->host) {
>>>> > - hpb = sdev->hostdata;
>>>> > + hpb = ufshpb_get_hpb_data(sdev);
>>>> > if (!hpb)
>>>> > continue;
>>>> >
>>>> > if (ufshpb_get_state(hpb) != HPB_PRESENT)
>>>> > continue;
>>>> > ufshpb_set_state(hpb, HPB_SUSPEND);
>>>> > + ufshpb_cancel_jobs(hpb);
>>>>
>>>> Here may have a dead lock problem - in the case of runtime suspend,
>>>> when ufshpb_suspend() is invoked, all of hba's children scsi devices
>>>> are in RPM_SUSPENDED state. When this line tries to cancel a running
>>>> map work, i.e. when ufshpb_get_map_req() calls below lines, it will
>>>> be stuck at blk_queue_enter().
>>>>
>>>> req = blk_get_request(hpb->sdev_ufs_lu->request_queue,
>>>> REQ_OP_SCSI_IN, 0);
>>>>
>>>> Please check block layer power management, and see also commit
>>>> d55d15a33
>>>> ("scsi: block: Do not accept any requests while suspended").
>>>
>>> I am agree with your comment.
>>> How about add BLK_MQ_REQ_NOWAIT flag on blk_get_request() to avoid
>>> hang?
>>>
>>
>> That won't work - BLK_MQ_REQ_NOWAIT allows one to fast fail from
>> blk_mq_get_tag(),
>> but blk_queue_enter() comes before __blk_mq_alloc_request();
>>
> In blk_queue_enter(), BLK_MQ_REQ_NOWAIT flag can make error than wait
> rpm
> resume. Please refer following code.
Oops, sorry, my memory needs to be refreshed on that part.
But will BLK_MQ_REQ_NOWAIT flag breaks your original purpose? When
runtime suspend is out of the picture, if traffic is heavy on the
request queue, map_work() will be stopped frequently once it is
not able to get a request from the queue - that shall pull down the
efficiency of one map_work(), that may hurt random performance...
Can Guo.
>
> int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
> {
> const bool pm = flags & BLK_MQ_REQ_PM;
>
> while (true) {
> bool success = false;
>
> rcu_read_lock();
> if (percpu_ref_tryget_live(&q->q_usage_counter)) {
> /*
> * The code that increments the pm_only counter is
> * responsible for ensuring that that counter is
> * globally visible before the queue is unfrozen.
> */
> if ((pm && queue_rpm_status(q) != RPM_SUSPENDED) ||
> !blk_queue_pm_only(q)) {
> success = true;
> } else {
> percpu_ref_put(&q->q_usage_counter);
> }
> }
> rcu_read_unlock();
>
> if (success)
> return 0;
>
> if (flags & BLK_MQ_REQ_NOWAIT)
> return -EBUSY; <-- out from the function.
>
> Thanks,
> Daejun
next prev parent reply other threads:[~2021-02-08 9:40 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
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 [this message]
[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=5b9f5edbe26930765ee4adaa786db7da@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).