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-next>] [day] [month] [year] [list]
Date:	Thu, 16 Jul 2009 23:43:27 +0800
From:	Wu Zhangjin <wuzhangjin@...il.com>
To:	linux-pm@...ts.linux-foundation.org
Cc:	linux-kernel@...r.kernel.org, len.brown@...el.com, pavel@....cz,
	zhangfx@...ote.com, wuzj@...ote.com, yanh@...ote.com,
	Wu Zhangjin <wuzhangjin@...il.com>
Subject: [PATCH] [suspend] pci_raw_set_power_state: replace msleep by udelay in resuming procedure

we can not call msleep() when resuming from STR/Standby: if the
current_state of the pci device is PCI_D3hot, means we are in the
procedure of resuming, in this procedure, we can not re-schedule,
otherwise, there will be a deadlock.

Signed-off-by: Wu Zhangjin <wuzhangjin@...il.com>
---
 drivers/pci/pci.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 440f4fb..3d9a4e2 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -497,8 +497,18 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
 
 	/* Mandatory power management transition delays */
 	/* see PCI PM 1.1 5.6.1 table 18 */
-	if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
+
+	/* we can not call msleep() when resume:
+	 *
+	 *   if the current_state is PCI_D3hot, means we are in the procedure
+	 *   of resuming, in this procedure, we can not re-schedule, otherwise,
+	 *   there will be a deadlock.
+	 */
+
+	if (state == PCI_D3hot)
 		msleep(pci_pm_d3_delay);
+	else if (dev->current_state == PCI_D3hot)
+		udelay(pci_pm_d3_delay);
 	else if (state == PCI_D2 || dev->current_state == PCI_D2)
 		udelay(PCI_PM_D2_DELAY);
 
-- 
1.6.2.1

--
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