stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
	Can Guo <cang@codeaurora.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.6 07/43] scsi: pm: Balance pm_only counter of request queue during system resume
Date: Fri,  5 Jun 2020 16:14:37 +0200	[thread overview]
Message-ID: <20200605140152.908868723@linuxfoundation.org> (raw)
In-Reply-To: <20200605140152.493743366@linuxfoundation.org>

From: Can Guo <cang@codeaurora.org>

[ Upstream commit 05d18ae1cc8a0308b12f37b4ab94afce3535fac9 ]

During system resume, scsi_resume_device() decreases a request queue's
pm_only counter if the scsi device was quiesced before. But after that, if
the scsi device's RPM status is RPM_SUSPENDED, the pm_only counter is still
held (non-zero). Current SCSI resume hook only sets the RPM status of the
scsi_device and its request queue to RPM_ACTIVE, but leaves the pm_only
counter unchanged. This may make the request queue's pm_only counter remain
non-zero after resume hook returns, hence those who are waiting on the
mq_freeze_wq would never be woken up. Fix this by calling
blk_post_runtime_resume() if a sdev's RPM status was RPM_SUSPENDED.

(struct request_queue)0xFFFFFF815B69E938
	pm_only = (counter = 2),
	rpm_status = 0,
	dev = 0xFFFFFF815B0511A0,

((struct device)0xFFFFFF815B0511A0)).power
	is_suspended = FALSE,
	runtime_status = RPM_ACTIVE,

(struct scsi_device)0xffffff815b051000
	request_queue = 0xFFFFFF815B69E938,
	sdev_state = SDEV_RUNNING,
	quiesced_by = 0x0,

B::v.f_/task_0xFFFFFF810C246940
-000|__switch_to(prev = 0xFFFFFF810C246940, next = 0xFFFFFF80A49357C0)
-001|context_switch(inline)
-001|__schedule(?)
-002|schedule()
-003|blk_queue_enter(q = 0xFFFFFF815B69E938, flags = 0)
-004|generic_make_request(?)
-005|submit_bio(bio = 0xFFFFFF80A8195B80)

Link: https://lore.kernel.org/r/1588740936-28846-1-git-send-email-cang@codeaurora.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/scsi_pm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index 3717eea37ecb..5f0ad8b32e3a 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -80,6 +80,10 @@ static int scsi_dev_type_resume(struct device *dev,
 	dev_dbg(dev, "scsi resume: %d\n", err);
 
 	if (err == 0) {
+		bool was_runtime_suspended;
+
+		was_runtime_suspended = pm_runtime_suspended(dev);
+
 		pm_runtime_disable(dev);
 		err = pm_runtime_set_active(dev);
 		pm_runtime_enable(dev);
@@ -93,8 +97,10 @@ static int scsi_dev_type_resume(struct device *dev,
 		 */
 		if (!err && scsi_is_sdev_device(dev)) {
 			struct scsi_device *sdev = to_scsi_device(dev);
-
-			blk_set_runtime_active(sdev->request_queue);
+			if (was_runtime_suspended)
+				blk_post_runtime_resume(sdev->request_queue, 0);
+			else
+				blk_set_runtime_active(sdev->request_queue);
 		}
 	}
 
-- 
2.25.1




  parent reply	other threads:[~2020-06-05 14:17 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 14:14 [PATCH 5.6 00/43] 5.6.17-rc1 review Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 01/43] x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long" Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 02/43] Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() race window" Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 03/43] ARC: Fix ICCM & DCCM runtime size checks Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 04/43] ARC: [plat-eznps]: Restrict to CONFIG_ISA_ARCOMPACT Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 05/43] efi/libstub: Avoid returning uninitialized data from setup_graphics() Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 06/43] evm: Fix RCU list related warnings Greg Kroah-Hartman
2020-06-05 14:14 ` Greg Kroah-Hartman [this message]
2020-06-05 14:14 ` [PATCH 5.6 08/43] efi/earlycon: Fix early printk for wider fonts Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 09/43] x86/hyperv: Properly suspend/resume reenlightenment notifications Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 10/43] dmaengine: ti: k3-udma: Fix TR mode flags for slave_sg and memcpy Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 11/43] i2c: altera: Fix race between xfer_msg and isr thread Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 12/43] io_uring: initialize ctx->sqo_wait earlier Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 13/43] io_uring: dont prepare DRAIN reqs twice Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 14/43] io_uring: fix FORCE_ASYNC req preparation Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 15/43] net: phy: propagate an error back to the callers of phy_sfp_probe Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 16/43] x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 17/43] net: bmac: Fix read of MAC address from ROM Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 18/43] drm/edid: Add Oculus Rift S to non-desktop list Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 19/43] s390/mm: fix set_huge_pte_at() for empty ptes Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 20/43] io_uring: reset -EBUSY error when io sq thread is waken up Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 21/43] drm/amd/display: DP training to set properly SCRAMBLING_DISABLE Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 22/43] riscv: Fix print_vm_layout build error if NOMMU Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 23/43] wireguard: selftests: use newer iproute2 for gcc-10 Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 24/43] null_blk: return error for invalid zone size Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 25/43] net: ethernet: ti: fix some return value check of cpsw_ale_create() Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 26/43] net/ethernet/freescale: rework quiesce/activate for ucc_geth Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 27/43] net: ethernet: stmmac: Enable interface clocks on probe for IPQ806x Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 28/43] selftests: mlxsw: qos_mc_aware: Specify arping timeout as an integer Greg Kroah-Hartman
2020-06-05 14:14 ` [PATCH 5.6 29/43] net: Fix return value about devm_platform_ioremap_resource() Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 30/43] net: smsc911x: Fix runtime PM imbalance on error Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 31/43] mm: Fix mremap not considering huge pmd devmap Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 32/43] HID: sony: Fix for broken buttons on DS3 USB dongles Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 33/43] HID: multitouch: enable multi-input as a quirk for some devices Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 34/43] HID: i2c-hid: add Schneider SCL142ALM to descriptor override Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 35/43] p54usb: add AirVasT USB stick device-id Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 36/43] mt76: mt76x02u: Add support for newer versions of the XBox One wifi adapter Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 37/43] crypto: api - Fix use-after-free and race in crypto_spawn_alg Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 38/43] kernel/relay.c: handle alloc_percpu returning NULL in relay_open Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 39/43] mmc: fix compilation of user API Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 40/43] media: Revert "staging: imgu: Address a compiler warning on alignment" Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 41/43] media: staging: ipu3-imgu: Move alignment attribute to field Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 42/43] net: dsa: mt7530: set CPU port to fallback mode Greg Kroah-Hartman
2020-06-05 14:15 ` [PATCH 5.6 43/43] airo: Fix read overflows sending packets Greg Kroah-Hartman
2020-06-05 15:30 ` [PATCH 5.6 00/43] 5.6.17-rc1 review Shuah Khan
2020-06-05 15:48   ` Greg Kroah-Hartman
2020-06-05 22:13 ` Shuah Khan
2020-06-06  6:27 ` Jon Hunter
2020-06-06 13:34 ` Guenter Roeck
2020-06-06 16:12 ` Naresh Kamboju

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=20200605140152.908868723@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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).