* [PATCH v2] scsi: Synchronize request queue PM status only on successful resume
@ 2019-01-03 6:53 stanley.chu-NuS5LvNUpcJWk0Htik3J/w
[not found] ` <1546498395-4184-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: stanley.chu-NuS5LvNUpcJWk0Htik3J/w @ 2019-01-03 6:53 UTC (permalink / raw)
To: linux-scsi-u79uwXL29TY76Z2rM5mHXA
Cc: matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w,
mika.westerberg-VuQAYsv1563Yd54FQh9/CA,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
kuohong.wang-NuS5LvNUpcJWk0Htik3J/w,
wsd_upstream-NuS5LvNUpcJWk0Htik3J/w
The commit 356fd2663cff ("scsi: Set request queue runtime PM status
back to active on resume") fixed up the inconsistent RPM status between
request queue and device. However changing request queue RPM status
shall be done only on successful resume, otherwise status may be still
inconsistent as below,
Request queue: RPM_ACTIVE
Device: RPM_SUSPENDED
This ends up soft lockup because requests can be submitted to
underlying devices but those devices and their required resource
are not resumed.
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <1546498395-4184-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* [PATCH v2 0/1] scsi: Synchronize request queue PM status only on successful resume [not found] ` <1546498395-4184-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2019-01-03 6:53 ` stanley.chu-NuS5LvNUpcJWk0Htik3J/w 2019-01-03 6:53 ` [PATCH v2 1/1] " stanley.chu-NuS5LvNUpcJWk0Htik3J/w 1 sibling, 0 replies; 5+ messages in thread From: stanley.chu-NuS5LvNUpcJWk0Htik3J/w @ 2019-01-03 6:53 UTC (permalink / raw) To: linux-scsi-u79uwXL29TY76Z2rM5mHXA Cc: wsd_upstream-NuS5LvNUpcJWk0Htik3J/w, kuohong.wang-NuS5LvNUpcJWk0Htik3J/w, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, Stanley Chu, mika.westerberg-VuQAYsv1563Yd54FQh9/CA From: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> Stanley Chu (1): scsi: Synchronize request queue PM status only on successful resume drivers/scsi/scsi_pm.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) -- 2.18.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/1] scsi: Synchronize request queue PM status only on successful resume [not found] ` <1546498395-4184-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2019-01-03 6:53 ` [PATCH v2 0/1] " stanley.chu-NuS5LvNUpcJWk0Htik3J/w @ 2019-01-03 6:53 ` stanley.chu-NuS5LvNUpcJWk0Htik3J/w 2019-01-03 8:23 ` Mika Westerberg 1 sibling, 1 reply; 5+ messages in thread From: stanley.chu-NuS5LvNUpcJWk0Htik3J/w @ 2019-01-03 6:53 UTC (permalink / raw) To: linux-scsi-u79uwXL29TY76Z2rM5mHXA Cc: wsd_upstream-NuS5LvNUpcJWk0Htik3J/w, kuohong.wang-NuS5LvNUpcJWk0Htik3J/w, stable-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, Stanley Chu, mika.westerberg-VuQAYsv1563Yd54FQh9/CA From: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> The commit 356fd2663cff ("scsi: Set request queue runtime PM status back to active on resume") fixed up the inconsistent RPM status between request queue and device. However changing request queue RPM status shall be done only on successful resume, otherwise status may be still inconsistent as below, Request queue: RPM_ACTIVE Device: RPM_SUSPENDED This ends up soft lockup because requests can be submitted to underlying devices but those devices and their required resource are not resumed. Fixes: 356fd2663cff ("scsi: Set request queue runtime PM status back to active on resume") Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Signed-off-by: Stanley Chu <stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> --- drivers/scsi/scsi_pm.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index a2b4179bfdf7..7639df91b110 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c @@ -80,8 +80,22 @@ static int scsi_dev_type_resume(struct device *dev, if (err == 0) { pm_runtime_disable(dev); - pm_runtime_set_active(dev); + err = pm_runtime_set_active(dev); pm_runtime_enable(dev); + + /* + * Forcibly set runtime PM status of request queue to "active" + * to make sure we can again get requests from the queue + * (see also blk_pm_peek_request()). + * + * The resume hook will correct runtime PM status of the disk. + */ + if (!err && scsi_is_sdev_device(dev)) { + struct scsi_device *sdev = to_scsi_device(dev); + + if (sdev->request_queue->dev) + blk_set_runtime_active(sdev->request_queue); + } } return err; @@ -140,16 +154,6 @@ static int scsi_bus_resume_common(struct device *dev, else fn = NULL; - /* - * Forcibly set runtime PM status of request queue to "active" to - * make sure we can again get requests from the queue (see also - * blk_pm_peek_request()). - * - * The resume hook will correct runtime PM status of the disk. - */ - if (scsi_is_sdev_device(dev) && pm_runtime_suspended(dev)) - blk_set_runtime_active(to_scsi_device(dev)->request_queue); - if (fn) { async_schedule_domain(fn, dev, &scsi_sd_pm_domain); -- 2.18.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] scsi: Synchronize request queue PM status only on successful resume 2019-01-03 6:53 ` [PATCH v2 1/1] " stanley.chu-NuS5LvNUpcJWk0Htik3J/w @ 2019-01-03 8:23 ` Mika Westerberg 2019-01-03 9:06 ` Stanley Chu 0 siblings, 1 reply; 5+ messages in thread From: Mika Westerberg @ 2019-01-03 8:23 UTC (permalink / raw) To: stanley.chu Cc: linux-scsi, wsd_upstream, linux-mediatek, matthias.bgg, kuohong.wang, stable Hi, On Thu, Jan 03, 2019 at 02:53:15PM +0800, stanley.chu@mediatek.com wrote: > From: Stanley Chu <stanley.chu@mediatek.com> > > The commit 356fd2663cff ("scsi: Set request queue runtime PM status > back to active on resume") fixed up the inconsistent RPM status between > request queue and device. However changing request queue RPM status > shall be done only on successful resume, otherwise status may be still > inconsistent as below, > > Request queue: RPM_ACTIVE > Device: RPM_SUSPENDED > > This ends up soft lockup because requests can be submitted to > underlying devices but those devices and their required resource > are not resumed. It would be good to add some example of the soft lockup you are seeing here. > Fixes: 356fd2663cff ("scsi: Set request queue runtime PM status > back to active on resume") You don't need to wrap this. The change itself looks fine. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] scsi: Synchronize request queue PM status only on successful resume 2019-01-03 8:23 ` Mika Westerberg @ 2019-01-03 9:06 ` Stanley Chu 0 siblings, 0 replies; 5+ messages in thread From: Stanley Chu @ 2019-01-03 9:06 UTC (permalink / raw) To: Mika Westerberg Cc: linux-scsi, wsd_upstream, kuohong.wang, stable, linux-mediatek, matthias.bgg, peter.wang Hi Mika, On Thu, 2019-01-03 at 10:23 +0200, Mika Westerberg wrote: > Hi, > > On Thu, Jan 03, 2019 at 02:53:15PM +0800, stanley.chu@mediatek.com wrote: > > From: Stanley Chu <stanley.chu@mediatek.com> > > > > The commit 356fd2663cff ("scsi: Set request queue runtime PM status > > back to active on resume") fixed up the inconsistent RPM status between > > request queue and device. However changing request queue RPM status > > shall be done only on successful resume, otherwise status may be still > > inconsistent as below, > > > > Request queue: RPM_ACTIVE > > Device: RPM_SUSPENDED > > > > This ends up soft lockup because requests can be submitted to > > underlying devices but those devices and their required resource > > are not resumed. > > It would be good to add some example of the soft lockup you are seeing > here. Thanks for remind, I will add below example in commit message in v3. For example, After above inconsistent status happens, IO request can be submitted to UFS device driver but required resource (like clock) is not resumed yet thus lead to warning as below call stack, WARN_ON(hba->clk_gating.state != CLKS_ON); ufshcd_queuecommand scsi_dispatch_cmd scsi_request_fn __blk_run_queue cfq_insert_request __elv_add_request blk_flush_plug_list blk_finish_plug jbd2_journal_commit_transaction kjournald2 We may see all behind IO requests hang because of no response from storage host or device and then soft lockup happens in system. In the end, system may crash in many ways. > > > Fixes: 356fd2663cff ("scsi: Set request queue runtime PM status > > back to active on resume") > > You don't need to wrap this. OK! Will fix it. > > The change itself looks fine. Thanks. Stanley > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-03 9:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-03 6:53 [PATCH v2] scsi: Synchronize request queue PM status only on successful resume stanley.chu-NuS5LvNUpcJWk0Htik3J/w
[not found] ` <1546498395-4184-1-git-send-email-stanley.chu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-01-03 6:53 ` [PATCH v2 0/1] " stanley.chu-NuS5LvNUpcJWk0Htik3J/w
2019-01-03 6:53 ` [PATCH v2 1/1] " stanley.chu-NuS5LvNUpcJWk0Htik3J/w
2019-01-03 8:23 ` Mika Westerberg
2019-01-03 9:06 ` Stanley Chu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox