All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Stephan Diestelhorst <stephan.diestelhorst@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"linux-pm@lists.osdl.org" <linux-pm@lists.osdl.org>,
	Stephan Diestelhorst <stephan.diestelhorst@gmail.com>,
	stable@kernel.org
Subject: [PATCH #upstream-fixes] libata: skip EH autopsy and recovery during suspend
Date: Tue, 07 Sep 2010 14:05:31 +0200	[thread overview]
Message-ID: <4C862A8B.3000506@gmail.com> (raw)
In-Reply-To: <4C7F6931.4050707@gmail.com>

For some mysterious reason, certain hardware reacts badly to usual EH
actions while the system is going for suspend.  As the devices won't
be needed until the system is resumed, ask EH to skip usual autopsy
and recovery and proceed directly to suspend.

Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Stephan Diestelhorst <stephan.diestelhorst@amd.com>
Cc: stable@kernel.org
---
 drivers/ata/libata-core.c |   14 +++++++++++++-
 drivers/ata/libata-eh.c   |    4 ++++
 include/linux/libata.h    |    1 +
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9ceb493..92cd5f3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5427,6 +5427,7 @@ static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg,
  */
 int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
 {
+	unsigned int ehi_flags = ATA_EHI_QUIET;
 	int rc;

 	/*
@@ -5435,7 +5436,18 @@ int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
 	 */
 	ata_lpm_enable(host);

-	rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1);
+	/*
+	 * On some hardware, device fails to respond after spun down
+	 * for suspend.  As the device won't be used before being
+	 * resumed, we don't need to touch the device.  Ask EH to skip
+	 * the usual stuff and proceed directly to suspend.
+	 *
+	 * http://thread.gmane.org/gmane.linux.ide/46764
+	 */
+	if (mesg.event == PM_EVENT_SUSPEND)
+		ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY;
+
+	rc = ata_host_request_pm(host, mesg, 0, ehi_flags, 1);
 	if (rc == 0)
 		host->dev->power.power_state = mesg;
 	return rc;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 0108731..95838b3 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3242,6 +3242,10 @@ static int ata_eh_skip_recovery(struct ata_link *link)
 	if (link->flags & ATA_LFLAG_DISABLED)
 		return 1;

+	/* skip if explicitly requested */
+	if (ehc->i.flags & ATA_EHI_NO_RECOVERY)
+		return 1;
+
 	/* thaw frozen port and recover failed devices */
 	if ((ap->pflags & ATA_PFLAG_FROZEN) || ata_link_nr_enabled(link))
 		return 0;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 89115f8..d1ef41b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -335,6 +335,7 @@ enum {
 	ATA_EHI_HOTPLUGGED	= (1 << 0),  /* could have been hotplugged */
 	ATA_EHI_NO_AUTOPSY	= (1 << 2),  /* no autopsy */
 	ATA_EHI_QUIET		= (1 << 3),  /* be quiet */
+	ATA_EHI_NO_RECOVERY	= (1 << 4),  /* no recovery */

 	ATA_EHI_DID_SOFTRESET	= (1 << 16), /* already soft-reset this port */
 	ATA_EHI_DID_HARDRESET	= (1 << 17), /* already soft-reset this port */

  parent reply	other threads:[~2010-09-07 12:05 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-09 15:50 HDD not suspending properly / dead on resume Stephan Diestelhorst
2010-07-09 15:50 ` Stephan Diestelhorst
2010-07-09 21:47 ` Stephan Diestelhorst
2010-07-09 21:53   ` Rafael J. Wysocki
2010-07-09 23:04     ` Stephan Diestelhorst
2010-07-10  0:06       ` Rafael J. Wysocki
2010-07-10  6:50         ` Stephan Diestelhorst
2010-07-10 10:03           ` Tejun Heo
2010-07-10 13:45             ` Rafael J. Wysocki
2010-07-28 21:50             ` [PATCH] SATA / AHCI: Do not play with the link PM during suspend to RAM (was: Re: HDD not suspending properly / dead on resume) Rafael J. Wysocki
2010-07-30 14:18               ` [PATCH] SATA / AHCI: Do not play with the link PM during suspend to RAM Tejun Heo
2010-08-05 16:08                 ` Tejun Heo
2010-08-05 19:58                   ` Rafael J. Wysocki
2010-08-06  6:30                   ` Stephan Diestelhorst
2010-08-06  7:06                     ` Tejun Heo
2010-08-06  9:04                       ` Stephan Diestelhorst
2010-08-17  7:51                   ` Stephan Diestelhorst
2010-08-17  8:08                     ` Tejun Heo
2010-08-17  9:32                       ` Stephan Diestelhorst
2010-08-17 10:15                         ` Tejun Heo
2010-08-17 10:29                           ` Stephan Diestelhorst
2010-08-17 10:51                             ` Stephan Diestelhorst
2010-08-17 15:04                               ` Tejun Heo
2010-08-17 21:28                                 ` Stephan Diestelhorst
2010-08-18  6:12                                   ` Tejun Heo
2010-08-19 16:23                                     ` Stephan Diestelhorst
2010-08-23 12:03                                       ` Tejun Heo
2010-08-23 18:58                                         ` Rafael J. Wysocki
2010-08-24  7:37                                           ` Tejun Heo
2010-08-24 20:39                                             ` Rafael J. Wysocki
2010-08-26 23:09                                               ` Rafael J. Wysocki
2010-08-26 23:46                                                 ` Rafael J. Wysocki
2010-09-02  9:06                                                 ` Tejun Heo
2010-09-02 10:02                                                   ` [PATCH] libata: skip EH autopsy and recovery during suspend Tejun Heo
2010-09-02 14:33                                                     ` Stephan Diestelhorst
2010-09-02 14:33                                                       ` Stephan Diestelhorst
2010-09-02 20:11                                                       ` Rafael J. Wysocki
2010-09-02 20:52                                                       ` Stephan Diestelhorst
2010-09-07 11:54                                                         ` Stephan Diestelhorst
2010-09-02 20:16                                                     ` Rafael J. Wysocki
2010-09-02 20:25                                                       ` Tejun Heo
2010-09-02 20:28                                                         ` Rafael J. Wysocki
2010-09-02 20:33                                                           ` Tejun Heo
2010-09-02 21:01                                                             ` [linux-pm] " Alan Stern
2010-09-02 21:09                                                               ` Rafael J. Wysocki
2010-09-02 21:09                                                                 ` [linux-pm] " Rafael J. Wysocki
2010-09-03  8:55                                                               ` Tejun Heo
2010-09-03 14:16                                                                 ` Alan Stern
2010-09-07 12:05                                                   ` Tejun Heo [this message]
2010-08-24 16:07                                         ` [PATCH] SATA / AHCI: Do not play with the link PM during suspend to RAM Stephan Diestelhorst
2010-08-24 16:11                                           ` Stephan Diestelhorst
2010-08-26 16:15                                             ` Stephan Diestelhorst
2010-08-26 18:24                                               ` Rafael J. Wysocki
2010-08-27 23:35                                                 ` Rafael J. Wysocki
2010-09-02 14:31                                                   ` Stephan Diestelhorst
2010-09-02 14:31                                                     ` Stephan Diestelhorst
2010-08-17 11:19                           ` Rafael J. Wysocki
2010-08-17 11:29                             ` Tejun Heo
2010-08-17 12:10                               ` Stephan Diestelhorst
2010-08-17 12:09                                 ` Tejun Heo
2010-08-02 20:48               ` [PATCH] SATA / AHCI: Do not play with the link PM during suspend to RAM (was: Re: HDD not suspending properly / dead on resume) Stephan Diestelhorst
2010-08-02 21:38                 ` Rafael J. Wysocki
2010-08-03  8:36                   ` Stephan Diestelhorst
2010-08-03 21:13                     ` Rafael J. Wysocki
2010-07-10 13:08           ` HDD not suspending properly / dead on resume Rafael J. Wysocki
2010-07-12 15:35 ` Maciej Rutecki

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=4C862A8B.3000506@gmail.com \
    --to=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.osdl.org \
    --cc=rjw@sisk.pl \
    --cc=stable@kernel.org \
    --cc=stephan.diestelhorst@amd.com \
    --cc=stephan.diestelhorst@gmail.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 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.