lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1356064540-17414-2-git-send-email-dbasehore@chromium.org>
Date:	Thu, 20 Dec 2012 20:35:40 -0800
From:	Derek Basehore <dbasehore@...omium.org>
To:	JBottomley@...allels.com
Cc:	jgarzik@...ox.com, linux-ide@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Derek Basehore <dbasehore@...omium.org>
Subject: [PATCH 2/2] ata: don't wait on resume

When resuming an ata port, do not wait for the function ata_port_request_pm to
return. The reasoning behing this is that we can resume the device much faster
if we do not wait for ata ports connected to spinning disks to resume.

A small change is made in ata_port_request_pm to make it return 0 when we do not
wait. Previously, the function just returned an uninitialized variable if it did
not wait.

The pm runtime status of the ata port is set to active (even though is has not
fully resumed yet).

Signed-off-by: Derek Basehore <dbasehore@...omium.org>

Conflicts:

	drivers/ata/libata-core.c

---
 drivers/ata/libata-core.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9e8b99a..c700b79 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5279,7 +5279,7 @@ bool ata_link_offline(struct ata_link *link)
 #ifdef CONFIG_PM
 static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
 			       unsigned int action, unsigned int ehi_flags,
-			       int *async)
+			       int *async, int wait)
 {
 	struct ata_link *link;
 	unsigned long flags;
@@ -5289,9 +5289,12 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
 	 * progress.  Wait for PM_PENDING to clear.
 	 */
 	if (ap->pflags & ATA_PFLAG_PM_PENDING) {
-		if (async) {
-			*async = -EAGAIN;
-			return 0;
+		if (!wait) {
+			if (async) {
+				*async = -EAGAIN;
+				return 0;
+			}
+			return -EAGAIN;
 		}
 		ata_port_wait_eh(ap);
 		WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
@@ -5303,7 +5306,7 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
 	ap->pm_mesg = mesg;
 	if (async)
 		ap->pm_result = async;
-	else
+	else if (wait)
 		ap->pm_result = &rc;
 
 	ap->pflags |= ATA_PFLAG_PM_PENDING;
@@ -5317,7 +5320,7 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
 	spin_unlock_irqrestore(ap->lock, flags);
 
 	/* wait and check result */
-	if (!async) {
+	if (wait) {
 		ata_port_wait_eh(ap);
 		WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
 	}
@@ -5341,7 +5344,8 @@ static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int
 	if (mesg.event == PM_EVENT_SUSPEND)
 		ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY;
 
-	rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, async);
+	rc = ata_port_request_pm(ap, mesg, 0, ehi_flags, async,
+			async == NULL ? 1 : 0);
 	return rc;
 }
 
@@ -5381,7 +5385,8 @@ static int __ata_port_resume_common(struct ata_port *ap, int *async)
 	int rc;
 
 	rc = ata_port_request_pm(ap, PMSG_ON, ATA_EH_RESET,
-		ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, async);
+		ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, async,
+		async == NULL ? 1 : 0);
 	return rc;
 }
 
@@ -5394,9 +5399,11 @@ static int ata_port_resume_common(struct device *dev)
 
 static int ata_port_resume(struct device *dev)
 {
+	struct ata_port *ap = to_ata_port(dev);
 	int rc;
 
-	rc = ata_port_resume_common(dev);
+	rc = ata_port_request_pm(ap, PMSG_ON, ATA_EH_RESET,
+		ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, NULL, 0);
 	if (!rc) {
 		pm_runtime_disable(dev);
 		pm_runtime_set_active(dev);
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ