From: Damien Le Moal <dlemoal@kernel.org>
To: TW <dalzot@gmail.com>, Thorsten Leemhuis <regressions@leemhuis.info>
Cc: regressions@lists.linux.dev,
Mario Limonciello <mario.limonciello@amd.com>,
Bart Van Assche <bvanassche@acm.org>,
LKML <linux-kernel@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: Scsi_bus_resume+0x0/0x90 returns -5 when resuming from s3 sleep
Date: Thu, 27 Jul 2023 19:27:34 +0900 [thread overview]
Message-ID: <48bc1736-5e4e-3a9b-3715-60509c333bb1@kernel.org> (raw)
In-Reply-To: <86435987-734e-c6c1-a857-1ba80da709fe@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 253 bytes --]
On 7/27/23 19:22, TW wrote:
> I managed to fix the patch file, guess the formatting messed up a bit. So will
> try with those patches installed.
Just in case, patch fil attached to avoid formatting issues.
--
Damien Le Moal
Western Digital Research
[-- Attachment #2: 0001-ata-scsi-do-not-issue-START-STOP-UNIT-on-resume.patch --]
[-- Type: text/x-patch, Size: 2454 bytes --]
From 29e81d11812ee924d19425343ec69acd34af9d35 Mon Sep 17 00:00:00 2001
From: Damien Le Moal <dlemoal@kernel.org>
Date: Mon, 24 Jul 2023 13:23:14 +0900
Subject: [PATCH] ata,scsi: do not issue START STOP UNIT on resume
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
drivers/ata/libata-scsi.c | 6 ++++++
drivers/scsi/sd.c | 5 +++--
include/scsi/scsi_device.h | 1 +
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 370d18aca71e..6184c7bcc16c 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1100,7 +1100,13 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
}
} else {
sdev->sector_size = ata_id_logical_sector_size(dev->id);
+ /*
+ * Stop the drive on suspend but do not issue START STOP UNIT
+ * on resume as this is not necessary: the port is reset on
+ * resume, which wakes up the drive.
+ */
sdev->manage_start_stop = 1;
+ sdev->no_start_on_resume = 1;
}
/*
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 68b12afa0721..b8584fe3123e 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3876,7 +3876,7 @@ static int sd_suspend_runtime(struct device *dev)
static int sd_resume(struct device *dev)
{
struct scsi_disk *sdkp = dev_get_drvdata(dev);
- int ret;
+ int ret = 0;
if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */
return 0;
@@ -3885,7 +3885,8 @@ static int sd_resume(struct device *dev)
return 0;
sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
- ret = sd_start_stop_device(sdkp, 1);
+ if (!sdkp->device->no_start_on_resume)
+ ret = sd_start_stop_device(sdkp, 1);
if (!ret)
opal_unlock_from_suspend(sdkp->opal_dev);
return ret;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 75b2235b99e2..b9230b6add04 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -194,6 +194,7 @@ struct scsi_device {
unsigned no_start_on_add:1; /* do not issue start on add */
unsigned allow_restart:1; /* issue START_UNIT in error handler */
unsigned manage_start_stop:1; /* Let HLD (sd) manage start/stop */
+ unsigned no_start_on_resume:1; /* Do not issue START_STOP_UNIT on resume */
unsigned start_stop_pwr_cond:1; /* Set power cond. in START_STOP_UNIT */
unsigned no_uld_attach:1; /* disable connecting to upper level drivers */
unsigned select_no_atn:1;
--
2.41.0
next prev parent reply other threads:[~2023-07-27 10:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 11:54 Scsi_bus_resume+0x0/0x90 returns -5 when resuming from s3 sleep TW
2023-07-26 13:47 ` Thorsten Leemhuis
2023-07-26 23:39 ` Damien Le Moal
2023-07-27 10:06 ` TW
2023-07-27 10:22 ` TW
2023-07-27 10:25 ` Damien Le Moal
2023-07-27 10:27 ` Damien Le Moal [this message]
2023-07-27 12:25 ` TW
2023-07-28 2:33 ` Damien Le Moal
2023-07-28 2:49 ` TW
2023-07-28 4:09 ` Damien Le Moal
2023-07-31 0:41 ` Damien Le Moal
2023-07-31 3:47 ` TW
2023-07-27 10:24 ` Damien Le Moal
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=48bc1736-5e4e-3a9b-3715-60509c333bb1@kernel.org \
--to=dlemoal@kernel.org \
--cc=bvanassche@acm.org \
--cc=dalzot@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=regressions@leemhuis.info \
--cc=regressions@lists.linux.dev \
--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 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.