public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* USB not processing APM suspend event properly?
@ 2001-12-09 23:31 Thomas Hood
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Hood @ 2001-12-09 23:31 UTC (permalink / raw)
  To: linux-kernel

The following syslog fragment shows what happens when
I suspended earlier today.  The USB subsystem disconnected
my USB mouse, but then tried (twice) to reconnect it again
while the apm driver was still processing the suspend.  The
attempts to reconnect failed.  I presume there is something
wrong with this picture.  Does this indicate a bug in
USB power management?

(The repeated "received system suspend notify" messages are
there because I have apm debug messages switch on, and I
am using a ThinkPad, which generates repeated suspend
events.)

Dec  9 17:38:27 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:27 thanatos kernel: usb.c: USB disconnect on device 4
Dec  9 17:38:27 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:27 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:27 thanatos kernel: hub.c: USB new device connect on
bus1/1, assigned device number 5
Dec  9 17:38:28 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:30 thanatos last message repeated 2 times
Dec  9 17:38:30 thanatos kernel: usb_control/bulk_msg: timeout
Dec  9 17:38:30 thanatos kernel: usb.c: USB device not accepting new
address=5 (error=-110)
Dec  9 17:38:31 thanatos kernel: hub.c: USB new device connect on
bus1/1, assigned device number 6
Dec  9 17:38:31 thanatos kernel: apm: setting state busy
Dec  9 17:38:31 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:33 thanatos last message repeated 2 times
Dec  9 17:38:34 thanatos kernel: usb_control/bulk_msg: timeout
Dec  9 17:38:34 thanatos kernel: usb.c: USB device not accepting new
address=6 (error=-110)
Dec  9 17:38:34 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:35 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:36 thanatos kernel: apm: setting state busy



^ permalink raw reply	[flat|nested] 9+ messages in thread
* USB not processing APM suspend event properly?
@ 2001-12-12 22:15 Thomas Hood
  2001-12-12 22:41 ` Alan Cox
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Hood @ 2001-12-12 22:15 UTC (permalink / raw)
  To: linux-kernel

The following syslog fragment shows what happens when I
suspended a while ago.  The USB subsystem disconnected
my USB mouse, but then tried (twice) to reconnect it again
while the apm driver was still processing the suspend.  The
attempts to reconnect failed.  I presume there is something
wrong with this picture.  Does this indicate a bug in
USB power management?

(The repeated "received system suspend notify" messages are
there because I have apm debug messages switch on, and I
am using a ThinkPad, which generates repeated suspend
events.)

Dec  9 17:38:27 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:27 thanatos kernel: usb.c: USB disconnect on device 4
Dec  9 17:38:27 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:27 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:27 thanatos kernel: hub.c: USB new device connect on
bus1/1, assigned device number 5
Dec  9 17:38:28 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:30 thanatos last message repeated 2 times
Dec  9 17:38:30 thanatos kernel: usb_control/bulk_msg: timeout
Dec  9 17:38:30 thanatos kernel: usb.c: USB device not accepting new
address=5 (error=-110)
Dec  9 17:38:31 thanatos kernel: hub.c: USB new device connect on
bus1/1, assigned device number 6
Dec  9 17:38:31 thanatos kernel: apm: setting state busy
Dec  9 17:38:31 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:33 thanatos last message repeated 2 times
Dec  9 17:38:34 thanatos kernel: usb_control/bulk_msg: timeout
Dec  9 17:38:34 thanatos kernel: usb.c: USB device not accepting new
address=6 (error=-110)
Dec  9 17:38:34 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:35 thanatos kernel: apm: received system suspend notify
Dec  9 17:38:36 thanatos kernel: apm: setting state busy




^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: USB not processing APM suspend event properly?
@ 2001-12-12 23:40 Thomas Hood
  2001-12-12 23:49 ` Russell King
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Hood @ 2001-12-12 23:40 UTC (permalink / raw)
  To: linux-kernel

> This was caused by the PCMCIA network interface being
> off, and the apmd scripts trying to fuser -k and
> unmount an in-use NFS partition, which in turn wanted
> to generate NFS traffic to the server over the shut
> down PCMCIA network interface...

So your problem was that PCMCIA got shut down too early.

> Basically, I've changed the order that things happen on
> suspend, such that we always pass the event to apmd, and
> any other listeners on /dev/apm_bios.  Once everyone has
> replied (subject to the rules of course), it then sends
> the PM_SUSPEND to the devices.

I suppose that the reason why it is presently coded as
it is is that the drivers can veto the suspend whereas
the "listeners" can't, and the apm driver wants to tell
the listeners about the event only if it isn't vetoed.
With your change, the apm driver really should ignore
a veto from the drivers since it has already told the
listeners about the event.  Therefore, while your patch
is an improvement, it still isn't the whole solution.

One possible solution is for the apm driver first to _ask_
the device drivers whether a suspend is allowed; then
to tell the listeners; then to tell the device drivers
to suspend.  This solution could be implemented by adding
the "ask" function to each driver with pm support.  The
driver's opportunity to veto the suspend would be when
it is asked, not when it is told to suspend.

> The original code sent PM_SUSPEND on receiving the original
> request, and then multiple times each time a listener on
> /dev/apm_bios replied.  Not good if apmd wants to unmount
> NFS, and your NFS mounts require traffic over your PCMCIA
> ether card!

Actually, it's not true that the original code sends PM_SUSPEND
each time a listener on /dev/apm_bios replies.  The code 
fragment is:
                if (as->suspends_read > 0) {
                        as->suspends_read--;
                        as->suspends_pending--;
                        suspends_pending--;
                } else if (!send_event(APM_USER_SUSPEND))
                        return -EAGAIN;
                else
                        queue_event(APM_USER_SUSPEND, as);
This only calls send_event() if the ioctl(suspend) is NOT a
reply to a notification that was earlier read from the queue.



^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: USB not processing APM suspend event properly?
@ 2001-12-13  1:03 Thomas Hood
  2001-12-13 10:36 ` Russell King
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Hood @ 2001-12-13  1:03 UTC (permalink / raw)
  To: linux-kernel

> Sending 'n' PM_SUSPEND events because you have 'n' listeners
> on /dev/apm_bios seems to be a waste of time when it could be
> handled more cleanly.

But do you agree that the present code does NOT do this?

The present code does not send 'n' events---only one.


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

end of thread, other threads:[~2001-12-13 14:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-09 23:31 USB not processing APM suspend event properly? Thomas Hood
  -- strict thread matches above, loose matches on Subject: below --
2001-12-12 22:15 Thomas Hood
2001-12-12 22:41 ` Alan Cox
2001-12-12 22:49   ` Russell King
2001-12-12 23:40 Thomas Hood
2001-12-12 23:49 ` Russell King
2001-12-13  1:03 Thomas Hood
2001-12-13 10:36 ` Russell King
2001-12-13 14:10   ` Thomas Hood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox