Is one second too short for USB idle timer?

I am working on a WDF USB driver to support selective suspend and am experience an issue with the USB idle timer. If it was set to to 1 second, the bus cannot wakeup normally. The USB bus log indicates the bus resumes, and SOF appears, but no CLEAR_FEATURE was being sent. The whole thing works if the timer was set 2 seconds.

Is one second too aggressive for WDF USB driver? I noticed most samples using 10 seconds and the default is 5 seconds in WDF.

Which OS version, which WDF version, which WDK version?

It isn’t normal behaviour and looks as a bug somewhere. IIRC I tried 1
sec timeout with WDF 1.9 and it worked as expected. In addition, times
less than 1 sec had the same effect as 1 sec (again, if I remember
correctly).

It is safer to use longer idle timeout. With too short device can switch
between D0 and D2 too often which can provoke race conditions in OS USB
drivers and lead to crash or misbehaviour. I have bad experience with it
mainly at Vista (SPs fix some problems).

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@sierrawireless.com
Sent: Wednesday, September 23, 2009 12:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Is one second too short for USB idle timer?

I am working on a WDF USB driver to support selective suspend
and am experience an issue with the USB idle timer. If it was
set to to 1 second, the bus cannot wakeup normally. The USB
bus log indicates the bus resumes, and SOF appears, but no
CLEAR_FEATURE was being sent. The whole thing works if the
timer was set 2 seconds.

Is one second too aggressive for WDF USB driver? I noticed
most samples using 10 seconds and the default is 5 seconds in WDF.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online
at http://www.osronline.com/page.cfm?name=ListServer

Thanks, Michal.

My case is on Windows 7 RTM, WDF 1.9 and Windows RTM DDK (7600.16385.0).

In my driver log, I can see the D0Entry was called after resuming, just on USB bus no CLEAR_FEATURE was sent from host.

I am OK with a longer timeout, only concern if it is our device issue or something else.

May Doron shed a light on this?

Michal’s advice was spot on. One sec is so short you could easily spend your time bouncing between on and off

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@sierrawireless.com
Sent: Tuesday, September 22, 2009 5:23 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Is one second too short for USB idle timer?

May Doron shed a light on this?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Understood. Realistically, one second may have side effect as Michal’s mentioned. Actually, setting it short is a good stress test for the driver, framework and HW. So how could I debug this case if I suspect something wrong on the host side?

First, I’d recommend some experiments:

  1. try it on another USB HC i.e. on a machine with different chipset or
    USB board (if you have some). For 1.1. device check with both UHCI and
    OHCI HCs.
  2. try it with USB hub
  3. try to find the threshold i.e. time when it starts working as
    expected

If problem doesn’t change during #1 and #2 experiments, I’d presume
problem at your side. Firmware or driver.

Just to make things clear. What you see with USB analyser with longer
idle times is following:

  • SET_FEATURE(RemoteWakeup)
  • Suspend for some time
  • CLEAR_FEATURE(RemoteWakeup)

and with 1 sec idle timeout CLEAR_FEATURE is missing. Right?

What causes wake from suspend? Device or host? Does it influence the
scenario? Is suspend time important?

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@sierrawireless.com
Sent: Wednesday, September 23, 2009 8:12 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Is one second too short for USB idle timer?

Understood. Realistically, one second may have side effect as
Michal’s mentioned. Actually, setting it short is a good
stress test for the driver, framework and HW. So how could I
debug this case if I suspect something wrong on the host side?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online
at http://www.osronline.com/page.cfm?name=ListServer

I noticed it happened only when the suspend and resume is back to back. If the suspend and resume is too close, the resume will be failed that either the clear feature missed or no resume on the bus at all. Should WDF framework handle this properly, or it is an issue for the hardware?

it is defiitely not something that wdf should be handling. either it is an issue in the usb core or in your hw. i would start with your hw

d


From: xxxxx@lists.osr.com [xxxxx@lists.osr.com] on behalf of xxxxx@sierrawireless.com [xxxxx@sierrawireless.com]
Sent: Tuesday, September 29, 2009 10:07 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Is one second too short for USB idle timer?

I noticed it happened only when the suspend and resume is back to back. If the suspend and resume is too close, the resume will be failed that either the clear feature missed or no resume on the bus at all. Should WDF framework handle this properly, or it is an issue for the hardware?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer