mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Jeff Chua" <jeff.chua.linux@gmail.com>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Daniel Drake" <dsd@gentoo.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Kernel Testers List" <kernel-testers@vger.kernel.org>,
	"Phil Dibowitz" <phil@ipom.com>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [Bug #12422] 2.6.28-git can't resume from str
Date: Tue, 13 Jan 2009 12:32:17 +0100	[thread overview]
Message-ID: <200901131232.17941.rjw@sisk.pl> (raw)
In-Reply-To: <b6a2187b0901122147o45890cd4lfb6ba7b2908e6ae7@mail.gmail.com>

On Tuesday 13 January 2009, Jeff Chua wrote:
> On Sun, Jan 11, 2009 at 7:16 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> 
> > The following bug entry is on the current list of known regressions
> > from 2.6.28.  Please verify if it still should be listed and let me know
> > Bug-Entry       : http://bugzilla.kernel.org/show_bug.cgi?id=12422
> > Subject         : 2.6.28-git can't resume from str
> > Submitter       : Jeff Chua <jeff.chua.linux@gmail.com>
> > Date            : 2009-01-10 1:39 (2 days old)
> > References      : http://marc.info/?l=linux-kernel&m=123155157909282&w=4
> 
> Fixed by reverting a0d4922da2e4ccb0973095d8d29f36f6b1b5f703.
> 7503bfbae89eba07b46441a5d1594647f6b8ab7d has already been reverted in
> the Linus's latest git tree.

Can you please check if the issue goes away when you apply the appended patch
instead of reverting commit a0d4922da2e4ccb0973095d8d29f36f6b1b5f703 ?

Rafael

---
 drivers/usb/core/hcd-pci.c  |  116 ++++++++++----------------------------------
 drivers/usb/core/hcd.h      |    1 
 drivers/usb/host/ehci-pci.c |    1 
 drivers/usb/host/ohci-pci.c |    1 
 drivers/usb/host/uhci-hcd.c |    1 
 5 files changed, 27 insertions(+), 93 deletions(-)

Index: linux-2.6/drivers/usb/core/hcd-pci.c
===================================================================
--- linux-2.6.orig/drivers/usb/core/hcd-pci.c
+++ linux-2.6/drivers/usb/core/hcd-pci.c
@@ -201,6 +201,7 @@ int usb_hcd_pci_suspend(struct pci_dev *
 	struct usb_hcd		*hcd = pci_get_drvdata(dev);
 	int			retval = 0;
 	int			wake, w;
+	int			has_pci_pm;
 
 	/* Root hub suspend should have stopped all downstream traffic,
 	 * and all bus master traffic.  And done so for both the interface
@@ -230,6 +231,15 @@ int usb_hcd_pci_suspend(struct pci_dev *
 
 	synchronize_irq(dev->irq);
 
+	/* Downstream ports from this root hub should already be quiesced, so
+	 * there will be no DMA activity.  Now we can shut down the upstream
+	 * link (except maybe for PME# resume signaling) and enter some PCI
+	 * low power state, if the hardware allows.
+	 */
+	pci_disable_device(dev);
+
+	pci_save_state(dev);
+
 	/* Don't fail on error to enable wakeup.  We rely on pci code
 	 * to reject requests the hardware can't implement, rather
 	 * than coding the same thing.
@@ -241,35 +251,6 @@ int usb_hcd_pci_suspend(struct pci_dev *
 		wake = w;
 	dev_dbg(&dev->dev, "wakeup: %d\n", wake);
 
-	/* Downstream ports from this root hub should already be quiesced, so
-	 * there will be no DMA activity.  Now we can shut down the upstream
-	 * link (except maybe for PME# resume signaling) and enter some PCI
-	 * low power state, if the hardware allows.
-	 */
-	pci_disable_device(dev);
- done:
-	return retval;
-}
-EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
-
-/**
- * usb_hcd_pci_suspend_late - suspend a PCI-based HCD after IRQs are disabled
- * @dev: USB Host Controller being suspended
- * @message: Power Management message describing this state transition
- *
- * Store this function in the HCD's struct pci_driver as .suspend_late.
- */
-int usb_hcd_pci_suspend_late(struct pci_dev *dev, pm_message_t message)
-{
-	int			retval = 0;
-	int			has_pci_pm;
-
-	/* We might already be suspended (runtime PM -- not yet written) */
-	if (dev->current_state != PCI_D0)
-		goto done;
-
-	pci_save_state(dev);
-
 	/* Don't change state if we don't need to */
 	if (message.event == PM_EVENT_FREEZE ||
 			message.event == PM_EVENT_PRETHAW) {
@@ -315,7 +296,7 @@ int usb_hcd_pci_suspend_late(struct pci_
  done:
 	return retval;
 }
-EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend_late);
+EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
 
 /**
  * usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled
@@ -325,65 +306,8 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend_la
  */
 int usb_hcd_pci_resume_early(struct pci_dev *dev)
 {
-	int		retval = 0;
-	pci_power_t	state = dev->current_state;
-
-#ifdef CONFIG_PPC_PMAC
-	/* Reenable ASIC clocks for USB */
-	if (machine_is(powermac)) {
-		struct device_node *of_node;
-
-		of_node = pci_device_to_OF_node(dev);
-		if (of_node)
-			pmac_call_feature(PMAC_FTR_USB_ENABLE,
-						of_node, 0, 1);
-	}
-#endif
-
-	/* NOTE:  chip docs cover clean "real suspend" cases (what Linux
-	 * calls "standby", "suspend to RAM", and so on).  There are also
-	 * dirty cases when swsusp fakes a suspend in "shutdown" mode.
-	 */
-	if (state != PCI_D0) {
-#ifdef	DEBUG
-		int	pci_pm;
-		u16	pmcr;
-
-		pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
-		pci_read_config_word(dev, pci_pm + PCI_PM_CTRL, &pmcr);
-		pmcr &= PCI_PM_CTRL_STATE_MASK;
-		if (pmcr) {
-			/* Clean case:  power to USB and to HC registers was
-			 * maintained; remote wakeup is easy.
-			 */
-			dev_dbg(&dev->dev, "resume from PCI D%d\n", pmcr);
-		} else {
-			/* Clean:  HC lost Vcc power, D0 uninitialized
-			 *   + Vaux may have preserved port and transceiver
-			 *     state ... for remote wakeup from D3cold
-			 *   + or not; HCD must reinit + re-enumerate
-			 *
-			 * Dirty: D0 semi-initialized cases with swsusp
-			 *   + after BIOS init
-			 *   + after Linux init (HCD statically linked)
-			 */
-			dev_dbg(&dev->dev, "resume from previous PCI D%d\n",
-					state);
-		}
-#endif
-
-		retval = pci_set_power_state(dev, PCI_D0);
-	} else {
-		/* Same basic cases: clean (powered/not), dirty */
-		dev_dbg(&dev->dev, "PCI legacy resume\n");
-	}
-
-	if (retval < 0)
-		dev_err(&dev->dev, "can't resume: %d\n", retval);
-	else
-		pci_restore_state(dev);
-
-	return retval;
+	pci_restore_state(dev);
+	return 0;
 }
 EXPORT_SYMBOL_GPL(usb_hcd_pci_resume_early);
 
@@ -398,6 +322,18 @@ int usb_hcd_pci_resume(struct pci_dev *d
 	struct usb_hcd		*hcd;
 	int			retval;
 
+#ifdef CONFIG_PPC_PMAC
+	/* Reenable ASIC clocks for USB */
+	if (machine_is(powermac)) {
+		struct device_node *of_node;
+
+		of_node = pci_device_to_OF_node(dev);
+		if (of_node)
+			pmac_call_feature(PMAC_FTR_USB_ENABLE,
+						of_node, 0, 1);
+	}
+#endif
+
 	hcd = pci_get_drvdata(dev);
 	if (hcd->state != HC_STATE_SUSPENDED) {
 		dev_dbg(hcd->self.controller,
@@ -405,6 +341,8 @@ int usb_hcd_pci_resume(struct pci_dev *d
 		return 0;
 	}
 
+	pci_enable_wake(dev, PCI_D0, false);
+
 	retval = pci_enable_device(dev);
 	if (retval < 0) {
 		dev_err(&dev->dev, "can't re-enable after resume, %d!\n",
Index: linux-2.6/drivers/usb/core/hcd.h
===================================================================
--- linux-2.6.orig/drivers/usb/core/hcd.h
+++ linux-2.6/drivers/usb/core/hcd.h
@@ -257,7 +257,6 @@ extern void usb_hcd_pci_remove(struct pc
 
 #ifdef CONFIG_PM
 extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg);
-extern int usb_hcd_pci_suspend_late(struct pci_dev *dev, pm_message_t msg);
 extern int usb_hcd_pci_resume_early(struct pci_dev *dev);
 extern int usb_hcd_pci_resume(struct pci_dev *dev);
 #endif /* CONFIG_PM */
Index: linux-2.6/drivers/usb/host/ehci-pci.c
===================================================================
--- linux-2.6.orig/drivers/usb/host/ehci-pci.c
+++ linux-2.6/drivers/usb/host/ehci-pci.c
@@ -432,7 +432,6 @@ static struct pci_driver ehci_pci_driver
 
 #ifdef	CONFIG_PM
 	.suspend =	usb_hcd_pci_suspend,
-	.suspend_late =	usb_hcd_pci_suspend_late,
 	.resume_early =	usb_hcd_pci_resume_early,
 	.resume =	usb_hcd_pci_resume,
 #endif
Index: linux-2.6/drivers/usb/host/ohci-pci.c
===================================================================
--- linux-2.6.orig/drivers/usb/host/ohci-pci.c
+++ linux-2.6/drivers/usb/host/ohci-pci.c
@@ -487,7 +487,6 @@ static struct pci_driver ohci_pci_driver
 
 #ifdef	CONFIG_PM
 	.suspend =	usb_hcd_pci_suspend,
-	.suspend_late =	usb_hcd_pci_suspend_late,
 	.resume_early =	usb_hcd_pci_resume_early,
 	.resume =	usb_hcd_pci_resume,
 #endif
Index: linux-2.6/drivers/usb/host/uhci-hcd.c
===================================================================
--- linux-2.6.orig/drivers/usb/host/uhci-hcd.c
+++ linux-2.6/drivers/usb/host/uhci-hcd.c
@@ -942,7 +942,6 @@ static struct pci_driver uhci_pci_driver
 
 #ifdef	CONFIG_PM
 	.suspend =	usb_hcd_pci_suspend,
-	.suspend_late =	usb_hcd_pci_suspend_late,
 	.resume_early =	usb_hcd_pci_resume_early,
 	.resume =	usb_hcd_pci_resume,
 #endif	/* PM */


  reply	other threads:[~2009-01-13 11:33 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-11 11:12 2.6.29-rc1: Reported regressions from 2.6.28 Rafael J. Wysocki
2009-01-11 11:12 ` [Bug #12399] USB wakeup problem on Toshiba Portege R500 Rafael J. Wysocki
2009-01-11 21:14   ` Maxim Levitsky
2009-01-11 11:16 ` [Bug #12417] glx performance drop with: "x86: PAT: implement track/untrack of pfnmap regions for x86 - v3" Rafael J. Wysocki
2009-01-14  7:38   ` Alexey Fisher
2009-01-14  7:51     ` Pallipadi, Venkatesh
2009-01-11 11:16 ` [Bug #12402] 2.6.29-rc: kernel BUG at fs/xfs/support/debug.c:108 Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12416] Recent change to kernel spikes out ccache/distcc Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12400] git-latest: kernel oops in IOMMU setup Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12415] WARNING: at drivers/net/wireless/iwlwifi/iwl-sta.c:689 Rafael J. Wysocki
2009-01-12 11:15   ` Christian Borntraeger
2009-01-12 12:47     ` Rafael J. Wysocki
2009-01-18 15:49       ` Christian Borntraeger
2009-01-11 11:16 ` [Bug #12414] iwl4965 cannot use "ap auto" on latest 2.6.28/29? Rafael J. Wysocki
2009-01-11 13:57   ` Jeff Chua
2009-01-11 18:55     ` Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12422] 2.6.28-git can't resume from str Rafael J. Wysocki
2009-01-11 13:57   ` Jeff Chua
2009-01-11 14:08   ` Daniel Drake
2009-01-11 14:18     ` Christian Borntraeger
2009-01-11 16:13       ` Jeff Chua
2009-01-11 16:18         ` Christian Borntraeger
2009-01-11 16:29         ` Ingo Molnar
2009-01-11 16:36           ` Christian Borntraeger
2009-01-11 16:39             ` Ingo Molnar
2009-01-11 16:56               ` Jeff Chua
2009-01-11 18:07                 ` Ingo Molnar
2009-01-13  1:20                   ` Jeff Chua
2009-01-13  1:28                     ` Ingo Molnar
2009-01-13  2:08                     ` Linus Torvalds
2009-01-13  4:28                       ` Jeff Chua
2009-01-13  5:47                         ` Jeff Chua
2009-01-13 11:32                           ` Rafael J. Wysocki [this message]
2009-01-13 13:30                             ` Jeff Chua
2009-01-11 16:10     ` Jeff Chua
2009-01-11 11:16 ` [Bug #12420] WARNING: at drivers/ata/libata-sff.c:1017 ata_sff_hsm_move+0x45e/0x750() Rafael J. Wysocki
2009-01-11 14:52   ` Alexey Fisher
2009-01-14  7:35   ` Alexey Rempel
2009-01-14  7:40     ` Christian Borntraeger
2009-01-14 10:58       ` Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12418] Repeated ioctl(4, 0x40046445, ..) loop in glxgears Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12419] possible circular locking dependency on i915 dma Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12427] cpumask change causes sparc build bustage Rafael J. Wysocki
2009-01-11 11:16 ` [Bug #12428] Build error on latest git Rafael J. Wysocki
2009-01-11 13:46 ` 2.6.29-rc1: Reported regressions from 2.6.28 Jaswinder Singh Rajput
2009-01-11 13:52   ` Ingo Molnar
2009-01-11 19:00     ` Rafael J. Wysocki
2009-01-13  3:24       ` Jaswinder Singh Rajput
2009-01-13 11:23         ` Rafael J. Wysocki
2009-01-11 13:47 ` Ingo Molnar
2009-01-11 14:22 ` Matthias Heinz
2009-01-11 14:39 ` Matthias Heinz
2009-01-19 21:28 2.6.29-rc2-git1: " Rafael J. Wysocki
2009-01-19 21:32 ` [Bug #12422] 2.6.28-git can't resume from str Rafael J. Wysocki
2009-01-20  0:39   ` Harvey Harrison
2009-01-20  1:46   ` Jeff Chua

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=200901131232.17941.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=borntraeger@de.ibm.com \
    --cc=dsd@gentoo.org \
    --cc=jeff.chua.linux@gmail.com \
    --cc=kernel-testers@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=phil@ipom.com \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®