All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.14 USB vs. sleep issues
@ 2005-11-03  6:33 Benjamin Herrenschmidt
  2005-11-03  9:03 ` Eddy Petrişor
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-03  6:33 UTC (permalink / raw)
  To: debian-powerpc; +Cc: linuxppc-dev list

For those who experience crashes on sleep and/or wakeup (typically due
to USB) with 2.6.14, I made a test patch that might help. Please let me
know if it makes things more reliable.

http://gate.crashing.org/~benh/fix-ohci-sleep.diff

Note that the patch is totally untested here so it may be just plain
bogus :)

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-03  6:33 2.6.14 USB vs. sleep issues Benjamin Herrenschmidt
@ 2005-11-03  9:03 ` Eddy Petrişor
  2005-11-03 21:21   ` Benjamin Herrenschmidt
  2005-11-05 21:58 ` Bin Zhang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 28+ messages in thread
From: Eddy Petrişor @ 2005-11-03  9:03 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On 11/3/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> For those who experience crashes on sleep and/or wakeup (typically due
> to USB) with 2.6.14, I made a test patch that might help. Please let me
> know if it makes things more reliable.
>
> http://gate.crashing.org/~benh/fix-ohci-sleep.diff

So this supposed to work with the USB sleep support enabled, right?
If this works then I will be very thankful!
I hope I have the time to test this patch this evening.

> Note that the patch is totally untested here so it may be just plain
> bogus :)

No problem.

AIUI, this should allow me to put my PB 5,2 to sleep while a usb stick
is mounted and come back from sleep with no problem and the stick to
be still mounted, right?

--
Regards,
EddyP
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
"Imagination is more important than knowledge" A.Einstein

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-03  9:03 ` Eddy Petrişor
@ 2005-11-03 21:21   ` Benjamin Herrenschmidt
  2005-11-04  7:13     ` Eddy Petrişor
  0 siblings, 1 reply; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-03 21:21 UTC (permalink / raw)
  To: Eddy Petrişor; +Cc: linuxppc-dev list, debian-powerpc


> So this supposed to work with the USB sleep support enabled, right?
> If this works then I will be very thankful!
> I hope I have the time to test this patch this evening.
> 
> > Note that the patch is totally untested here so it may be just plain
> > bogus :)
> 
> No problem.
> 
> AIUI, this should allow me to put my PB 5,2 to sleep while a usb stick
> is mounted and come back from sleep with no problem and the stick to
> be still mounted, right?

Heh, in _theory_ :) The first aim of the patch is to remove the crash on
sleep/wakeup in 2.6.14. If it doesn't blow up, that's already a good
first step :) Wether suspend with your USB stick works is a different
matter, mostly due to the USB stack itself.

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-03 21:21   ` Benjamin Herrenschmidt
@ 2005-11-04  7:13     ` Eddy Petrişor
  2005-11-04  7:18       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 28+ messages in thread
From: Eddy Petrişor @ 2005-11-04  7:13 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On 11/3/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> > So this supposed to work with the USB sleep support enabled, right?
> > If this works then I will be very thankful!
> > I hope I have the time to test this patch this evening.
> >
> > > Note that the patch is totally untested here so it may be just plain
> > > bogus :)
> >
> > No problem.
> >
> > AIUI, this should allow me to put my PB 5,2 to sleep while a usb stick
> > is mounted and come back from sleep with no problem and the stick to
> > be still mounted, right?
>
> Heh, in _theory_ :) The first aim of the patch is to remove the crash on
> sleep/wakeup in 2.6.14. If it doesn't blow up, that's already a good

Well, I couldn't get to that point (getting back from sleep) :-D

> first step :) Wether suspend with your USB stick works is a different
> matter, mostly due to the USB stack itself.

The kernel oopsed when it was supposed to go to sleep:

Nov  4 09:01:34 localhost kernel: usb 3-1: no poweroff yet, suspending inst=
ead
Nov  4 09:01:34 localhost kernel: usb usb4: no poweroff yet, suspending ins=
tead
Nov  4 09:01:34 localhost kernel: Oops: Exception in kernel mode, sig: 5 [#=
1]
Nov  4 09:01:34 localhost kernel: PREEMPT
Nov  4 09:01:34 localhost kernel: NIP: C00184F4 LR: D224199C SP:
CD7D5D00 REGS: cd7d5c50 TRAP: 0700    Not tainted
Nov  4 09:01:34 localhost kernel: MSR: 00029032 EE: 1 PR: 0 FP: 0 ME:
1 IR/DR: 11
Nov  4 09:01:34 localhost kernel: TASK =3D cec8f2e0[2751] 'pbbuttonsd'
THREAD: cd7d4000
Nov  4 09:01:34 localhost kernel: Last syscall: 54
Nov  4 09:01:34 localhost kernel: GPR00: 00000001 CD7D5D00 CEC8F2E0
00000001 00001000 00001000 000007D0 FFFFFFFC
Nov  4 09:01:34 localhost kernel: GPR08: D220C064 CD7D4000 00000000
00000000 0000D903 1002C830 100D0000 100E2CB8
Nov  4 09:01:34 localhost kernel: GPR16: 100D0000 100A0000 00000000
100D0000 100EC488 10010000 10010000 D20C0000
Nov  4 09:01:34 localhost kernel: GPR24: D20C0000 D20C0000 C0310000
00000000 C0300000 00000006 CF3EDC00 CF3EDCD0
Nov  4 09:01:34 localhost kernel: NIP [c00184f4] sub_preempt_count+0x14/0x7=
0
Nov  4 09:01:34 localhost kernel: LR [d224199c]
ehci_hub_suspend+0x1ac/0x210 [ehci_hcd]
Nov  4 09:01:34 localhost kernel: Call trace:
Nov  4 09:01:34 localhost kernel:  [d20b47e4]
hcd_hub_suspend+0x34/0x50 [usbcore]
Nov  4 09:01:34 localhost kernel:  [d20b2958]
__usb_suspend_device+0x308/0x330 [usbcore]
Nov  4 09:01:34 localhost kernel:  [d20b2ae0]
usb_suspend_device+0x40/0x70 [usbcore]
Nov  4 09:01:34 localhost kernel:  [d20aead0]
usb_generic_suspend+0xa0/0xb0 [usbcore]
Nov  4 09:01:34 localhost kernel:  [c01d7904] suspend_device+0x104/0x160
Nov  4 09:01:34 localhost kernel:  [c01d7b40] device_suspend+0x110/0x320
Nov  4 09:01:34 localhost kernel:  [c037d6b0] pmac_suspend_devices+0x50/0x1=
d0
Nov  4 09:01:34 localhost kernel:  [c037de58] pmu_ioctl+0x388/0x9f0
Nov  4 09:01:34 localhost kernel:  [c00961dc] do_ioctl+0x9c/0xb0
Nov  4 09:01:34 localhost kernel:  [c009627c] vfs_ioctl+0x8c/0x4c0
Nov  4 09:01:34 localhost kernel:  [c0096744] sys_ioctl+0x94/0xb0
Nov  4 09:01:34 localhost kernel:  [c0004840] ret_from_syscall+0x0/0x44



--
Regards,
EddyP
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
"Imagination is more important than knowledge" A.Einstein

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-04  7:13     ` Eddy Petrişor
@ 2005-11-04  7:18       ` Benjamin Herrenschmidt
  2005-11-04 19:32         ` Vivenzio Pagliari
  0 siblings, 1 reply; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-04  7:18 UTC (permalink / raw)
  To: Eddy Petrişor; +Cc: linuxppc-dev list, debian-powerpc


> > Heh, in _theory_ :) The first aim of the patch is to remove the crash on
> > sleep/wakeup in 2.6.14. If it doesn't blow up, that's already a good
> 
> Well, I couldn't get to that point (getting back from sleep) :-D
> 
> > first step :) Wether suspend with your USB stick works is a different
> > matter, mostly due to the USB stack itself.
> 
> The kernel oopsed when it was supposed to go to sleep:

I would say your first mistake is to use PREEMPT :) There are various
issues with PREEMPT on ppc32 that have not really been addressed so far,
and the USB code has some "holes" that I wouldn't trust in a PREEMPT
environment.

Anyway, I'll try to come up with a better patch this week-end. Please,
continue giving me feedback with oops backtraces etc...

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-04  7:18       ` Benjamin Herrenschmidt
@ 2005-11-04 19:32         ` Vivenzio Pagliari
  2005-11-04 21:48           ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 28+ messages in thread
From: Vivenzio Pagliari @ 2005-11-04 19:32 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linuxppc-dev list, debian-powerpc, Eddy Petrişor

Benjamin Herrenschmidt wrote:
> 
> I would say your first mistake is to use PREEMPT :) There are various
> issues with PREEMPT on ppc32 that have not really been addressed so far,
> and the USB code has some "holes" that I wouldn't trust in a PREEMPT
> environment.
> 

What do you mean exactly? Should CONFIG_PREEMPT not be used?
And what about CONFIG_PREEMPT_VOLUNTARY?

Vivenzio

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-04 19:32         ` Vivenzio Pagliari
@ 2005-11-04 21:48           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-04 21:48 UTC (permalink / raw)
  To: Vivenzio Pagliari; +Cc: linuxppc-dev list, debian-powerpc, Eddy Petrişor

On Fri, 2005-11-04 at 20:32 +0100, Vivenzio Pagliari wrote:
> Benjamin Herrenschmidt wrote:
> > 
> > I would say your first mistake is to use PREEMPT :) There are various
> > issues with PREEMPT on ppc32 that have not really been addressed so far,
> > and the USB code has some "holes" that I wouldn't trust in a PREEMPT
> > environment.
> > 
> 
> What do you mean exactly? Should CONFIG_PREEMPT not be used?
> And what about CONFIG_PREEMPT_VOLUNTARY?

I would avoid both for now.

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-03  6:33 2.6.14 USB vs. sleep issues Benjamin Herrenschmidt
  2005-11-03  9:03 ` Eddy Petrişor
@ 2005-11-05 21:58 ` Bin Zhang
  2005-11-05 22:17   ` Benjamin Herrenschmidt
  2005-11-07  9:13 ` Charles-Edouard Ruault
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 28+ messages in thread
From: Bin Zhang @ 2005-11-05 21:58 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On 11/3/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> For those who experience crashes on sleep and/or wakeup (typically due
> to USB) with 2.6.14, I made a test patch that might help. Please let me
> know if it makes things more reliable.
>
I've tried your patch with usb wifi dlink dwl-g122 (my eth1). It works.
There are some differences in /var/log/syslog :
-----------------------
resume without your patch :

Nov  5 22:39:27 localhost anacron[5244]: Anacron 2.3 started on 2005-11-05
Nov  5 22:39:27 localhost anacron[5244]: Normal exit (0 jobs run)
Nov  5 22:39:27 localhost /usr/sbin/gpm[5268]: oops() invoked from gpn.c(20=
5)
Nov  5 22:39:27 localhost /usr/sbin/gpm[5268]: /var/run/gpm.pid: No
such file or directory
Nov  5 22:39:28 localhost pbbuttonsd: INFO: Script
'/etc/power/pmcs-pbbuttonsd suspend ac ram' launched and exited
normally
Nov  5 22:39:28 localhost kernel: ural 4-1:1.0: resume is unsafe!
Nov  5 22:39:28 localhost kernel: usb 4-1: no poweroff yet, suspending inst=
ead
Nov  5 22:39:28 localhost kernel: failed to set volume
Nov  5 22:39:28 localhost kernel: usb usb4: no poweroff yet, suspending ins=
tead
Nov  5 22:39:28 localhost kernel: usb 1-1: no poweroff yet, suspending inst=
ead
Nov  5 22:39:28 localhost kernel: usb usb3: no poweroff yet, suspending ins=
tead
Nov  5 22:39:28 localhost kernel: usb usb2: no poweroff yet, suspending ins=
tead
Nov  5 22:39:28 localhost kernel: usb usb1: no poweroff yet, suspending ins=
tead
Nov  5 22:39:29 localhost kernel: eth0: suspending, WakeOnLan disabled
Nov  5 22:39:29 localhost kernel: radeonfb (0000:00:10.0): suspending
to state: 2...
Nov  5 22:39:29 localhost kernel: uninorth-agp: disabling AGP on
device 0000:00:10.0
Nov  5 22:39:29 localhost kernel: uninorth-agp: disabling AGP on
bridge 0000:00:0b.0
Nov  5 22:39:29 localhost kernel: radeonfb (0000:00:10.0): resuming
from state: 2...
Nov  5 22:39:29 localhost kernel: PCI: Enabling device 0000:00:10.0
(0000 -> 0003)
Nov  5 22:39:29 localhost kernel: radeon: PAD_CTLR_STRENGTH doesn't stabili=
ze !
Nov  5 22:39:29 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:0b.0 into 4x mode
Nov  5 22:39:29 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:10.0 into 4x mode
Nov  5 22:39:29 localhost kernel: PCI: Enabling device 0001:10:1b.0
(0000 -> 0002)
Nov  5 22:39:29 localhost kernel: PCI: Enabling device 0001:10:1b.1
(0000 -> 0002)
Nov  5 22:39:29 localhost kernel: PCI: Enabling device 0001:10:1b.2
(0000 -> 0002)
Nov  5 22:39:29 localhost kernel: ehci_hcd 0001:10:1b.2: park 0
Nov  5 22:39:29 localhost kernel: ehci_hcd 0001:10:1b.2: USB 2.0
restarted, EHCI 1.00, driver 10 Dec 2004
Nov  5 22:39:31 localhost kernel: eth0: resuming
Nov  5 22:39:31 localhost kernel: PHY ID: 4061e4, addr: 0
Nov  5 22:39:32 localhost kernel: hda: Enabling Ultra DMA 5
Nov  5 22:39:32 localhost kernel: hdc: Enabling MultiWord DMA 2
Nov  5 22:39:32 localhost dhclient: receive_packet failed on eth1:
Network is down
Nov  5 22:39:32 localhost kernel: usb 4-1: USB disconnect, address 3
Nov  5 22:39:32 localhost kernel: usb 4-1: new high speed USB device
using ehci_hcd and address 4
Nov  5 22:39:32 localhost postfix/postfix-script: refreshing the
Postfix mail system
Nov  5 22:39:32 localhost postfix/master[3972]: reload configuration
/etc/postfix
Nov  5 22:39:32 localhost kernel: ural_eeprom_read: 4 -> 00:11:95:87:2c:ad
Nov  5 22:39:32 localhost kernel: eth1: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mb=
ps
Nov  5 22:39:32 localhost kernel: eth1: 11g rates: 1Mbps 2Mbps 5.5Mbps
11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
Nov  5 22:39:32 localhost kernel: eth1: RT2570 (rev 0x03), RF RT2526,
ether 00:11:95:87:2c:ad at usb-0001:10:1b.2-1
Nov  5 22:39:39 localhost kernel: adb: starting probe task...
Nov  5 22:39:39 localhost dhclient: Internet Software Consortium DHCP
Client 2.0pl5
Nov  5 22:39:39 localhost dhclient: Copyright 1995, 1996, 1997, 1998,
1999 The Internet Software Consortium.
Nov  5 22:39:39 localhost dhclient: All rights reserved.
Nov  5 22:39:39 localhost dhclient:
Nov  5 22:39:39 localhost dhclient: Please contribute if you find this
software useful.
Nov  5 22:39:39 localhost dhclient: For info, please visit
http://www.isc.org/dhcp-contrib.html
Nov  5 22:39:39 localhost dhclient:
Nov  5 22:39:39 localhost dhclient: sit0: unknown hardware address type 776
Nov  5 22:39:39 localhost kernel: ural_set_macaddr: 00:11:95:87:2c:ad
Nov  5 22:39:39 localhost kernel: setting MAC address to 00:11:95:87:2c:ad
Nov  5 22:39:39 localhost kernel: leaving promiscuous mode
Nov  5 22:39:39 localhost kernel: ural_set_macaddr: 00:11:95:87:2c:ad
Nov  5 22:39:39 localhost kernel: setting MAC address to 00:11:95:87:2c:ad
Nov  5 22:39:39 localhost kernel: adb devices: [2]: 2 c4 [3]: 3 1 [7]: 7 1f
Nov  5 22:39:39 localhost kernel: ADB keyboard at 2, handler 1
Nov  5 22:39:39 localhost kernel: ADB mouse at 3, handler set to 4 (trackpa=
d)
Nov  5 22:39:39 localhost kernel: adb: finished probe task...
Nov  5 22:39:39 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:0b.0 into 4x mode
Nov  5 22:39:39 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:10.0 into 4x mode
Nov  5 22:39:39 localhost kernel: [drm] Loading R200 Microcode
Nov  5 22:39:39 localhost ifd[5442]: starting
Nov  5 22:39:39 localhost ifd[5442]: executing:
'/usr/share/laptop-net/link-change eth0 managed unknown
up,running,disconnected'
Nov  5 22:39:39 localhost ifd: PID file written: /var/run/ifd.pid
Nov  5 22:39:39 localhost pbbuttonsd: INFO: Script
'/etc/power/pmcs-pbbuttonsd resume ac ram' launched and exited
normally
Nov  5 22:39:39 localhost laptop-net: Stopping network interface "eth0"
Nov  5 22:39:40 localhost dhclient: sit0: unknown hardware address type 776
Nov  5 22:39:40 localhost dhclient: Listening on LPF/eth1/00:11:95:87:2c:ad
Nov  5 22:39:40 localhost dhclient: Sending on   LPF/eth1/00:11:95:87:2c:ad
Nov  5 22:39:40 localhost dhclient: Sending on   Socket/fallback/fallback-n=
et
Nov  5 22:39:40 localhost dhclient: DHCPREQUEST on eth1 to
255.255.255.255 port 67
Nov  5 22:39:42 localhost kernel: ural_set_macaddr: 00:11:95:87:2c:ad
Nov  5 22:39:42 localhost kernel: setting MAC address to 00:11:95:87:2c:ad
Nov  5 22:39:42 localhost kernel: ural_set_macaddr: 00:11:95:87:2c:ad
Nov  5 22:39:42 localhost kernel: setting MAC address to 00:11:95:87:2c:ad
Nov  5 22:39:42 localhost kernel: ural_set_macaddr: 00:11:95:87:2c:ad
Nov  5 22:39:42 localhost kernel: setting MAC address to 00:11:95:87:2c:ad
Nov  5 22:39:44 localhost dhclient: DHCPREQUEST on eth1 to
255.255.255.255 port 67
Nov  5 22:39:45 localhost kernel: setting BSSID to 00:11:95:36:fc:f7
Nov  5 22:39:45 localhost kernel: enabling TSF synchronization
Nov  5 22:39:49 localhost kernel: eth1: no IPv6 routers present
Nov  5 22:39:53 localhost dhclient: DHCPDISCOVER on eth1 to
255.255.255.255 port 67 interval 5
Nov  5 22:39:53 localhost dhclient: DHCPOFFER from 192.168.0.1
Nov  5 22:39:55 localhost dhclient: DHCPREQUEST on eth1 to
255.255.255.255 port 67
Nov  5 22:39:55 localhost dhclient: DHCPACK from 192.168.0.1
Nov  5 22:39:55 localhost kernel: leaving promiscuous mode
Nov  5 22:39:55 localhost kernel: leaving promiscuous mode
Nov  5 22:39:56 localhost postfix/postfix-script: refreshing the
Postfix mail system
Nov  5 22:39:56 localhost postfix/master[3972]: reload configuration
/etc/postfix
Nov  5 22:39:56 localhost dhclient: bound to 192.168.0.101 -- renewal
in 302400 seconds.
Nov  5 22:39:56 localhost ifd[5442]: + cat:
/var/run/dhclient.eth0.pid: No such file or directory
Nov  5 22:40:08 localhost kernel: eth0: no IPv6 routers present
--------------------------------------

----------------------------------
resume with your patch :

Nov  5 22:28:21 localhost anacron[6603]: Anacron 2.3 started on 2005-11-05
Nov  5 22:28:21 localhost anacron[6603]: Normal exit (0 jobs run)
Nov  5 22:28:21 localhost /usr/sbin/gpm[6627]: oops() invoked from gpn.c(20=
5)
Nov  5 22:28:21 localhost /usr/sbin/gpm[6627]: /var/run/gpm.pid: No
such file or directory
Nov  5 22:28:21 localhost pbbuttonsd: INFO: Script
'/etc/power/pmcs-pbbuttonsd suspend ac ram' launched and exited
normally
Nov  5 22:28:22 localhost kernel: ural 2-1:1.0: resume is unsafe!
Nov  5 22:28:22 localhost kernel: usb 2-1: no poweroff yet, suspending inst=
ead
Nov  5 22:28:22 localhost kernel: failed to set volume
Nov  5 22:28:22 localhost kernel: usb 1-1: no poweroff yet, suspending inst=
ead
Nov  5 22:28:22 localhost kernel: usb usb3: no poweroff yet, suspending ins=
tead
Nov  5 22:28:22 localhost kernel: usb usb2: no poweroff yet, suspending ins=
tead
Nov  5 22:28:22 localhost kernel: usb usb1: no poweroff yet, suspending ins=
tead
Nov  5 22:28:22 localhost kernel: eth0: suspending, WakeOnLan disabled
Nov  5 22:28:22 localhost kernel: radeonfb (0000:00:10.0): suspending
to state: 2...
Nov  5 22:28:22 localhost kernel: uninorth-agp: disabling AGP on
device 0000:00:10.0
Nov  5 22:28:22 localhost kernel: uninorth-agp: disabling AGP on
bridge 0000:00:0b.0
Nov  5 22:28:23 localhost kernel: radeonfb (0000:00:10.0): resuming
from state: 2...
Nov  5 22:28:23 localhost kernel: PCI: Enabling device 0000:00:10.0
(0000 -> 0003)
Nov  5 22:28:23 localhost kernel: radeon: PAD_CTLR_STRENGTH doesn't stabili=
ze !
Nov  5 22:28:23 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:0b.0 into 4x mode
Nov  5 22:28:23 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:10.0 into 4x mode
Nov  5 22:28:23 localhost kernel: PCI: Enabling device 0001:10:1b.0
(0000 -> 0002)
Nov  5 22:28:23 localhost kernel: PCI: Enabling device 0001:10:1b.1
(0000 -> 0002)
Nov  5 22:28:24 localhost kernel: eth0: resuming
Nov  5 22:28:24 localhost kernel: PHY ID: 4061e4, addr: 0
Nov  5 22:28:25 localhost kernel: hda: Enabling Ultra DMA 5
Nov  5 22:28:25 localhost kernel: hdc: Enabling MultiWord DMA 2
Nov  5 22:28:38 localhost kernel: adb: starting probe task...
Nov  5 22:28:38 localhost kernel: adb devices: [2]: 2 c4 [3]: 3 1 [7]: 7 1f
Nov  5 22:28:38 localhost kernel: ADB keyboard at 2, handler 1
Nov  5 22:28:38 localhost kernel: ADB mouse at 3, handler set to 4 (trackpa=
d)
Nov  5 22:28:38 localhost kernel: adb: finished probe task...
Nov  5 22:28:38 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:0b.0 into 4x mode
Nov  5 22:28:38 localhost kernel: agpgart: Putting AGP V2 device at
0000:00:10.0 into 4x mode
Nov  5 22:28:38 localhost kernel: [drm] Loading R200 Microcode
Nov  5 22:28:38 localhost ifd[6680]: starting
Nov  5 22:28:38 localhost ifd[6680]: executing:
'/usr/share/laptop-net/link-change eth0 managed unknown
up,running,disconnected'
Nov  5 22:28:38 localhost ifd: PID file written: /var/run/ifd.pid
Nov  5 22:28:38 localhost pbbuttonsd: INFO: Script
'/etc/power/pmcs-pbbuttonsd resume ac ram' launched and exited
normally
Nov  5 22:28:39 localhost laptop-net: Stopping network interface "eth0"
Nov  5 22:28:39 localhost ifd[6680]: + cat:
/var/run/dhclient.eth0.pid: No such file or directory
Nov  5 22:28:50 localhost kernel: eth0: no IPv6 routers present
-------------------------------------------------------------------

Thanks,
Bin


> http://gate.crashing.org/~benh/fix-ohci-sleep.diff
>
> Note that the patch is totally untested here so it may be just plain
> bogus :)
>
> Ben.
>
>
>
> --
> To UNSUBSCRIBE, email to debian-powerpc-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian=
.org
>
>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-05 21:58 ` Bin Zhang
@ 2005-11-05 22:17   ` Benjamin Herrenschmidt
  2005-11-06 10:54     ` Bin Zhang
  2005-11-11 21:47     ` Eddy Petrisor
  0 siblings, 2 replies; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-05 22:17 UTC (permalink / raw)
  To: Bin Zhang; +Cc: linuxppc-dev list, debian-powerpc

On Sat, 2005-11-05 at 22:58 +0100, Bin Zhang wrote:
> On 11/3/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > For those who experience crashes on sleep and/or wakeup (typically due
> > to USB) with 2.6.14, I made a test patch that might help. Please let me
> > know if it makes things more reliable.
> >
> I've tried your patch with usb wifi dlink dwl-g122 (my eth1). It works.
> There are some differences in /var/log/syslog :

I have another patch tho:

Index: linux-2.6.14-benh/drivers/usb/core/hcd-pci.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/core/hcd-pci.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/core/hcd-pci.c	2005-11-05 11:58:55.000000000 +1100
@@ -32,6 +32,13 @@
 #include <linux/usb.h>
 #include "hcd.h"
 
+#ifdef CONFIG_PPC_PMAC
+#include <asm/machdep.h>
+#include <asm/pmac_feature.h>
+#include <asm/pci-bridge.h>
+#include <asm/prom.h>
+#endif
+
 
 /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
 
@@ -278,6 +285,18 @@
 		break;
 	}
 
+#ifdef CONFIG_PPC_PMAC
+	if (retval == 0 && _machine == _MACH_Pmac) {
+	   	struct device_node	*of_node;
+
+		/* Disable USB PAD & cell clock */
+		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.
+							    controller));
+		if (of_node)
+			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
+	}
+#endif /* CONFIG_PPC_PMAC */
+
 	/* update power_state **ONLY** to make sysfs happier */
 	if (retval == 0)
 		dev->dev.power.power_state = message;
@@ -303,6 +322,18 @@
 		return 0;
 	}
 
+#ifdef CONFIG_PPC_PMAC
+	if (_machine == _MACH_Pmac) {
+		struct device_node *of_node;
+
+		/* Re-enable USB PAD & cell clock */
+		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.
+							    controller));
+		if (of_node)
+			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 1);
+	}
+#endif /* CONFIG_PPC_PMAC */
+
 	/* 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.
@@ -381,7 +412,6 @@
 		usb_hc_died (hcd);
 	}
 
-	retval = pci_enable_device(dev);
 	return retval;
 }
 EXPORT_SYMBOL (usb_hcd_pci_resume);
Index: linux-2.6.14-benh/drivers/usb/host/ehci-hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ehci-hcd.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ehci-hcd.c	2005-11-06 08:26:42.000000000 +1100
@@ -750,6 +750,15 @@
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep (100);
 
+	/* Disable emission of interrupts during suspend */
+	writel(0, &ehci->regs->intr_enable);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(dev->irq);
+
+	/* Tell root hub not to bother trying to resume */
+	set_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
+
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub, message);
 #else
@@ -776,6 +785,9 @@
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep (100);
 
+	clear_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
+	set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+
 	/* If any port is suspended (or owned by the companion),
 	 * we know we can/must resume the HC (and mustn't reset it).
 	 */
Index: linux-2.6.14-benh/drivers/usb/host/ehci-q.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ehci-q.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ehci-q.c	2005-11-03 17:03:27.000000000 +1100
@@ -926,6 +926,11 @@
 #endif
 
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		return -ESHUTDOWN;
+	}
+
 	qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv);
 
 	/* Control/bulk operations through TTs don't need scheduling,
Index: linux-2.6.14-benh/drivers/usb/host/ehci-sched.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ehci-sched.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ehci-sched.c	2005-11-03 17:05:54.000000000 +1100
@@ -602,6 +602,11 @@
 
 	spin_lock_irqsave (&ehci->lock, flags);
 
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		return -ESHUTDOWN;
+	}
+
 	/* get qh and force any scheduling errors */
 	INIT_LIST_HEAD (&empty);
 	qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv);
@@ -1456,6 +1461,11 @@
 
 	/* schedule ... need to lock */
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		status = -ESHUTDOWN;
+		goto done;
+	}
 	status = iso_stream_schedule (ehci, urb, stream);
  	if (likely (status == 0))
 		itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
@@ -1815,6 +1825,11 @@
 
 	/* schedule ... need to lock */
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		status = -ESHUTDOWN;
+		goto done;
+	}
 	status = iso_stream_schedule (ehci, urb, stream);
  	if (status == 0)
 		sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
Index: linux-2.6.14-benh/drivers/usb/host/ohci-hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ohci-hcd.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ohci-hcd.c	2005-11-06 08:34:41.000000000 +1100
@@ -252,6 +252,10 @@
 
 	spin_lock_irqsave (&ohci->lock, flags);
 
+	if (HC_IS_SUSPENDED(hcd->state)) {
+		retval = -ESHUTDOWN;
+		goto fail;
+	}
 	/* don't submit to a dead HC */
 	if (!HC_IS_RUNNING(hcd->state)) {
 		retval = -ENODEV;
Index: linux-2.6.14-benh/drivers/usb/host/ohci-hub.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ohci-hub.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ohci-hub.c	2005-11-05 13:12:24.000000000 +1100
@@ -139,6 +139,9 @@
 	u32			temp, enables;
 	int			status = -EINPROGRESS;
 
+	if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
+		return -ESHUTDOWN;
+
 	if (time_before (jiffies, ohci->next_statechange))
 		msleep(5);
 
@@ -219,13 +222,6 @@
 	/* Sometimes PCI D3 suspend trashes frame timings ... */
 	periodic_reinit (ohci);
 
-	/* interrupts might have been disabled */
-	ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
-	if (ohci->ed_rm_list)
-		ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
-	ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
-			&ohci->regs->intrstatus);
-
 	/* Then re-enable operations */
 	ohci_writel (ohci, OHCI_USB_OPER, &ohci->regs->control);
 	(void) ohci_readl (ohci, &ohci->regs->control);
@@ -241,6 +237,13 @@
 	/* TRSMRCY */
 	msleep (10);
 
+	/* interrupts might have been disabled */
+	ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
+	if (ohci->ed_rm_list)
+		ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
+	ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
+			&ohci->regs->intrstatus);
+
 	/* keep it alive for ~5x suspend + resume costs */
 	ohci->next_statechange = jiffies + msecs_to_jiffies (250);
 
@@ -308,6 +311,9 @@
 	int		can_suspend = hcd->can_wakeup;
 	unsigned long	flags;
 
+	if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
+		return 0;
+
 	spin_lock_irqsave (&ohci->lock, flags);
 
 	/* handle autosuspended root:  finish resuming before
@@ -441,6 +447,9 @@
 		return -EINVAL;
 	port--;
 
+	if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
+		return -ESHUTDOWN;
+
 	/* start port reset before HNP protocol times out */
 	status = ohci_readl(ohci, &ohci->regs->roothub.portstatus [port]);
 	if (!(status & RH_PS_CCS))
@@ -526,6 +535,9 @@
 	u32		temp;
 	int		retval = 0;
 
+	if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
+		return -ESHUTDOWN;
+
 	switch (typeReq) {
 	case ClearHubFeature:
 		switch (wValue) {
Index: linux-2.6.14-benh/drivers/usb/host/ohci-pci.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ohci-pci.c	2005-10-31 10:52:24.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ohci-pci.c	2005-11-05 12:46:53.000000000 +1100
@@ -14,13 +14,6 @@
  * This file is licenced under the GPL.
  */
  
-#ifdef CONFIG_PPC_PMAC
-#include <asm/machdep.h>
-#include <asm/pmac_feature.h>
-#include <asm/pci-bridge.h>
-#include <asm/prom.h>
-#endif
-
 #ifndef CONFIG_PCI
 #error "This file is PCI bus glue.  CONFIG_PCI must be defined."
 #endif
@@ -118,6 +111,15 @@
 	if (time_before (jiffies, ohci->next_statechange))
 		msleep (100);
 
+	/* Disable emission of interrupts during suspend */
+	ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(dev->irq);
+
+	/* Tell root hub not to bother trying to resume */
+	set_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
+
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub, message);
 #else
@@ -129,16 +131,6 @@
 	/* let things settle down a bit */
 	msleep (100);
 	
-#ifdef CONFIG_PPC_PMAC
-	if (_machine == _MACH_Pmac) {
-	   	struct device_node	*of_node;
- 
-		/* Disable USB PAD & cell clock */
-		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
-		if (of_node)
-			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
-	}
-#endif /* CONFIG_PPC_PMAC */
 	return 0;
 }
 
@@ -148,20 +140,13 @@
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
 	int			retval = 0;
 
-#ifdef CONFIG_PPC_PMAC
-	if (_machine == _MACH_Pmac) {
-		struct device_node *of_node;
-
-		/* Re-enable USB PAD & cell clock */
-		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
-		if (of_node)
-			pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
-	}
-#endif /* CONFIG_PPC_PMAC */
-
 	/* resume root hub */
 	if (time_before (jiffies, ohci->next_statechange))
 		msleep (100);
+
+	clear_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
+	set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+
 #ifdef	CONFIG_USB_SUSPEND
 	/* get extra cleanup even if remote wakeup isn't in use */
 	retval = usb_resume_device (hcd->self.root_hub);
Index: linux-2.6.14-benh/drivers/usb/core/hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/core/hcd.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/core/hcd.c	2005-11-05 11:56:48.000000000 +1100
@@ -1600,7 +1600,8 @@
 	struct usb_hcd		*hcd = __hcd;
 	int			start = hcd->state;
 
-	if (start == HC_STATE_HALT)
+	if (start == HC_STATE_HALT ||
+	    !test_bit(HC_FLAG_IRQ_ON, &hcd->bitflags))
 		return IRQ_NONE;
 	if (hcd->driver->irq (hcd, r) == IRQ_NONE)
 		return IRQ_NONE;
@@ -1736,6 +1737,9 @@
 	if (hcd->driver->irq) {
 		char	buf[8], *bufp = buf;
 
+		set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+		wmb();
+
 #ifdef __sparc__
 		bufp = __irq_itoa(irqnum);
 #else
Index: linux-2.6.14-benh/drivers/usb/core/hcd.h
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/core/hcd.h	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/core/hcd.h	2005-11-05 12:19:11.000000000 +1100
@@ -71,6 +71,10 @@
 	/*
 	 * hardware info/state
 	 */
+       unsigned long           bitflags;       /* various single-bit flags */
+#define HC_FLAG_IRQ_ON         0
+#define HC_FLAG_SUSPEND_RH     1
+
 	const struct hc_driver	*driver;	/* hw-specific hooks */
 	unsigned		saw_irq : 1;
 	unsigned		can_wakeup:1;	/* hw supports wakeup? */
Index: linux-2.6.14-benh/drivers/usb/host/ehci-hub.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ehci-hub.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ehci-hub.c	2005-11-05 13:12:39.000000000 +1100
@@ -90,8 +90,12 @@
 	int			i;
 	int			intr_enable;
 
+	if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
+		return -ESHUTDOWN;
+
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep(5);
+
 	spin_lock_irq (&ehci->lock);
 
 	/* re-init operational registers in case we lost power */
@@ -215,7 +219,8 @@
 	unsigned long	flags;
 
 	/* if !USB_SUSPEND, root hub timers won't get shut down ... */
-	if (!HC_IS_RUNNING(hcd->state))
+	if (!HC_IS_RUNNING(hcd->state) ||
+	    test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
 		return 0;
 
 	/* init status to no-changes */
@@ -313,6 +318,8 @@
 	unsigned long	flags;
 	int		retval = 0;
 
+	if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
+		return -ESHUTDOWN;
 	/*
 	 * FIXME:  support SetPortFeatures USB_PORT_FEAT_INDICATOR.
 	 * HCS_INDICATOR may say we can change LEDs to off/amber/green.
Index: linux-2.6.14-benh/drivers/usb/host/uhci-hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/uhci-hcd.c	2005-10-31 10:54:44.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/uhci-hcd.c	2005-11-06 08:35:39.000000000 +1100
@@ -770,6 +770,12 @@
 
 	dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__);
 
+	/* Disable emission of interrupts during suspend */
+	pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(dev->irq);
+
 	spin_lock_irq(&uhci->lock);
 	if (uhci->hc_inaccessible)	/* Dead or already suspended */
 		goto done;
@@ -787,7 +793,8 @@
 	};
 
 	/* All PCI host controllers are required to disable IRQ generation
-	 * at the source, so we must turn off PIRQ.
+	 * at the source, so we must turn off PIRQ. Already done earlier
+	 * but better be safe than sorry...
 	 */
 	pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
 	uhci->hc_inaccessible = 1;

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-05 22:17   ` Benjamin Herrenschmidt
@ 2005-11-06 10:54     ` Bin Zhang
  2005-11-11 21:47     ` Eddy Petrisor
  1 sibling, 0 replies; 28+ messages in thread
From: Bin Zhang @ 2005-11-06 10:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On 11/5/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Sat, 2005-11-05 at 22:58 +0100, Bin Zhang wrote:
> > On 11/3/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > > For those who experience crashes on sleep and/or wakeup (typically du=
e
> > > to USB) with 2.6.14, I made a test patch that might help. Please let =
me
> > > know if it makes things more reliable.
> > >
> > I've tried your patch with usb wifi dlink dwl-g122 (my eth1). It works.
> > There are some differences in /var/log/syslog :
>
> I have another patch tho:
>

The new patch works for me.
With or without the new patch, now I get almost the same syslogs.

Thanks,
Bin


> Index: linux-2.6.14-benh/drivers/usb/core/hcd-pci.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/core/hcd-pci.c   2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/core/hcd-pci.c        2005-11-05 11:58:=
55.000000000 +1100
> @@ -32,6 +32,13 @@
>  #include <linux/usb.h>
>  #include "hcd.h"
>
> +#ifdef CONFIG_PPC_PMAC
> +#include <asm/machdep.h>
> +#include <asm/pmac_feature.h>
> +#include <asm/pci-bridge.h>
> +#include <asm/prom.h>
> +#endif
> +
>
>  /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
>
> @@ -278,6 +285,18 @@
>                 break;
>         }
>
> +#ifdef CONFIG_PPC_PMAC
> +       if (retval =3D=3D 0 && _machine =3D=3D _MACH_Pmac) {
> +               struct device_node      *of_node;
> +
> +               /* Disable USB PAD & cell clock */
> +               of_node =3D pci_device_to_OF_node (to_pci_dev(hcd->self.
> +                                                           controller));
> +               if (of_node)
> +                       pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0=
, 0);
> +       }
> +#endif /* CONFIG_PPC_PMAC */
> +
>         /* update power_state **ONLY** to make sysfs happier */
>         if (retval =3D=3D 0)
>                 dev->dev.power.power_state =3D message;
> @@ -303,6 +322,18 @@
>                 return 0;
>         }
>
> +#ifdef CONFIG_PPC_PMAC
> +       if (_machine =3D=3D _MACH_Pmac) {
> +               struct device_node *of_node;
> +
> +               /* Re-enable USB PAD & cell clock */
> +               of_node =3D pci_device_to_OF_node (to_pci_dev(hcd->self.
> +                                                           controller));
> +               if (of_node)
> +                       pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0=
, 1);
> +       }
> +#endif /* CONFIG_PPC_PMAC */
> +
>         /* 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.
> @@ -381,7 +412,6 @@
>                 usb_hc_died (hcd);
>         }
>
> -       retval =3D pci_enable_device(dev);
>         return retval;
>  }
>  EXPORT_SYMBOL (usb_hcd_pci_resume);
> Index: linux-2.6.14-benh/drivers/usb/host/ehci-hcd.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/ehci-hcd.c  2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/ehci-hcd.c       2005-11-06 08:26:=
42.000000000 +1100
> @@ -750,6 +750,15 @@
>         if (time_before (jiffies, ehci->next_statechange))
>                 msleep (100);
>
> +       /* Disable emission of interrupts during suspend */
> +       writel(0, &ehci->regs->intr_enable);
> +       mb();
> +       clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
> +       synchronize_irq(dev->irq);
> +
> +       /* Tell root hub not to bother trying to resume */
> +       set_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
> +
>  #ifdef CONFIG_USB_SUSPEND
>         (void) usb_suspend_device (hcd->self.root_hub, message);
>  #else
> @@ -776,6 +785,9 @@
>         if (time_before (jiffies, ehci->next_statechange))
>                 msleep (100);
>
> +       clear_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
> +       set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
> +
>         /* If any port is suspended (or owned by the companion),
>          * we know we can/must resume the HC (and mustn't reset it).
>          */
> Index: linux-2.6.14-benh/drivers/usb/host/ehci-q.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/ehci-q.c    2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/ehci-q.c 2005-11-03 17:03:27.00000=
0000 +1100
> @@ -926,6 +926,11 @@
>  #endif
>
>         spin_lock_irqsave (&ehci->lock, flags);
> +       if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
> +               spin_unlock_irqrestore (&ehci->lock, flags);
> +               return -ESHUTDOWN;
> +       }
> +
>         qh =3D qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv);
>
>         /* Control/bulk operations through TTs don't need scheduling,
> Index: linux-2.6.14-benh/drivers/usb/host/ehci-sched.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/ehci-sched.c        2005-10-3=
1 10:54:44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/ehci-sched.c     2005-11-03 17:05:=
54.000000000 +1100
> @@ -602,6 +602,11 @@
>
>         spin_lock_irqsave (&ehci->lock, flags);
>
> +       if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
> +               spin_unlock_irqrestore (&ehci->lock, flags);
> +               return -ESHUTDOWN;
> +       }
> +
>         /* get qh and force any scheduling errors */
>         INIT_LIST_HEAD (&empty);
>         qh =3D qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv);
> @@ -1456,6 +1461,11 @@
>
>         /* schedule ... need to lock */
>         spin_lock_irqsave (&ehci->lock, flags);
> +       if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
> +               spin_unlock_irqrestore (&ehci->lock, flags);
> +               status =3D -ESHUTDOWN;
> +               goto done;
> +       }
>         status =3D iso_stream_schedule (ehci, urb, stream);
>         if (likely (status =3D=3D 0))
>                 itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream=
);
> @@ -1815,6 +1825,11 @@
>
>         /* schedule ... need to lock */
>         spin_lock_irqsave (&ehci->lock, flags);
> +       if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
> +               spin_unlock_irqrestore (&ehci->lock, flags);
> +               status =3D -ESHUTDOWN;
> +               goto done;
> +       }
>         status =3D iso_stream_schedule (ehci, urb, stream);
>         if (status =3D=3D 0)
>                 sitd_link_urb (ehci, urb, ehci->periodic_size << 3, strea=
m);
> Index: linux-2.6.14-benh/drivers/usb/host/ohci-hcd.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/ohci-hcd.c  2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/ohci-hcd.c       2005-11-06 08:34:=
41.000000000 +1100
> @@ -252,6 +252,10 @@
>
>         spin_lock_irqsave (&ohci->lock, flags);
>
> +       if (HC_IS_SUSPENDED(hcd->state)) {
> +               retval =3D -ESHUTDOWN;
> +               goto fail;
> +       }
>         /* don't submit to a dead HC */
>         if (!HC_IS_RUNNING(hcd->state)) {
>                 retval =3D -ENODEV;
> Index: linux-2.6.14-benh/drivers/usb/host/ohci-hub.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/ohci-hub.c  2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/ohci-hub.c       2005-11-05 13:12:=
24.000000000 +1100
> @@ -139,6 +139,9 @@
>         u32                     temp, enables;
>         int                     status =3D -EINPROGRESS;
>
> +       if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
> +               return -ESHUTDOWN;
> +
>         if (time_before (jiffies, ohci->next_statechange))
>                 msleep(5);
>
> @@ -219,13 +222,6 @@
>         /* Sometimes PCI D3 suspend trashes frame timings ... */
>         periodic_reinit (ohci);
>
> -       /* interrupts might have been disabled */
> -       ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
> -       if (ohci->ed_rm_list)
> -               ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable)=
;
> -       ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
> -                       &ohci->regs->intrstatus);
> -
>         /* Then re-enable operations */
>         ohci_writel (ohci, OHCI_USB_OPER, &ohci->regs->control);
>         (void) ohci_readl (ohci, &ohci->regs->control);
> @@ -241,6 +237,13 @@
>         /* TRSMRCY */
>         msleep (10);
>
> +       /* interrupts might have been disabled */
> +       ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
> +       if (ohci->ed_rm_list)
> +               ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable)=
;
> +       ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
> +                       &ohci->regs->intrstatus);
> +
>         /* keep it alive for ~5x suspend + resume costs */
>         ohci->next_statechange =3D jiffies + msecs_to_jiffies (250);
>
> @@ -308,6 +311,9 @@
>         int             can_suspend =3D hcd->can_wakeup;
>         unsigned long   flags;
>
> +       if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
> +               return 0;
> +
>         spin_lock_irqsave (&ohci->lock, flags);
>
>         /* handle autosuspended root:  finish resuming before
> @@ -441,6 +447,9 @@
>                 return -EINVAL;
>         port--;
>
> +       if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
> +               return -ESHUTDOWN;
> +
>         /* start port reset before HNP protocol times out */
>         status =3D ohci_readl(ohci, &ohci->regs->roothub.portstatus [port=
]);
>         if (!(status & RH_PS_CCS))
> @@ -526,6 +535,9 @@
>         u32             temp;
>         int             retval =3D 0;
>
> +       if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
> +               return -ESHUTDOWN;
> +
>         switch (typeReq) {
>         case ClearHubFeature:
>                 switch (wValue) {
> Index: linux-2.6.14-benh/drivers/usb/host/ohci-pci.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/ohci-pci.c  2005-10-31 10:52:=
24.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/ohci-pci.c       2005-11-05 12:46:=
53.000000000 +1100
> @@ -14,13 +14,6 @@
>   * This file is licenced under the GPL.
>   */
>
> -#ifdef CONFIG_PPC_PMAC
> -#include <asm/machdep.h>
> -#include <asm/pmac_feature.h>
> -#include <asm/pci-bridge.h>
> -#include <asm/prom.h>
> -#endif
> -
>  #ifndef CONFIG_PCI
>  #error "This file is PCI bus glue.  CONFIG_PCI must be defined."
>  #endif
> @@ -118,6 +111,15 @@
>         if (time_before (jiffies, ohci->next_statechange))
>                 msleep (100);
>
> +       /* Disable emission of interrupts during suspend */
> +       ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
> +       mb();
> +       clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
> +       synchronize_irq(dev->irq);
> +
> +       /* Tell root hub not to bother trying to resume */
> +       set_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
> +
>  #ifdef CONFIG_USB_SUSPEND
>         (void) usb_suspend_device (hcd->self.root_hub, message);
>  #else
> @@ -129,16 +131,6 @@
>         /* let things settle down a bit */
>         msleep (100);
>
> -#ifdef CONFIG_PPC_PMAC
> -       if (_machine =3D=3D _MACH_Pmac) {
> -               struct device_node      *of_node;
> -
> -               /* Disable USB PAD & cell clock */
> -               of_node =3D pci_device_to_OF_node (to_pci_dev(hcd->self.c=
ontroller));
> -               if (of_node)
> -                       pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0=
, 0);
> -       }
> -#endif /* CONFIG_PPC_PMAC */
>         return 0;
>  }
>
> @@ -148,20 +140,13 @@
>         struct ohci_hcd         *ohci =3D hcd_to_ohci (hcd);
>         int                     retval =3D 0;
>
> -#ifdef CONFIG_PPC_PMAC
> -       if (_machine =3D=3D _MACH_Pmac) {
> -               struct device_node *of_node;
> -
> -               /* Re-enable USB PAD & cell clock */
> -               of_node =3D pci_device_to_OF_node (to_pci_dev(hcd->self.c=
ontroller));
> -               if (of_node)
> -                       pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, =
0, 1);
> -       }
> -#endif /* CONFIG_PPC_PMAC */
> -
>         /* resume root hub */
>         if (time_before (jiffies, ohci->next_statechange))
>                 msleep (100);
> +
> +       clear_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags);
> +       set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
> +
>  #ifdef CONFIG_USB_SUSPEND
>         /* get extra cleanup even if remote wakeup isn't in use */
>         retval =3D usb_resume_device (hcd->self.root_hub);
> Index: linux-2.6.14-benh/drivers/usb/core/hcd.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/core/hcd.c       2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/core/hcd.c    2005-11-05 11:56:48.00000=
0000 +1100
> @@ -1600,7 +1600,8 @@
>         struct usb_hcd          *hcd =3D __hcd;
>         int                     start =3D hcd->state;
>
> -       if (start =3D=3D HC_STATE_HALT)
> +       if (start =3D=3D HC_STATE_HALT ||
> +           !test_bit(HC_FLAG_IRQ_ON, &hcd->bitflags))
>                 return IRQ_NONE;
>         if (hcd->driver->irq (hcd, r) =3D=3D IRQ_NONE)
>                 return IRQ_NONE;
> @@ -1736,6 +1737,9 @@
>         if (hcd->driver->irq) {
>                 char    buf[8], *bufp =3D buf;
>
> +               set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
> +               wmb();
> +
>  #ifdef __sparc__
>                 bufp =3D __irq_itoa(irqnum);
>  #else
> Index: linux-2.6.14-benh/drivers/usb/core/hcd.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/core/hcd.h       2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/core/hcd.h    2005-11-05 12:19:11.00000=
0000 +1100
> @@ -71,6 +71,10 @@
>         /*
>          * hardware info/state
>          */
> +       unsigned long           bitflags;       /* various single-bit fla=
gs */
> +#define HC_FLAG_IRQ_ON         0
> +#define HC_FLAG_SUSPEND_RH     1
> +
>         const struct hc_driver  *driver;        /* hw-specific hooks */
>         unsigned                saw_irq : 1;
>         unsigned                can_wakeup:1;   /* hw supports wakeup? */
> Index: linux-2.6.14-benh/drivers/usb/host/ehci-hub.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/ehci-hub.c  2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/ehci-hub.c       2005-11-05 13:12:=
39.000000000 +1100
> @@ -90,8 +90,12 @@
>         int                     i;
>         int                     intr_enable;
>
> +       if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
> +               return -ESHUTDOWN;
> +
>         if (time_before (jiffies, ehci->next_statechange))
>                 msleep(5);
> +
>         spin_lock_irq (&ehci->lock);
>
>         /* re-init operational registers in case we lost power */
> @@ -215,7 +219,8 @@
>         unsigned long   flags;
>
>         /* if !USB_SUSPEND, root hub timers won't get shut down ... */
> -       if (!HC_IS_RUNNING(hcd->state))
> +       if (!HC_IS_RUNNING(hcd->state) ||
> +           test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
>                 return 0;
>
>         /* init status to no-changes */
> @@ -313,6 +318,8 @@
>         unsigned long   flags;
>         int             retval =3D 0;
>
> +       if (test_bit(HC_FLAG_SUSPEND_RH, &hcd->bitflags))
> +               return -ESHUTDOWN;
>         /*
>          * FIXME:  support SetPortFeatures USB_PORT_FEAT_INDICATOR.
>          * HCS_INDICATOR may say we can change LEDs to off/amber/green.
> Index: linux-2.6.14-benh/drivers/usb/host/uhci-hcd.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.14-benh.orig/drivers/usb/host/uhci-hcd.c  2005-10-31 10:54:=
44.000000000 +1100
> +++ linux-2.6.14-benh/drivers/usb/host/uhci-hcd.c       2005-11-06 08:35:=
39.000000000 +1100
> @@ -770,6 +770,12 @@
>
>         dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__);
>
> +       /* Disable emission of interrupts during suspend */
> +       pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
> +       mb();
> +       clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
> +       synchronize_irq(dev->irq);
> +
>         spin_lock_irq(&uhci->lock);
>         if (uhci->hc_inaccessible)      /* Dead or already suspended */
>                 goto done;
> @@ -787,7 +793,8 @@
>         };
>
>         /* All PCI host controllers are required to disable IRQ generatio=
n
> -        * at the source, so we must turn off PIRQ.
> +        * at the source, so we must turn off PIRQ. Already done earlier
> +        * but better be safe than sorry...
>          */
>         pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
>         uhci->hc_inaccessible =3D 1;
>
>
>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-03  6:33 2.6.14 USB vs. sleep issues Benjamin Herrenschmidt
  2005-11-03  9:03 ` Eddy Petrişor
  2005-11-05 21:58 ` Bin Zhang
@ 2005-11-07  9:13 ` Charles-Edouard Ruault
  2005-11-07 14:54   ` Wolfram Quester
  2005-11-07 21:00   ` Benjamin Herrenschmidt
  2005-11-11  0:24 ` Wolfgang Pfeiffer
  2005-11-16 18:09 ` Wolfgang Pfeiffer
  4 siblings, 2 replies; 28+ messages in thread
From: Charles-Edouard Ruault @ 2005-11-07  9:13 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

Benjamin Herrenschmidt wrote:

>For those who experience crashes on sleep and/or wakeup (typically due
>to USB) with 2.6.14, I made a test patch that might help. Please let me
>know if it makes things more reliable.
>
>http://gate.crashing.org/~benh/fix-ohci-sleep.diff
>
>Note that the patch is totally untested here so it may be just plain
>bogus :)
>
>Ben.
>
>
>
>  
>
Hi Ben,
i've applied your patch and it seems that when i put my powerbook to
sleep ( by closing the lid ) the kernel just crashes since everytime i
come back, the machine is turned off. I had a look at the logs and i see
that i'm having a reboot almost immediateley after the lid is closed.
However i've got no trace of a kernel panic .....
my conf:

Linux kaluha 2.6.14 #1 PREEMPT Mon Oct 31 10:28:22 CET 2005 ppc GNU/Linux
processor       : 0
cpu             : 7447/7457, altivec supported
clock           : 612MHz
revision        : 0.1 (pvr 8002 0101)
bogomips        : 406.52
machine         : PowerBook5,2
motherboard     : PowerBook5,2 MacRISC3 Power Macintosh
detected as     : 287 (PowerBook G4 15")
pmac flags      : 0000001b
L2 cache        : 512K unified
memory          : 768MB
pmac-generation : NewWorld

I have a usb mouse that i unplug before closing the lid.
Anything else that can be usefull ?
Thanks for your time.
Regards.


-- 
Charles-Edouard Ruault

+33 1 55 34 76 65
ce@idtect.com

Idtect SA
37 Bd des Capucines 
75002 Paris, France
www.idtect.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-07  9:13 ` Charles-Edouard Ruault
@ 2005-11-07 14:54   ` Wolfram Quester
  2005-11-07 21:00   ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 28+ messages in thread
From: Wolfram Quester @ 2005-11-07 14:54 UTC (permalink / raw)
  To: Charles-Edouard Ruault; +Cc: debian-powerpc, linuxppc-dev list

[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]

Hi Charles-Edouard,

On Mon, Nov 07, 2005 at 10:13:02AM +0100, Charles-Edouard Ruault wrote:
[...snip...]
> Hi Ben,
> i've applied your patch and it seems that when i put my powerbook to
> sleep ( by closing the lid ) the kernel just crashes since everytime i
> come back, the machine is turned off. I had a look at the logs and i see
> that i'm having a reboot almost immediateley after the lid is closed.
> However i've got no trace of a kernel panic .....
> my conf:
> 
> Linux kaluha 2.6.14 #1 PREEMPT Mon Oct 31 10:28:22 CET 2005 ppc GNU/Linux
> processor       : 0
> cpu             : 7447/7457, altivec supported
> clock           : 612MHz
> revision        : 0.1 (pvr 8002 0101)
> bogomips        : 406.52
> machine         : PowerBook5,2
> motherboard     : PowerBook5,2 MacRISC3 Power Macintosh
> detected as     : 287 (PowerBook G4 15")
> pmac flags      : 0000001b
> L2 cache        : 512K unified
> memory          : 768MB
> pmac-generation : NewWorld
> 
> I have a usb mouse that i unplug before closing the lid.
> Anything else that can be usefull ?
> Thanks for your time.
> Regards.

In a recent email to this list, Benjamin Herrenschmidt wrote:
> > >
> > > I would say your first mistake is to use PREEMPT :) There are
> > > various
> > > issues with PREEMPT on ppc32 that have not really been addressed so
> > > far,
> > > and the USB code has some "holes" that I wouldn't trust in a PREEMPT
> > > environment.
> > >
> >
> > What do you mean exactly? Should CONFIG_PREEMPT not be used?
> > And what about CONFIG_PREEMPT_VOLUNTARY?
> 
> I would avoid both for now.
> 
> Ben.

If I interpret your version string correctly, you also havre preemption
enabled. Please try without and report back success and/or problems.

With best regards,

Wolfi


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-07  9:13 ` Charles-Edouard Ruault
  2005-11-07 14:54   ` Wolfram Quester
@ 2005-11-07 21:00   ` Benjamin Herrenschmidt
  2005-11-10  1:12     ` Eddy Petrişor
  1 sibling, 1 reply; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-07 21:00 UTC (permalink / raw)
  To: Charles-Edouard Ruault; +Cc: linuxppc-dev list, debian-powerpc


> i've applied your patch and it seems that when i put my powerbook to
> sleep ( by closing the lid ) the kernel just crashes since everytime i
> come back, the machine is turned off. I had a look at the logs and i see
> that i'm having a reboot almost immediateley after the lid is closed.
> However i've got no trace of a kernel panic .....
> my conf:

What about this patch ?

Index: linux-2.6.14-benh/drivers/usb/core/hcd-pci.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/core/hcd-pci.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/core/hcd-pci.c	2005-11-07 17:14:47.000000000 +1100
@@ -32,6 +32,13 @@
 #include <linux/usb.h>
 #include "hcd.h"
 
+#ifdef CONFIG_PPC_PMAC
+#include <asm/machdep.h>
+#include <asm/pmac_feature.h>
+#include <asm/pci-bridge.h>
+#include <asm/prom.h>
+#endif
+
 
 /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
 
@@ -278,6 +285,18 @@
 		break;
 	}
 
+#ifdef CONFIG_PPC_PMAC
+	if (retval == 0 && _machine == _MACH_Pmac) {
+	   	struct device_node	*of_node;
+
+		/* Disable USB PAD & cell clock */
+		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.
+							    controller));
+		if (of_node)
+			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
+	}
+#endif /* CONFIG_PPC_PMAC */
+
 	/* update power_state **ONLY** to make sysfs happier */
 	if (retval == 0)
 		dev->dev.power.power_state = message;
@@ -303,6 +322,18 @@
 		return 0;
 	}
 
+#ifdef CONFIG_PPC_PMAC
+	if (_machine == _MACH_Pmac) {
+		struct device_node *of_node;
+
+		/* Re-enable USB PAD & cell clock */
+		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.
+							    controller));
+		if (of_node)
+			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 1);
+	}
+#endif /* CONFIG_PPC_PMAC */
+
 	/* 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.
Index: linux-2.6.14-benh/drivers/usb/core/hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/core/hcd.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/core/hcd.c	2005-11-07 17:14:10.000000000 +1100
@@ -1600,7 +1600,8 @@
 	struct usb_hcd		*hcd = __hcd;
 	int			start = hcd->state;
 
-	if (start == HC_STATE_HALT)
+	if (start == HC_STATE_HALT ||
+	    !test_bit(HC_FLAG_IRQ_ON, &hcd->bitflags))
 		return IRQ_NONE;
 	if (hcd->driver->irq (hcd, r) == IRQ_NONE)
 		return IRQ_NONE;
@@ -1736,6 +1737,9 @@
 	if (hcd->driver->irq) {
 		char	buf[8], *bufp = buf;
 
+		set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+		mb();
+
 #ifdef __sparc__
 		bufp = __irq_itoa(irqnum);
 #else
Index: linux-2.6.14-benh/drivers/usb/core/hcd.h
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/core/hcd.h	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/core/hcd.h	2005-11-07 17:13:22.000000000 +1100
@@ -71,6 +71,9 @@
 	/*
 	 * hardware info/state
 	 */
+       unsigned long           bitflags;       /* various single-bit flags */
+#define HC_FLAG_IRQ_ON         0
+
 	const struct hc_driver	*driver;	/* hw-specific hooks */
 	unsigned		saw_irq : 1;
 	unsigned		can_wakeup:1;	/* hw supports wakeup? */
Index: linux-2.6.14-benh/drivers/usb/host/ehci-hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ehci-hcd.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ehci-hcd.c	2005-11-07 17:49:24.000000000 +1100
@@ -750,6 +750,12 @@
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep (100);
 
+	/* Disable emission of interrupts during suspend */
+	writel(0, &ehci->regs->intr_enable);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(to_pci_dev(hcd->self.controller)->irq);
+
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub, message);
 #else
@@ -776,6 +782,8 @@
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep (100);
 
+	set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+
 	/* If any port is suspended (or owned by the companion),
 	 * we know we can/must resume the HC (and mustn't reset it).
 	 */
Index: linux-2.6.14-benh/drivers/usb/host/ehci-q.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ehci-q.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ehci-q.c	2005-11-07 17:15:55.000000000 +1100
@@ -926,6 +926,11 @@
 #endif
 
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		return -ESHUTDOWN;
+	}
+
 	qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv);
 
 	/* Control/bulk operations through TTs don't need scheduling,
Index: linux-2.6.14-benh/drivers/usb/host/ehci-sched.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ehci-sched.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ehci-sched.c	2005-11-07 17:16:39.000000000 +1100
@@ -602,6 +602,11 @@
 
 	spin_lock_irqsave (&ehci->lock, flags);
 
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		return -ESHUTDOWN;
+	}
+
 	/* get qh and force any scheduling errors */
 	INIT_LIST_HEAD (&empty);
 	qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv);
@@ -1456,6 +1461,11 @@
 
 	/* schedule ... need to lock */
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		status = -ESHUTDOWN;
+		goto done;
+	}
 	status = iso_stream_schedule (ehci, urb, stream);
  	if (likely (status == 0))
 		itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
@@ -1815,6 +1825,11 @@
 
 	/* schedule ... need to lock */
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		status = -ESHUTDOWN;
+		goto done;
+	}
 	status = iso_stream_schedule (ehci, urb, stream);
  	if (status == 0)
 		sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
Index: linux-2.6.14-benh/drivers/usb/host/ohci-hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ohci-hcd.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ohci-hcd.c	2005-11-07 17:17:04.000000000 +1100
@@ -252,6 +252,10 @@
 
 	spin_lock_irqsave (&ohci->lock, flags);
 
+	if (HC_IS_SUSPENDED(hcd->state)) {
+		retval = -ESHUTDOWN;
+		goto fail;
+	}
 	/* don't submit to a dead HC */
 	if (!HC_IS_RUNNING(hcd->state)) {
 		retval = -ENODEV;
Index: linux-2.6.14-benh/drivers/usb/host/ohci-hub.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ohci-hub.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ohci-hub.c	2005-11-07 17:18:00.000000000 +1100
@@ -219,13 +219,6 @@
 	/* Sometimes PCI D3 suspend trashes frame timings ... */
 	periodic_reinit (ohci);
 
-	/* interrupts might have been disabled */
-	ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
-	if (ohci->ed_rm_list)
-		ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
-	ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
-			&ohci->regs->intrstatus);
-
 	/* Then re-enable operations */
 	ohci_writel (ohci, OHCI_USB_OPER, &ohci->regs->control);
 	(void) ohci_readl (ohci, &ohci->regs->control);
@@ -241,6 +234,13 @@
 	/* TRSMRCY */
 	msleep (10);
 
+	/* interrupts might have been disabled */
+	ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
+	if (ohci->ed_rm_list)
+		ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
+	ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
+			&ohci->regs->intrstatus);
+
 	/* keep it alive for ~5x suspend + resume costs */
 	ohci->next_statechange = jiffies + msecs_to_jiffies (250);
 
Index: linux-2.6.14-benh/drivers/usb/host/ohci-pci.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/ohci-pci.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/ohci-pci.c	2005-11-07 17:49:26.000000000 +1100
@@ -14,13 +14,6 @@
  * This file is licenced under the GPL.
  */
  
-#ifdef CONFIG_PPC_PMAC
-#include <asm/machdep.h>
-#include <asm/pmac_feature.h>
-#include <asm/pci-bridge.h>
-#include <asm/prom.h>
-#endif
-
 #ifndef CONFIG_PCI
 #error "This file is PCI bus glue.  CONFIG_PCI must be defined."
 #endif
@@ -118,6 +111,12 @@
 	if (time_before (jiffies, ohci->next_statechange))
 		msleep (100);
 
+	/* Disable emission of interrupts during suspend */
+	ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(to_pci_dev(hcd->self.controller)->irq);
+
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub, message);
 #else
@@ -129,16 +128,6 @@
 	/* let things settle down a bit */
 	msleep (100);
 	
-#ifdef CONFIG_PPC_PMAC
-	if (_machine == _MACH_Pmac) {
-	   	struct device_node	*of_node;
- 
-		/* Disable USB PAD & cell clock */
-		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
-		if (of_node)
-			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
-	}
-#endif /* CONFIG_PPC_PMAC */
 	return 0;
 }
 
@@ -148,20 +137,11 @@
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
 	int			retval = 0;
 
-#ifdef CONFIG_PPC_PMAC
-	if (_machine == _MACH_Pmac) {
-		struct device_node *of_node;
-
-		/* Re-enable USB PAD & cell clock */
-		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
-		if (of_node)
-			pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
-	}
-#endif /* CONFIG_PPC_PMAC */
-
 	/* resume root hub */
 	if (time_before (jiffies, ohci->next_statechange))
 		msleep (100);
+	set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+
 #ifdef	CONFIG_USB_SUSPEND
 	/* get extra cleanup even if remote wakeup isn't in use */
 	retval = usb_resume_device (hcd->self.root_hub);
Index: linux-2.6.14-benh/drivers/usb/host/uhci-hcd.c
===================================================================
--- linux-2.6.14-benh.orig/drivers/usb/host/uhci-hcd.c	2005-11-07 15:11:16.000000000 +1100
+++ linux-2.6.14-benh/drivers/usb/host/uhci-hcd.c	2005-11-07 17:18:55.000000000 +1100
@@ -770,6 +770,12 @@
 
 	dev_dbg(uhci_dev(uhci), "%s\n", __FUNCTION__);
 
+	/* Disable emission of interrupts during suspend */
+	pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(to_pci_dev(uhci_dev(uhci))->irq);
+
 	spin_lock_irq(&uhci->lock);
 	if (uhci->hc_inaccessible)	/* Dead or already suspended */
 		goto done;
@@ -782,12 +788,14 @@
 	if (uhci->rh_state > UHCI_RH_SUSPENDED) {
 		dev_warn(uhci_dev(uhci), "Root hub isn't suspended!\n");
 		hcd->state = HC_STATE_RUNNING;
+		set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
 		rc = -EBUSY;
 		goto done;
 	};
 
 	/* All PCI host controllers are required to disable IRQ generation
-	 * at the source, so we must turn off PIRQ.
+	 * at the source, so we must turn off PIRQ. Already done earlier
+	 * but better be safe than sorry...
 	 */
 	pci_write_config_word(to_pci_dev(uhci_dev(uhci)), USBLEGSUP, 0);
 	uhci->hc_inaccessible = 1;

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-07 21:00   ` Benjamin Herrenschmidt
@ 2005-11-10  1:12     ` Eddy Petrişor
  2005-11-10  1:51       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 28+ messages in thread
From: Eddy Petrişor @ 2005-11-10  1:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On 11/7/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> > i've applied your patch and it seems that when i put my powerbook to
> > sleep ( by closing the lid ) the kernel just crashes since everytime i
> > come back, the machine is turned off. I had a look at the logs and i se=
e
> > that i'm having a reboot almost immediateley after the lid is closed.
> > However i've got no trace of a kernel panic .....
> > my conf:
>
> What about this patch ?

I tried to apply this patch and the previous one over 2.6.14, but they fail=
ed.
I also tied to apply the second patch over the first, also the third
over the first, but I had the same result.

Over which version should these pacthes be applied?

--
Regards,
EddyP
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
"Imagination is more important than knowledge" A.Einstein

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-10  1:12     ` Eddy Petrişor
@ 2005-11-10  1:51       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-10  1:51 UTC (permalink / raw)
  To: Eddy Petrişor; +Cc: linuxppc-dev list, debian-powerpc

On Thu, 2005-11-10 at 03:12 +0200, Eddy Petrişor wrote:
> On 11/7/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> >
> > > i've applied your patch and it seems that when i put my powerbook to
> > > sleep ( by closing the lid ) the kernel just crashes since everytime i
> > > come back, the machine is turned off. I had a look at the logs and i see
> > > that i'm having a reboot almost immediateley after the lid is closed.
> > > However i've got no trace of a kernel panic .....
> > > my conf:
> >
> > What about this patch ?
> 
> I tried to apply this patch and the previous one over 2.6.14, but they failed.
> I also tied to apply the second patch over the first, also the third
> over the first, but I had the same result.
> 
> Over which version should these pacthes be applied?

2.6.14 :) (But not some git checkout from after 2.6.14 release)

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-03  6:33 2.6.14 USB vs. sleep issues Benjamin Herrenschmidt
                   ` (2 preceding siblings ...)
  2005-11-07  9:13 ` Charles-Edouard Ruault
@ 2005-11-11  0:24 ` Wolfgang Pfeiffer
  2005-11-16 18:09 ` Wolfgang Pfeiffer
  4 siblings, 0 replies; 28+ messages in thread
From: Wolfgang Pfeiffer @ 2005-11-11  0:24 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

Hi Ben

Thanks for your work, for the patches: on a Titanium IV a kernel-org
based, self-made (via "make-kpkg") 2.6.14.1 patched kernel works. USB
seems being fine here: I put the machine to sleep with a camera and a
Logitech mouse plugged in to USB connectors: After resuming the system
from sleep the mouse is still working, and the camera is usable and
fine. I'm running pbbuttons here.

It seems I have problems because of a - I still can't believe that -
missing pcmciautils package on Debian. But that's unrelated to what
we're discussing here, I believe. I'll start another thread perhaps for
this latter issue ...

On Thu, Nov 03, 2005 at 05:33:39PM +1100, Benjamin Herrenschmidt wrote:
> For those who experience crashes on sleep and/or wakeup (typically due
> to USB) with 2.6.14, I made a test patch that might help. Please let me
> know if it makes things more reliable.
> 
> http://gate.crashing.org/~benh/fix-ohci-sleep.diff

                         [ ... ]


I didn't use the one above, but just the one you posted here Nov.8
(this thread), IINM:

$ patch -p1 < /home/shorty/downloads/ben-patches/benh.nov.8.sleep.diff
patching file drivers/usb/core/hcd-pci.c
patching file drivers/usb/core/hcd.c
patching file drivers/usb/core/hcd.h
patching file drivers/usb/host/ehci-hcd.c
patching file drivers/usb/host/ehci-q.c
patching file drivers/usb/host/ehci-sched.c
patching file drivers/usb/host/ohci-hcd.c
patching file drivers/usb/host/ohci-hub.c
patching file drivers/usb/host/ohci-pci.c
patching file drivers/usb/host/uhci-hcd.c


Following that, provided my .bash_history is well organised enough to
be trusted ( ... :) I applied the 2.6.14.1 patch
("patch-2.6.14.1.bz2")

So: As to sleep/USB: Everything seems being fine here on 2.6.14.1.

FYI:
Kismet still does not seem work for hermes/orinoco on 2.6.14.1.

Thanks again for the patches, Ben.

Best Regards
Wolfgang

-- 
Wolfgang Pfeiffer
http://profiles.yahoo.com/wolfgangpfeiffer

Key ID: E3037113
Key fingerprint = A8CA 9D8C 54C4 4CC1 0B26  AA3C 9108 FB42 E303 7113

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-05 22:17   ` Benjamin Herrenschmidt
  2005-11-06 10:54     ` Bin Zhang
@ 2005-11-11 21:47     ` Eddy Petrisor
  2005-11-11 21:52       ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 28+ messages in thread
From: Eddy Petrisor @ 2005-11-11 21:47 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=x-user-defined; format=flowed, Size: 1075 bytes --]



Benjamin Herrenschmidt wrote:
> On Sat, 2005-11-05 at 22:58 +0100, Bin Zhang wrote:
> 
>>On 11/3/05, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>>
>>>For those who experience crashes on sleep and/or wakeup (typically due
>>>to USB) with 2.6.14, I made a test patch that might help. Please let me
>>>know if it makes things more reliable.
>>>
>>
>>I've tried your patch with usb wifi dlink dwl-g122 (my eth1). It works.
>>There are some differences in /var/log/syslog :
> 
> 
> I have another patch tho:

With this patch the kernel panics on my PowerBook 5,2

I made a few pictures with my phone and I can put them smewhere, if needed.

I will try tonight the third patch you proposed and the kernel is 
compiling now...


BTW, is there any difference between the resulted .ko files when made with:

make SUBDIRS=drivers/usb/core

make SUBDIRS=drivers/usb/core modules

and what the make command ran from the root of the kernel source?

-- 
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-11 21:47     ` Eddy Petrisor
@ 2005-11-11 21:52       ` Benjamin Herrenschmidt
  2005-11-12  8:53         ` Eddy Petrisor
                           ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-11 21:52 UTC (permalink / raw)
  To: Eddy Petrisor; +Cc: linuxppc-dev list, debian-powerpc

The latest patch that is candidate for upstream is:

Index: 2.6.14-ben/drivers/usb/core/hcd-pci.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/core/hcd-pci.c
+++ 2.6.14-ben/drivers/usb/core/hcd-pci.c
@@ -32,6 +32,13 @@
 #include <linux/usb.h>
 #include "hcd.h"
 
+#ifdef CONFIG_PPC_PMAC
+#include <asm/machdep.h>
+#include <asm/pmac_feature.h>
+#include <asm/pci-bridge.h>
+#include <asm/prom.h>
+#endif
+
 
 /* PCI-based HCs are common, but plenty of non-PCI HCs are used too */
 
@@ -278,6 +285,18 @@ int usb_hcd_pci_suspend (struct pci_dev 
 		break;
 	}
 
+#ifdef CONFIG_PPC_PMAC
+	if (retval == 0 && _machine == _MACH_Pmac) {
+	   	struct device_node	*of_node;
+
+		/* Disable USB PAD & cell clock */
+		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.
+							    controller));
+		if (of_node)
+			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
+	}
+#endif /* CONFIG_PPC_PMAC */
+
 	/* update power_state **ONLY** to make sysfs happier */
 	if (retval == 0)
 		dev->dev.power.power_state = message;
@@ -303,6 +322,18 @@ int usb_hcd_pci_resume (struct pci_dev *
 		return 0;
 	}
 
+#ifdef CONFIG_PPC_PMAC
+	if (_machine == _MACH_Pmac) {
+		struct device_node *of_node;
+
+		/* Re-enable USB PAD & cell clock */
+		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.
+							    controller));
+		if (of_node)
+			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 1);
+	}
+#endif /* CONFIG_PPC_PMAC */
+
 	/* 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.
Index: 2.6.14-ben/drivers/usb/core/hcd.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/core/hcd.c
+++ 2.6.14-ben/drivers/usb/core/hcd.c
@@ -1600,7 +1600,8 @@ irqreturn_t usb_hcd_irq (int irq, void *
 	struct usb_hcd		*hcd = __hcd;
 	int			start = hcd->state;
 
-	if (start == HC_STATE_HALT)
+	if (start == HC_STATE_HALT ||
+	    !test_bit(HC_FLAG_IRQ_ON, &hcd->bitflags))
 		return IRQ_NONE;
 	if (hcd->driver->irq (hcd, r) == IRQ_NONE)
 		return IRQ_NONE;
@@ -1736,6 +1737,9 @@ int usb_add_hcd(struct usb_hcd *hcd,
 	if (hcd->driver->irq) {
 		char	buf[8], *bufp = buf;
 
+		set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+		mb();
+
 #ifdef __sparc__
 		bufp = __irq_itoa(irqnum);
 #else
Index: 2.6.14-ben/drivers/usb/core/hcd.h
===================================================================
--- 2.6.14-ben.orig/drivers/usb/core/hcd.h
+++ 2.6.14-ben/drivers/usb/core/hcd.h
@@ -71,6 +71,9 @@ struct usb_hcd {	/* usb_bus.hcpriv point
 	/*
 	 * hardware info/state
 	 */
+       unsigned long           bitflags;       /* various single-bit flags */
+#define HC_FLAG_IRQ_ON         0
+
 	const struct hc_driver	*driver;	/* hw-specific hooks */
 	unsigned		saw_irq : 1;
 	unsigned		can_wakeup:1;	/* hw supports wakeup? */
Index: 2.6.14-ben/drivers/usb/host/ehci-hcd.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/host/ehci-hcd.c
+++ 2.6.14-ben/drivers/usb/host/ehci-hcd.c
@@ -750,6 +750,12 @@ static int ehci_suspend (struct usb_hcd 
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep (100);
 
+	/* Disable emission of interrupts during suspend */
+	writel(0, &ehci->regs->intr_enable);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(to_pci_dev(hcd->self.controller)->irq);
+
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub, message);
 #else
@@ -776,6 +782,8 @@ static int ehci_resume (struct usb_hcd *
 	if (time_before (jiffies, ehci->next_statechange))
 		msleep (100);
 
+	set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+
 	/* If any port is suspended (or owned by the companion),
 	 * we know we can/must resume the HC (and mustn't reset it).
 	 */
Index: 2.6.14-ben/drivers/usb/host/ehci-q.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/host/ehci-q.c
+++ 2.6.14-ben/drivers/usb/host/ehci-q.c
@@ -926,6 +926,11 @@ submit_async (
 #endif
 
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		return -ESHUTDOWN;
+	}
+
 	qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv);
 
 	/* Control/bulk operations through TTs don't need scheduling,
Index: 2.6.14-ben/drivers/usb/host/ehci-sched.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/host/ehci-sched.c
+++ 2.6.14-ben/drivers/usb/host/ehci-sched.c
@@ -602,6 +602,11 @@ static int intr_submit (
 
 	spin_lock_irqsave (&ehci->lock, flags);
 
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		return -ESHUTDOWN;
+	}
+
 	/* get qh and force any scheduling errors */
 	INIT_LIST_HEAD (&empty);
 	qh = qh_append_tds (ehci, urb, &empty, epnum, &ep->hcpriv);
@@ -1456,6 +1461,11 @@ static int itd_submit (struct ehci_hcd *
 
 	/* schedule ... need to lock */
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		status = -ESHUTDOWN;
+		goto done;
+	}
 	status = iso_stream_schedule (ehci, urb, stream);
  	if (likely (status == 0))
 		itd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
@@ -1815,6 +1825,11 @@ static int sitd_submit (struct ehci_hcd 
 
 	/* schedule ... need to lock */
 	spin_lock_irqsave (&ehci->lock, flags);
+	if (HC_IS_SUSPENDED(ehci_to_hcd(ehci)->state)) {
+		spin_unlock_irqrestore (&ehci->lock, flags);
+		status = -ESHUTDOWN;
+		goto done;
+	}
 	status = iso_stream_schedule (ehci, urb, stream);
  	if (status == 0)
 		sitd_link_urb (ehci, urb, ehci->periodic_size << 3, stream);
Index: 2.6.14-ben/drivers/usb/host/ohci-hcd.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/host/ohci-hcd.c
+++ 2.6.14-ben/drivers/usb/host/ohci-hcd.c
@@ -252,6 +252,10 @@ static int ohci_urb_enqueue (
 
 	spin_lock_irqsave (&ohci->lock, flags);
 
+	if (HC_IS_SUSPENDED(hcd->state)) {
+		retval = -ESHUTDOWN;
+		goto fail;
+	}
 	/* don't submit to a dead HC */
 	if (!HC_IS_RUNNING(hcd->state)) {
 		retval = -ENODEV;
Index: 2.6.14-ben/drivers/usb/host/ohci-hub.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/host/ohci-hub.c
+++ 2.6.14-ben/drivers/usb/host/ohci-hub.c
@@ -219,13 +219,6 @@ static int ohci_hub_resume (struct usb_h
 	/* Sometimes PCI D3 suspend trashes frame timings ... */
 	periodic_reinit (ohci);
 
-	/* interrupts might have been disabled */
-	ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
-	if (ohci->ed_rm_list)
-		ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
-	ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
-			&ohci->regs->intrstatus);
-
 	/* Then re-enable operations */
 	ohci_writel (ohci, OHCI_USB_OPER, &ohci->regs->control);
 	(void) ohci_readl (ohci, &ohci->regs->control);
@@ -241,6 +234,13 @@ static int ohci_hub_resume (struct usb_h
 	/* TRSMRCY */
 	msleep (10);
 
+	/* interrupts might have been disabled */
+	ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
+	if (ohci->ed_rm_list)
+		ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
+	ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
+			&ohci->regs->intrstatus);
+
 	/* keep it alive for ~5x suspend + resume costs */
 	ohci->next_statechange = jiffies + msecs_to_jiffies (250);
 
Index: 2.6.14-ben/drivers/usb/host/ohci-pci.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/host/ohci-pci.c
+++ 2.6.14-ben/drivers/usb/host/ohci-pci.c
@@ -14,13 +14,6 @@
  * This file is licenced under the GPL.
  */
  
-#ifdef CONFIG_PPC_PMAC
-#include <asm/machdep.h>
-#include <asm/pmac_feature.h>
-#include <asm/pci-bridge.h>
-#include <asm/prom.h>
-#endif
-
 #ifndef CONFIG_PCI
 #error "This file is PCI bus glue.  CONFIG_PCI must be defined."
 #endif
@@ -118,6 +111,12 @@ static int ohci_pci_suspend (struct usb_
 	if (time_before (jiffies, ohci->next_statechange))
 		msleep (100);
 
+	/* Disable emission of interrupts during suspend */
+	ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
+	mb();
+	clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	synchronize_irq(to_pci_dev(hcd->self.controller)->irq);
+
 #ifdef	CONFIG_USB_SUSPEND
 	(void) usb_suspend_device (hcd->self.root_hub, message);
 #else
@@ -129,16 +128,6 @@ static int ohci_pci_suspend (struct usb_
 	/* let things settle down a bit */
 	msleep (100);
 	
-#ifdef CONFIG_PPC_PMAC
-	if (_machine == _MACH_Pmac) {
-	   	struct device_node	*of_node;
- 
-		/* Disable USB PAD & cell clock */
-		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
-		if (of_node)
-			pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
-	}
-#endif /* CONFIG_PPC_PMAC */
 	return 0;
 }
 
@@ -148,20 +137,11 @@ static int ohci_pci_resume (struct usb_h
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
 	int			retval = 0;
 
-#ifdef CONFIG_PPC_PMAC
-	if (_machine == _MACH_Pmac) {
-		struct device_node *of_node;
-
-		/* Re-enable USB PAD & cell clock */
-		of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
-		if (of_node)
-			pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
-	}
-#endif /* CONFIG_PPC_PMAC */
-
 	/* resume root hub */
 	if (time_before (jiffies, ohci->next_statechange))
 		msleep (100);
+	set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+
 #ifdef	CONFIG_USB_SUSPEND
 	/* get extra cleanup even if remote wakeup isn't in use */
 	retval = usb_resume_device (hcd->self.root_hub);
Index: 2.6.14-ben/drivers/usb/host/uhci-hcd.c
===================================================================
--- 2.6.14-ben.orig/drivers/usb/host/uhci-hcd.c
+++ 2.6.14-ben/drivers/usb/host/uhci-hcd.c
@@ -797,6 +797,11 @@ static int uhci_suspend(struct usb_hcd *
 
 done:
 	spin_unlock_irq(&uhci->lock);
+	if (rc == 0) {
+		mb();
+		clear_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+		synchronize_irq(hcd->irq);
+	}
 	return rc;
 }
 
@@ -818,6 +823,8 @@ static int uhci_resume(struct usb_hcd *h
 	 * system wakeup.  Check it and reconfigure to avoid problems.
 	 */
 	check_and_reset_hc(uhci);
+	set_bit(HC_FLAG_IRQ_ON, &hcd->bitflags);
+	mb();
 	configure_hc(uhci);
 
 #ifndef CONFIG_USB_SUSPEND

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-11 21:52       ` Benjamin Herrenschmidt
@ 2005-11-12  8:53         ` Eddy Petrisor
  2005-11-12  9:45           ` Eddy Petrişor
  2005-11-14  7:19         ` Arkadiusz Miskiewicz
  2005-11-23 21:55         ` Gaudenz Steinlin
  2 siblings, 1 reply; 28+ messages in thread
From: Eddy Petrisor @ 2005-11-12  8:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

Benjamin Herrenschmidt wrote:
> The latest patch that is candidate for upstream is:
> 
> Index: 2.6.14-ben/drivers/usb/core/hcd-pci.c

This version also panics :(

-- 
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-12  8:53         ` Eddy Petrisor
@ 2005-11-12  9:45           ` Eddy Petrişor
  0 siblings, 0 replies; 28+ messages in thread
From: Eddy Petrişor @ 2005-11-12  9:45 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On 11/12/05, Eddy Petrisor <eddy.petrisor@gmail.com> wrote:
> Benjamin Herrenschmidt wrote:
> > The latest patch that is candidate for upstream is:
> >
> > Index: 2.6.14-ben/drivers/usb/core/hcd-pci.c
>
> This version also panics :(
>

Just as a note, the third and the second paniced, too.

--
Regards,
EddyP
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
"Imagination is more important than knowledge" A.Einstein

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-11 21:52       ` Benjamin Herrenschmidt
  2005-11-12  8:53         ` Eddy Petrisor
@ 2005-11-14  7:19         ` Arkadiusz Miskiewicz
  2005-11-14  8:06           ` Benjamin Herrenschmidt
  2005-11-23 21:55         ` Gaudenz Steinlin
  2 siblings, 1 reply; 28+ messages in thread
From: Arkadiusz Miskiewicz @ 2005-11-14  7:19 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: debian-powerpc

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

On Friday 11 November 2005 22:52, Benjamin Herrenschmidt wrote:
> The latest patch that is candidate for upstream is:

Oopsed for one pld user in a way shown in attachment after connecting usb 
device while laptop (recent ibook g4 afaik) was in sleep and then waking it 
up. That was with 2.6.14.2+your patch.

-- 
Arkadiusz Miśkiewicz                    PLD/Linux Team
http://www.t17.ds.pwr.wroc.pl/~misiek/  http://ftp.pld-linux.org/

[-- Attachment #2: suspend+usb=oops.png --]
[-- Type: image/png, Size: 57077 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-14  7:19         ` Arkadiusz Miskiewicz
@ 2005-11-14  8:06           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-14  8:06 UTC (permalink / raw)
  To: Arkadiusz Miskiewicz; +Cc: linuxppc-dev, debian-powerpc

On Mon, 2005-11-14 at 08:19 +0100, Arkadiusz Miskiewicz wrote:
> On Friday 11 November 2005 22:52, Benjamin Herrenschmidt wrote:
> > The latest patch that is candidate for upstream is:
> 
> Oopsed for one pld user in a way shown in attachment after connecting usb 
> device while laptop (recent ibook g4 afaik) was in sleep and then waking it 
> up. That was with 2.6.14.2+your patch.

Ok, so there are still unresolved issues in the USB layer, which doesn't
surprise me. I'm trying to work with the USB folks to get those resolved
in 2.6.15 at least, we'll see if I succeed...

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-03  6:33 2.6.14 USB vs. sleep issues Benjamin Herrenschmidt
                   ` (3 preceding siblings ...)
  2005-11-11  0:24 ` Wolfgang Pfeiffer
@ 2005-11-16 18:09 ` Wolfgang Pfeiffer
  2005-11-16 18:25   ` Wolfgang Pfeiffer
  2005-11-16 21:01   ` Benjamin Herrenschmidt
  4 siblings, 2 replies; 28+ messages in thread
From: Wolfgang Pfeiffer @ 2005-11-16 18:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On Thu, Nov 03, 2005 at 05:33:39PM +1100, Benjamin Herrenschmidt wrote:
> For those who experience crashes on sleep and/or wakeup (typically due
> to USB) with 2.6.14, I made a test patch that might help. [ ... ]

Ben, I just compiled and installed a 2.6.14.1 from kernel.org with
none of your patches from this thread applied to it, and I have no
sleep/wakeup probs with it so far: about 3 instances of sleep/wakeup
until now, all of them successful.

Maybe I even made it a bit more complicated for the system, as I
connected a USB HUB, with 4 ports, to the machine: It just seems to
work ...

-------------------------------------
$ cat /proc/cpuinfo 
processor       : 0
cpu             : 7455, altivec supported
clock           : 867MHz
revision        : 0.2 (pvr 8001 0302)
bogomips        : 865.18
machine         : PowerBook3,5
motherboard     : PowerBook3,5 MacRISC2 MacRISC Power Macintosh
detected as     : 80 (PowerBook Titanium IV)
pmac flags      : 0000001b
L2 cache        : 256K unified
memory          : 768MB
pmac-generation : NewWorld
-----------------------------------

HTH

Best Regards
Wolfgang

-- 
Wolfgang Pfeiffer
http://profiles.yahoo.com/wolfgangpfeiffer

Key ID: E3037113
Key fingerprint = A8CA 9D8C 54C4 4CC1 0B26  AA3C 9108 FB42 E303 7113

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-16 18:09 ` Wolfgang Pfeiffer
@ 2005-11-16 18:25   ` Wolfgang Pfeiffer
  2005-11-16 21:01   ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 28+ messages in thread
From: Wolfgang Pfeiffer @ 2005-11-16 18:25 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

On Wed, Nov 16, 2005 at 07:09:26PM +0100, Wolfgang Pfeiffer wrote:

> Ben, I just compiled and installed a 2.6.14.1 from kernel.org with
> none of your patches from this thread applied to it, and I have no
> sleep/wakeup probs with it so far: about 3 instances of sleep/wakeup
> until now, all of them successful.
> 
> Maybe I even made it a bit more complicated for the system, as I
> connected a USB HUB, with 4 ports, to the machine: It just seems to
> work ... [ ... ]

Just for the sake of completeness: I have (SCSI) problems with 2.6.14.1,
but none of them seem to be USB/sleep related:
<http://sourceforge.net/mailarchive/forum.php?thread_id=8964383&forum_id=5389>

Not being sure whether this latter URL works: I just read "The
SourceForge.net Website is currently down for maintenance" But the
name of the thread up there is:
"Fw: 2.6.14.1: Loading FireWire disk fails. Fix: "modprobe ieee1394
disable_irm=1""

Best Regards
Wolfgang
-- 
Wolfgang Pfeiffer
http://profiles.yahoo.com/wolfgangpfeiffer

Key ID: E3037113
Key fingerprint = A8CA 9D8C 54C4 4CC1 0B26  AA3C 9108 FB42 E303 7113

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-16 18:09 ` Wolfgang Pfeiffer
  2005-11-16 18:25   ` Wolfgang Pfeiffer
@ 2005-11-16 21:01   ` Benjamin Herrenschmidt
  2005-11-16 23:21     ` Eddy Petrisor
  1 sibling, 1 reply; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-16 21:01 UTC (permalink / raw)
  To: Wolfgang Pfeiffer; +Cc: linuxppc-dev list, debian-powerpc

On Wed, 2005-11-16 at 19:09 +0100, Wolfgang Pfeiffer wrote:
> On Thu, Nov 03, 2005 at 05:33:39PM +1100, Benjamin Herrenschmidt wrote:
> > For those who experience crashes on sleep and/or wakeup (typically due
> > to USB) with 2.6.14, I made a test patch that might help. [ ... ]
> 
> Ben, I just compiled and installed a 2.6.14.1 from kernel.org with
> none of your patches from this thread applied to it, and I have no
> sleep/wakeup probs with it so far: about 3 instances of sleep/wakeup
> until now, all of them successful.
> 
> Maybe I even made it a bit more complicated for the system, as I
> connected a USB HUB, with 4 ports, to the machine: It just seems to
> work ...

Only newer machines with a NEC USB2 chip that shares interrupts appear
to be affected by the problem.

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-16 21:01   ` Benjamin Herrenschmidt
@ 2005-11-16 23:21     ` Eddy Petrisor
  0 siblings, 0 replies; 28+ messages in thread
From: Eddy Petrisor @ 2005-11-16 23:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

Benjamin Herrenschmidt wrote:
> On Wed, 2005-11-16 at 19:09 +0100, Wolfgang Pfeiffer wrote:
> 
>>>For those who experience crashes on sleep and/or wakeup (typically due
>>>to USB) with 2.6.14, I made a test patch that might help. [ ... ]

> Only newer machines with a NEC USB2 chip that shares interrupts appear
> to be affected by the problem.

So is there any chance that the sleep issue is fixed until 2.6.15?

-- 
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-11 21:52       ` Benjamin Herrenschmidt
  2005-11-12  8:53         ` Eddy Petrisor
  2005-11-14  7:19         ` Arkadiusz Miskiewicz
@ 2005-11-23 21:55         ` Gaudenz Steinlin
  2005-11-23 22:09           ` Benjamin Herrenschmidt
  2 siblings, 1 reply; 28+ messages in thread
From: Gaudenz Steinlin @ 2005-11-23 21:55 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc

Hi Ben

Benjamin Herrenschmidt schrieb:
> The latest patch that is candidate for upstream is:

I have the same USB wakeup problem with my new powerbook 5,8 (oct 2005 
15"). Without the patch I get a kernel oops on wakeup just like the 
others. With this patch applied (and the pb 5,8 basic enablement patch) 
the lcd gets distorted colors on wakeup. It looks quite insane, like a 
broken lcd.

I'm useing a vanilla 2.6.14.2 kernel. CONFIG_USB_SUSPEND is set, PREEMPT
is disabled. Is there a newer version of the patch available for testing?

Gaudenz

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: 2.6.14 USB vs. sleep issues
  2005-11-23 21:55         ` Gaudenz Steinlin
@ 2005-11-23 22:09           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 28+ messages in thread
From: Benjamin Herrenschmidt @ 2005-11-23 22:09 UTC (permalink / raw)
  To: Gaudenz Steinlin; +Cc: linuxppc-dev list, debian-powerpc

On Wed, 2005-11-23 at 22:55 +0100, Gaudenz Steinlin wrote:
> Hi Ben
> 
> Benjamin Herrenschmidt schrieb:
> > The latest patch that is candidate for upstream is:
> 
> I have the same USB wakeup problem with my new powerbook 5,8 (oct 2005 
> 15"). Without the patch I get a kernel oops on wakeup just like the 
> others. With this patch applied (and the pb 5,8 basic enablement patch) 
> the lcd gets distorted colors on wakeup. It looks quite insane, like a 
> broken lcd.
> 
> I'm useing a vanilla 2.6.14.2 kernel. CONFIG_USB_SUSPEND is set, PREEMPT
> is disabled. Is there a newer version of the patch available for testing?

The USB patch has nothing to do with your screen problems. Does the
screen issue goes away after a couple of sleep/wakeup cycles ? i'm
waiting on the same machine model that I just ordered from Apple, so
I'll be able to fix remaining issues soon.

Ben.

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2005-11-23 22:23 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-03  6:33 2.6.14 USB vs. sleep issues Benjamin Herrenschmidt
2005-11-03  9:03 ` Eddy Petrişor
2005-11-03 21:21   ` Benjamin Herrenschmidt
2005-11-04  7:13     ` Eddy Petrişor
2005-11-04  7:18       ` Benjamin Herrenschmidt
2005-11-04 19:32         ` Vivenzio Pagliari
2005-11-04 21:48           ` Benjamin Herrenschmidt
2005-11-05 21:58 ` Bin Zhang
2005-11-05 22:17   ` Benjamin Herrenschmidt
2005-11-06 10:54     ` Bin Zhang
2005-11-11 21:47     ` Eddy Petrisor
2005-11-11 21:52       ` Benjamin Herrenschmidt
2005-11-12  8:53         ` Eddy Petrisor
2005-11-12  9:45           ` Eddy Petrişor
2005-11-14  7:19         ` Arkadiusz Miskiewicz
2005-11-14  8:06           ` Benjamin Herrenschmidt
2005-11-23 21:55         ` Gaudenz Steinlin
2005-11-23 22:09           ` Benjamin Herrenschmidt
2005-11-07  9:13 ` Charles-Edouard Ruault
2005-11-07 14:54   ` Wolfram Quester
2005-11-07 21:00   ` Benjamin Herrenschmidt
2005-11-10  1:12     ` Eddy Petrişor
2005-11-10  1:51       ` Benjamin Herrenschmidt
2005-11-11  0:24 ` Wolfgang Pfeiffer
2005-11-16 18:09 ` Wolfgang Pfeiffer
2005-11-16 18:25   ` Wolfgang Pfeiffer
2005-11-16 21:01   ` Benjamin Herrenschmidt
2005-11-16 23:21     ` Eddy Petrisor

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.