[wdmaudiodev] Re: USB 3.0 issue when un-plug audio device

  • From: "Sam Tertzakian" <sam@xxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Mon, 2 Jul 2012 01:20:27 -0700

Great news!

-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Moore Zhang
Sent: Sunday, July 01, 2012 4:05 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB 3.0 issue when un-plug audio device

Sam, thanks so much for your reply. 

I at last fixed this issue. In completion routine, I got a NTSTATUS value for 
IRP which is 0xc0000011 which is not included in my original care. NTSTATUS 
error code 0xc0000011 mean: The end-of-file marker has been reached. There is 
no valid data in the file beyond this marker.

I added this error code to my judge list and so that audio stream will be 
stopped at time. After that, PnP/Power requests comes. Wow!!!

-----????-----
???: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] 
?? Sam Tertzakian
????: June 30, 2012 11:33
???: wdmaudiodev@xxxxxxxxxxxxx
??: [wdmaudiodev] Re: USB 3.0 issue when un-plug audio device

1. I would check for ( ! NT_SUCCESS( ntStatus ) ) instead of checking for 
specific errors.
2. When you just return STATUS_MORE_PROCESSING_REQUIRED, do you do anything 
else in the driver? I mean, I assume you created these IRPs. Are you freeing 
them? What do you do in the case of NT_SUCCESS( ntStatus )...do you send them 
back down to the stack?
3. When you are in the stuck state, please run this command in  the debugger:

!pnptriage

At the bottom you should see a thread and you can see what the PNP thread that 
issue surprise remove is waiting on.
I am pretty sure you have an outstanding request.

-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Moore Zhang
Sent: Friday, June 29, 2012 5:46 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB 3.0 issue when un-plug audio device

Sam:

Thanks for reply. In fact, such logic already included in my completion 
routine. Refer to below code snap which means in my completion routine, only if 
the return code is success, else the IRP loop should be terminated. My 
confusion is that, if I use system USBAudio driver, there will be a delay(about 
4s in my system) to receive the PnP/Power requests, but at last, such requests 
are received. I have no idea now, and doubt it should be Intel host 
controller's issue.

    if ((ntStatus == STATUS_CANCELLED) ||
       (ntStatus == STATUS_UNSUCCESSFUL)||
       (ntStatus == USBD_STATUS_DEV_NOT_RESPONDING)||
       (ntStatus == USBD_STATUS_DEVICE_GONE)||
       (ntStatus == STATUS_DEVICE_NOT_CONNECTED))
    {
        return STATUS_MORE_PROCESSING_REQUIRED;
    } 


-----????-----
???: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] 
?? Sam Tertzakian
????: June 29, 2012 17:19
???: wdmaudiodev@xxxxxxxxxxxxx
??: [wdmaudiodev] Re: ??: Re: USB 3.0 issue when un-plug audio device

Are you checking in your USB completion routine to see if there is a 
USBD_STATUS_CANCELLED or USBD_STATUS_DEVICE_IS_GONE or some other error. 
Perhaps you are not checking that error code and you are submitting the 
requests back immediately instead of stopping to send any more requests.

-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Moore Zhang
Sent: Thursday, June 28, 2012 5:59 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] ??: Re: USB 3.0 issue when un-plug audio device

Sam, you don't want to know the BSOD and hang stack, because the crash is not 
important. My issue is that when I un-plug device, there's no PnP and Power 
event. So that I don't have chance to process surprise remove and pnp stop 
events.

The BSOD/crash is not important. There are different symptoms with different 
bug check code, and the root cause is that the real device has been removed, 
but audio stream is still working. Yes, it's really hang in USB3 stack which is 
processing the audio stream.

-----????-----
???: wdmaudiodev-bounce@xxxxxxxxxxxxx [mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] 
?? Sam Tertzakian
????: June 28, 2012 08:24
???: wdmaudiodev@xxxxxxxxxxxxx
??: [wdmaudiodev] Re: USB 3.0 issue when un-plug audio device

You need to, at the minimum, send us the output of "!analyze -v" with full 
symbol information.

The question is:

Is it crashing in your driver or the USB3 stack? We need to know that first. 


-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Moore Zhang
Sent: Wednesday, June 27, 2012 5:16 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: USB 3.0 issue when un-plug audio device

Intel's USB3 controller, device ID is VID_8086&HID_1E31. Both controller and 
hub drivers are latest from Intel.  

----- -----
Title: [wdmaudiodev] Re: USB 3.0 issue when un-plug audio device

Hi, 
What USB3 Host Controller are you using?

-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Moore Zhang
Sent: Wednesday, June 27, 2012 5:54 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] USB 3.0 issue when un-plug audio device

Hi Guys:

Some days ago, I test my usb audio driver in USB3.0 and BSOD occurs when I 
un-plug device while it's still playing back. I attach windbg and set 
breakpoint in all PnP and Power events. Very strange, when issue happens, none 
of these events are hit until I stop music playing back. My audio driver is 
written with AVStream framework. 

0: kd> !drvobj myAudioDriver 0xf
Driver object (86642030) is for:
 \Driver\ myAudioDriver
Driver Extension List: (id , addr)
(aea6de96 87b47338)  
Device Object list:
86731b20  
 [16] IRP_MJ_POWER                       aea70cbc       
ks!CKsDevice::DispatchPower
 [1b] IRP_MJ_PNP                         aea6926e       
ks!CKsDevice::DispatchPnp

So I set bp in ks!CKsDevice::DispatchPower and ks!CKsDevice::DispatchPnp. Then 
reproduce this issue. Strange, both breakpoints in ks!CKsDevice::DispatchPnp 
and DispatchPower are not hit until I stop music playback. Sometimes I have 
chance to stop playing, and sometimes there is bug check hang.

This issue never happens in USB1.1 and 2.0 port. Is this a known issue, anyone 
ever met the similar issue? Any idea is appreciated! 

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/


******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: