KMDF Stuck Device

I had reported this problem a while back and I think never found the
solution and never sent the correct data to the forum. I’m trying to
figure out why this PDO is stuck on top of my bus driver. It has the
WdfDevStatePnpFailedWaitForRemove state. The device was working fine and
it was surprise removed and then it get stuck. There are no open handles
to the device. (not that I know of). What can I do to recover from this
situation?

!wdfdevice 0x7E06B4A0 0xf

Dumping WDFDEVICE 0x7e06b4a0

=================================

WDM PDEVICE_OBJECTs: self 81d8eb48

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )

Power state: 315 ( WdfDevStatePowerStopped )

Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6e3bf0

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:

[0] WdfDevStatePnpHardwareAvailable (0x108)

[1] WdfDevStatePnpEnableInterfaces (0x109)

[2] WdfDevStatePnpStarted (0x119)

[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)

[4] WdfDevStatePnpFailedIoStarting (0x129)

[5] WdfDevStatePnpFailedOwnHardware (0x12a)

[6] WdfDevStatePnpFailed (0x12b)

[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:

[0] WdfDevStatePowerD0Starting (0x30f)

[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)

[2] WdfDevStatePowerD0StartingDmaEnable (0x311)

[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)

[4] WdfDevStatePowerDecideD0State (0x313)

[5] WdfDevStatePowerD0BusWakeOwner (0x309)

[6] WdfDevStatePowerGotoD3Stopped (0x314)

[7] WdfDevStatePowerStopped (0x315)

Power policy state history:

[0] WdfDevStatePwrPolObjectCreated (0x500)

[1] WdfDevStatePwrPolStarting (0x501)

[2] WdfDevStatePwrPolStarted (0x565)

[3] WdfDevStatePwrPolStartingSucceeded (0x502)

[4] WdfDevStatePwrPolStopping (0x55b)

[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)

[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)

[7] WdfDevStatePwrPolStopped (0x563)

!wdfqueue 0x7DE6F850

*** ERROR: Module load completed but symbols could not be loaded for
vpc-s3.sys

*** WARNING: Unable to verify timestamp for vpc-s3.dll

*** ERROR: Module load completed but symbols could not be loaded for
vpc-s3.dll

*** WARNING: Unable to verify timestamp for ATMFD.DLL

*** ERROR: Module load completed but symbols could not be loaded for
ATMFD.DLL

*** ERROR: Module load completed but symbols could not be loaded for
MRxVPC.sys

*** ERROR: Module load completed but symbols could not be loaded for
vmsrvc.sys

Dumping WDFQUEUE 0x7de6f850

=========================

Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 0

EvtIoDefault: (0xf74786b0) panobus!Device_EvtIoDefault

EvtIoRead: (0xf7478700) panobus!Device_EvtIoRead

EvtIoWrite: (0xf7478730) panobus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf7478790) panobus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf7478a00)
panobus!Device_EvtIoInternalDeviceControl

EvtIoCanceledOnQueue: (0xf7478760) panobus!Device_EvtIoCancelled


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, November 27, 2007 10:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] KMDF Stuck Device

The PDO is waiting for the remove irp to show up. either the PDO failed
the start irp b/c one of your power up routines returned !NT_SUCCESS or
you successfully started and then the PDO was reported as failed or
missing. Can you rerun !wdfdevice and specify 0xF as the flags and
send the output? For instance !wdfdevice 0x7cfb9820 0xF. This will
show the history of the pnp state machine which should be able to
indicate if it was a failed start or a s.r.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, November 27, 2007 3:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF Stuck Device

I have a bus driver that creates virtual devices. Once in a while a
device gets stuck…(i.e gone from device manager but not gone from a
system perspective). Here is the dump from WinDBG. Its stuck in
WdfDevStatePnpFailedWaitForRemove.

My question is two part:

  1. How does this happen?
  2. What can I do to recover from this?

!wdfkd.WDFDEVICE 0x7cfb9820

Dumping WDFDEVICE 0x7cfb9820

=================================

WDM PDEVICE_OBJECTs: self 83084d28

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )

Power state: 315 ( WdfDevStatePowerStopped )

Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7cfc9bf0

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Thanks

Pankaj


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


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

What is the stack that is loaded on your PDO? E.g. !devstack 81d8eb48 will give you this answer. Is the FDO loaded on your PDO also WDF? If so, you can run !wdfdevice on this downstream FDO as well.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, April 08, 2008 11:47 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF Stuck Device

I had reported this problem a while back and I think never found the solution and never sent the correct data to the forum. I’m trying to figure out why this PDO is stuck on top of my bus driver. It has the WdfDevStatePnpFailedWaitForRemove state. The device was working fine and it was surprise removed and then it get stuck. There are no open handles to the device. (not that I know of). What can I do to recover from this situation?

!wdfdevice 0x7E06B4A0 0xf

Dumping WDFDEVICE 0x7e06b4a0

WDM PDEVICE_OBJECTs: self 81d8eb48

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )
Power state: 315 ( WdfDevStatePowerStopped )
Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6e3bf0
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:
[0] WdfDevStatePnpHardwareAvailable (0x108)
[1] WdfDevStatePnpEnableInterfaces (0x109)
[2] WdfDevStatePnpStarted (0x119)
[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)
[4] WdfDevStatePnpFailedIoStarting (0x129)
[5] WdfDevStatePnpFailedOwnHardware (0x12a)
[6] WdfDevStatePnpFailed (0x12b)
[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:
[0] WdfDevStatePowerD0Starting (0x30f)
[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)
[2] WdfDevStatePowerD0StartingDmaEnable (0x311)
[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)
[4] WdfDevStatePowerDecideD0State (0x313)
[5] WdfDevStatePowerD0BusWakeOwner (0x309)
[6] WdfDevStatePowerGotoD3Stopped (0x314)
[7] WdfDevStatePowerStopped (0x315)

Power policy state history:
[0] WdfDevStatePwrPolObjectCreated (0x500)
[1] WdfDevStatePwrPolStarting (0x501)
[2] WdfDevStatePwrPolStarted (0x565)
[3] WdfDevStatePwrPolStartingSucceeded (0x502)
[4] WdfDevStatePwrPolStopping (0x55b)
[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)
[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)
[7] WdfDevStatePwrPolStopped (0x563)

!wdfqueue 0x7DE6F850
*** ERROR: Module load completed but symbols could not be loaded for vpc-s3.sys
*** WARNING: Unable to verify timestamp for vpc-s3.dll
*** ERROR: Module load completed but symbols could not be loaded for vpc-s3.dll
*** WARNING: Unable to verify timestamp for ATMFD.DLL
*** ERROR: Module load completed but symbols could not be loaded for ATMFD.DLL
*** ERROR: Module load completed but symbols could not be loaded for MRxVPC.sys
*** ERROR: Module load completed but symbols could not be loaded for vmsrvc.sys

Dumping WDFQUEUE 0x7de6f850

Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0

EvtIoDefault: (0xf74786b0) panobus!Device_EvtIoDefault
EvtIoRead: (0xf7478700) panobus!Device_EvtIoRead
EvtIoWrite: (0xf7478730) panobus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf7478790) panobus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf7478a00) panobus!Device_EvtIoInternalDeviceControl
EvtIoCanceledOnQueue: (0xf7478760) panobus!Device_EvtIoCancelled


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, November 27, 2007 10:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] KMDF Stuck Device

The PDO is waiting for the remove irp to show up. either the PDO failed the start irp b/c one of your power up routines returned !NT_SUCCESS or you successfully started and then the PDO was reported as failed or missing. Can you rerun !wdfdevice and specify 0xF as the flags and send the output? For instance !wdfdevice 0x7cfb9820 0xF. This will show the history of the pnp state machine which should be able to indicate if it was a failed start or a s.r.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, November 27, 2007 3:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF Stuck Device

I have a bus driver that creates virtual devices. Once in a while a device gets stuck…(i.e gone from device manager but not gone from a system perspective). Here is the dump from WinDBG. Its stuck in WdfDevStatePnpFailedWaitForRemove.
My question is two part:

  1. How does this happen?
  2. What can I do to recover from this?

!wdfkd.WDFDEVICE 0x7cfb9820

Dumping WDFDEVICE 0x7cfb9820

WDM PDEVICE_OBJECTs: self 83084d28

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )
Power state: 315 ( WdfDevStatePowerStopped )
Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7cfc9bf0
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Thanks
Pankaj


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


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


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

This is a soft of USb over Ethernet stack and the device was a mass
storage device. So Microsoft’s UsbStor driver was loaded. In this
particular case I had plugged the device and removed it pretty
quickly…i’m wondering if it ever made it to the correct working
state. I am also not handling any power or pnp related callbacks. Should
I handle any particular one that will fix this situation? Also my stack
is such that surprise removal is always initiated by me…by reporting
the pdo missing. Before I report the PDO missing, I also call
WdfIoQueuePurge.

!devstack 81d8eb48

!DevObj !DrvObj !DevExt ObjectName

82864560 \Driver\USBSTOR 82864618 00000084

81d8eb48 \Driver\panobus 81f94d20 00000083

!DevNode 827cb410 :

DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”

ServiceName is “USBSTOR”


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 11:52 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] KMDF Stuck Device

What is the stack that is loaded on your PDO? E.g. !devstack 81d8eb48
will give you this answer. Is the FDO loaded on your PDO also WDF? If
so, you can run !wdfdevice on this downstream FDO as well.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, April 08, 2008 11:47 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF Stuck Device

I had reported this problem a while back and I think never found the
solution and never sent the correct data to the forum. I’m trying to
figure out why this PDO is stuck on top of my bus driver. It has the
WdfDevStatePnpFailedWaitForRemove state. The device was working fine and
it was surprise removed and then it get stuck. There are no open handles
to the device. (not that I know of). What can I do to recover from this
situation?

!wdfdevice 0x7E06B4A0 0xf

Dumping WDFDEVICE 0x7e06b4a0

=================================

WDM PDEVICE_OBJECTs: self 81d8eb48

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )

Power state: 315 ( WdfDevStatePowerStopped )

Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6e3bf0

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:

[0] WdfDevStatePnpHardwareAvailable (0x108)

[1] WdfDevStatePnpEnableInterfaces (0x109)

[2] WdfDevStatePnpStarted (0x119)

[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)

[4] WdfDevStatePnpFailedIoStarting (0x129)

[5] WdfDevStatePnpFailedOwnHardware (0x12a)

[6] WdfDevStatePnpFailed (0x12b)

[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:

[0] WdfDevStatePowerD0Starting (0x30f)

[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)

[2] WdfDevStatePowerD0StartingDmaEnable (0x311)

[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)

[4] WdfDevStatePowerDecideD0State (0x313)

[5] WdfDevStatePowerD0BusWakeOwner (0x309)

[6] WdfDevStatePowerGotoD3Stopped (0x314)

[7] WdfDevStatePowerStopped (0x315)

Power policy state history:

[0] WdfDevStatePwrPolObjectCreated (0x500)

[1] WdfDevStatePwrPolStarting (0x501)

[2] WdfDevStatePwrPolStarted (0x565)

[3] WdfDevStatePwrPolStartingSucceeded (0x502)

[4] WdfDevStatePwrPolStopping (0x55b)

[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)

[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)

[7] WdfDevStatePwrPolStopped (0x563)

!wdfqueue 0x7DE6F850

*** ERROR: Module load completed but symbols could not be loaded for
vpc-s3.sys

*** WARNING: Unable to verify timestamp for vpc-s3.dll

*** ERROR: Module load completed but symbols could not be loaded for
vpc-s3.dll

*** WARNING: Unable to verify timestamp for ATMFD.DLL

*** ERROR: Module load completed but symbols could not be loaded for
ATMFD.DLL

*** ERROR: Module load completed but symbols could not be loaded for
MRxVPC.sys

*** ERROR: Module load completed but symbols could not be loaded for
vmsrvc.sys

Dumping WDFQUEUE 0x7de6f850

=========================

Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 0

EvtIoDefault: (0xf74786b0) panobus!Device_EvtIoDefault

EvtIoRead: (0xf7478700) panobus!Device_EvtIoRead

EvtIoWrite: (0xf7478730) panobus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf7478790) panobus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf7478a00)
panobus!Device_EvtIoInternalDeviceControl

EvtIoCanceledOnQueue: (0xf7478760) panobus!Device_EvtIoCancelled


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, November 27, 2007 10:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] KMDF Stuck Device

The PDO is waiting for the remove irp to show up. either the PDO failed
the start irp b/c one of your power up routines returned !NT_SUCCESS or
you successfully started and then the PDO was reported as failed or
missing. Can you rerun !wdfdevice and specify 0xF as the flags and
send the output? For instance !wdfdevice 0x7cfb9820 0xF. This will
show the history of the pnp state machine which should be able to
indicate if it was a failed start or a s.r.

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, November 27, 2007 3:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF Stuck Device

I have a bus driver that creates virtual devices. Once in a while a
device gets stuck…(i.e gone from device manager but not gone from a
system perspective). Here is the dump from WinDBG. Its stuck in
WdfDevStatePnpFailedWaitForRemove.

My question is two part:

  1. How does this happen?
  2. What can I do to recover from this?

!wdfkd.WDFDEVICE 0x7cfb9820

Dumping WDFDEVICE 0x7cfb9820

=================================

WDM PDEVICE_OBJECTs: self 83084d28

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )

Power state: 315 ( WdfDevStatePowerStopped )

Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7cfc9bf0

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Thanks

Pankaj


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


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


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


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

what is the output of !devnode (in this case !DevNode 827cb410))? You may need to specify some flags (0xF) to to the command for it to dump the devnode’s state and history.

Also, run !locks. that will tell you if the pnp lock is being held, and if so, by which thread which you then switch to with .thread and then see if someone is blocking on the pnp remove irp

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, April 08, 2008 12:07 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

This is a soft of USb over Ethernet stack and the device was a mass storage device. So Microsoft’s UsbStor driver was loaded. In this particular case I had plugged the device and removed it pretty quickly…i’m wondering if it ever made it to the correct working state. I am also not handling any power or pnp related callbacks. Should I handle any particular one that will fix this situation? Also my stack is such that surprise removal is always initiated by me…by reporting the pdo missing. Before I report the PDO missing, I also call WdfIoQueuePurge.

!devstack 81d8eb48
!DevObj !DrvObj !DevExt ObjectName
82864560 \Driver\USBSTOR 82864618 00000084
> 81d8eb48 \Driver\panobus 81f94d20 00000083
!DevNode 827cb410 :
DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”
ServiceName is “USBSTOR”


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 11:52 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] KMDF Stuck Device

What is the stack that is loaded on your PDO? E.g. !devstack 81d8eb48 will give you this answer. Is the FDO loaded on your PDO also WDF? If so, you can run !wdfdevice on this downstream FDO as well.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, April 08, 2008 11:47 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF Stuck Device

I had reported this problem a while back and I think never found the solution and never sent the correct data to the forum. I’m trying to figure out why this PDO is stuck on top of my bus driver. It has the WdfDevStatePnpFailedWaitForRemove state. The device was working fine and it was surprise removed and then it get stuck. There are no open handles to the device. (not that I know of). What can I do to recover from this situation?

!wdfdevice 0x7E06B4A0 0xf

Dumping WDFDEVICE 0x7e06b4a0
=================================

WDM PDEVICE_OBJECTs: self 81d8eb48

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )
Power state: 315 ( WdfDevStatePowerStopped )
Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6e3bf0
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:
[0] WdfDevStatePnpHardwareAvailable (0x108)
[1] WdfDevStatePnpEnableInterfaces (0x109)
[2] WdfDevStatePnpStarted (0x119)
[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)
[4] WdfDevStatePnpFailedIoStarting (0x129)
[5] WdfDevStatePnpFailedOwnHardware (0x12a)
[6] WdfDevStatePnpFailed (0x12b)
[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:
[0] WdfDevStatePowerD0Starting (0x30f)
[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)
[2] WdfDevStatePowerD0StartingDmaEnable (0x311)
[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)
[4] WdfDevStatePowerDecideD0State (0x313)
[5] WdfDevStatePowerD0BusWakeOwner (0x309)
[6] WdfDevStatePowerGotoD3Stopped (0x314)
[7] WdfDevStatePowerStopped (0x315)

Power policy state history:
[0] WdfDevStatePwrPolObjectCreated (0x500)
[1] WdfDevStatePwrPolStarting (0x501)
[2] WdfDevStatePwrPolStarted (0x565)
[3] WdfDevStatePwrPolStartingSucceeded (0x502)
[4] WdfDevStatePwrPolStopping (0x55b)
[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)
[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)
[7] WdfDevStatePwrPolStopped (0x563)

!wdfqueue 0x7DE6F850
ERROR: Module load completed but symbols could not be loaded for vpc-s3.sys
WARNING: Unable to verify timestamp for vpc-s3.dll
ERROR: Module load completed but symbols could not be loaded for vpc-s3.dll
WARNING: Unable to verify timestamp for ATMFD.DLL
ERROR: Module load completed but symbols could not be loaded for ATMFD.DLL
ERROR: Module load completed but symbols could not be loaded for MRxVPC.sys
*** ERROR: Module load completed but symbols could not be loaded for vmsrvc.sys

Dumping WDFQUEUE 0x7de6f850
=========================
Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0

EvtIoDefault: (0xf74786b0) panobus!Device_EvtIoDefault
EvtIoRead: (0xf7478700) panobus!Device_EvtIoRead
EvtIoWrite: (0xf7478730) panobus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf7478790) panobus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf7478a00) panobus!Device_EvtIoInternalDeviceControl
EvtIoCanceledOnQueue: (0xf7478760) panobus!Device_EvtIoCancelled


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, November 27, 2007 10:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] KMDF Stuck Device

The PDO is waiting for the remove irp to show up. either the PDO failed the start irp b/c one of your power up routines returned !NT_SUCCESS or you successfully started and then the PDO was reported as failed or missing. Can you rerun !wdfdevice and specify 0xF as the flags and send the output? For instance !wdfdevice 0x7cfb9820 0xF. This will show the history of the pnp state machine which should be able to indicate if it was a failed start or a s.r.

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Tuesday, November 27, 2007 3:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF Stuck Device

I have a bus driver that creates virtual devices. Once in a while a device gets stuck…(i.e gone from device manager but not gone from a system perspective). Here is the dump from WinDBG. Its stuck in WdfDevStatePnpFailedWaitForRemove.
My question is two part:

1. How does this happen?
2. What can I do to recover from this?

!wdfkd.WDFDEVICE 0x7cfb9820

Dumping WDFDEVICE 0x7cfb9820
=================================

WDM PDEVICE_OBJECTs: self 83084d28

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )
Power state: 315 ( WdfDevStatePowerStopped )
Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7cfc9bf0
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Thanks
Pankaj


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


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


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


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


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

Doron,

Here is the output for all the commands again…values are different
because I had to reproduce it again. Devnodes command shows its stuck in
DeviceNodeDeletePendingCloses.

This was a mass storage device that shows up as a drive in explorer.
There was only one instance of windows explorer running. But I can plug
and unplug the drive many times with explorer running and this only
happens 10% of the times. Also after this, I killed my explorer window
so it released any handles it was holding and that didn’t help.

Another important this is that I registered all PNP call backs and I got

PanoBus!Entered Bus_PdoEvtDeviceSurpriseRemoval

PanoBus!Entered Bus_PdoEvtSelfManagedIoSuspend

PanoBus!Entered Bus_PdoEvtSelfManagedIoFlush

Usually I would get PanoBus!Entered Bus_PdoEvtSelfManagedIoCleanup after
the Flush but it didn’t happen this time. May be that’s a clue. There
are no pending requests at all from the FDO as you can see in the
!Wdfqueue output below. I’m quite perplexed about this.

!wdfdevice 0x7D9184A0 0xf

Dumping WDFDEVICE 0x7d9184a0

=================================

WDM PDEVICE_OBJECTs: self 827be318

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )

Power state: 315 ( WdfDevStatePowerStopped )

Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6f3fb0

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:

[0] WdfDevStatePnpHardwareAvailable (0x108)

[1] WdfDevStatePnpEnableInterfaces (0x109)

[2] WdfDevStatePnpStarted (0x119)

[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)

[4] WdfDevStatePnpFailedIoStarting (0x129)

[5] WdfDevStatePnpFailedOwnHardware (0x12a)

[6] WdfDevStatePnpFailed (0x12b)

[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:

[0] WdfDevStatePowerD0Starting (0x30f)

[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)

[2] WdfDevStatePowerD0StartingDmaEnable (0x311)

[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)

[4] WdfDevStatePowerDecideD0State (0x313)

[5] WdfDevStatePowerD0BusWakeOwner (0x309)

[6] WdfDevStatePowerGotoD3Stopped (0x314)

[7] WdfDevStatePowerStopped (0x315)

Power policy state history:

[0] WdfDevStatePwrPolObjectCreated (0x500)

[1] WdfDevStatePwrPolStarting (0x501)

[2] WdfDevStatePwrPolStarted (0x565)

[3] WdfDevStatePwrPolStartingSucceeded (0x502)

[4] WdfDevStatePwrPolStopping (0x55b)

[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)

[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)

[7] WdfDevStatePwrPolStopped (0x563)

Properties:

SynchronizationScope: WdfSynchronizationScopeNone

ExecutionLevel: WdfExecutionLevelDispatch

IoType: WdfDeviceIoBuffered

FileObjectClass: WdfFileObjectNotRequired

Exclusive: No

AutoForwardCleanupClose: No

DefaultIoPriorityBoot: 0

kd> !devstack 0x827be318

!DevObj !DrvObj !DevExt ObjectName

826eabc8 \Driver\USBSTOR 826eac80 000000a2

827be318 \Driver\panobus 826e7d20 000000a1

!DevNode 82917600 :

DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”

ServiceName is “USBSTOR”

kd>

kd> !DevNode 82917600 0xf

DevNode 0x82917600 for PDO 0x827be318

InstancePath is “USB\Vid_054c&Pid_0243\OF06051608545”

ServiceName is “USBSTOR”

State = DeviceNodeDeletePendingCloses (0x313)

Previous State = DeviceNodeStarted (0x308)

Kd> !locks

**** DUMP OF ALL RESOURCE OBJECTS ****

KD: Scanning for held
locks…

Resource @ 0x829c4388 Shared 1 owning threads

Threads: 82bb8b33-01<*> *** Actual Thread 82bb8b30

KD: Scanning for held locks.

Resource @ 0x82835dc8 Shared 1 owning threads

Threads: 82bb8b33-01<*> *** Actual Thread 82bb8b30

4043 total locks, 2 locks currently held

kd> !thread 82bb8b30

THREAD 82bb8b30 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000
WAIT: (WrQueue) UserMode Non-Alertable

80561640 Unknown

Not impersonating

DeviceMap e1004540

Owning Process 82bbb830 Image: System

Wait Start TickCount 184337 Ticks: 85 (0:00:00:00.851)

Context Switch Count 2641

UserTime 00:00:00.000

KernelTime 00:00:00.260

Start Address nt!ExpWorkerThread (0x804e4196)

Stack Init f7929000 Current f7928d1c Base f7929000 Limit f7926000 Call 0

Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16

ChildEBP RetAddr Args to Child

f7928d34 804dc0f7 82bb8ba0 82bb8b30 804e407e nt!KiSwapContext+0x2e (FPO:
[Uses EBP] [0,0,4])

f7928d40 804e407e 82bb51e8 80561640 82bb8b30 nt!KiSwapThread+0x46 (FPO:
[0,0,0])

f7928d6c 804e423d 00000001 00000001 00000000 nt!KeRemoveQueue+0x20e
(FPO: [Non-Fpo])

f7928dac 8057d0f1 82bb51e8 00000000 00000000 nt!ExpWorkerThread+0xd6
(FPO: [Non-Fpo])

f7928ddc 804f827a 804e4196 00000000 00000000
nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])

00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

kd> !wdfqueue 0x7D87F580

Dumping WDFQUEUE 0x7d87f580

=========================

Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 0

EvtIoDefault: (0xf7478670) panobus!Device_EvtIoDefault

EvtIoRead: (0xf74786c0) panobus!Device_EvtIoRead

EvtIoWrite: (0xf74786f0) panobus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf7478750) panobus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf74789e0)
panobus!Device_EvtIoInternalDeviceControl

EvtIoCanceledOnQueue: (0xf7478720) panobus!Device_EvtIoCancelled


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 10:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

what is the output of !devnode (in this case !DevNode
827cb410))? You may need to specify some flags (0xF) to to the command
for it to dump the devnode’s state and history.

Also, run !locks. that will tell you if the pnp lock is being held, and
if so, by which thread which you then switch to with .thread
and then see if someone is blocking on the pnp remove irp

d

When this repros, run !devhandles for both the FDO and PDO. This may take a while to run, hopefully it works with public symbols. This will walk each process’s handle table and look for handles open against the device object. Since both the fdo and pdo are named, you have to search on both your PDO and the usbstor’s FDO device object pointers

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Wednesday, April 09, 2008 1:15 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

Doron,

Here is the output for all the commands again…values are different because I had to reproduce it again. Devnodes command shows its stuck in DeviceNodeDeletePendingCloses.
This was a mass storage device that shows up as a drive in explorer. There was only one instance of windows explorer running. But I can plug and unplug the drive many times with explorer running and this only happens 10% of the times. Also after this, I killed my explorer window so it released any handles it was holding and that didn’t help.

Another important this is that I registered all PNP call backs and I got

PanoBus!Entered Bus_PdoEvtDeviceSurpriseRemoval
PanoBus!Entered Bus_PdoEvtSelfManagedIoSuspend
PanoBus!Entered Bus_PdoEvtSelfManagedIoFlush

Usually I would get PanoBus!Entered Bus_PdoEvtSelfManagedIoCleanup after the Flush but it didn’t happen this time. May be that’s a clue. There are no pending requests at all from the FDO as you can see in the !Wdfqueue output below. I’m quite perplexed about this.

!wdfdevice 0x7D9184A0 0xf

Dumping WDFDEVICE 0x7d9184a0
=================================

WDM PDEVICE_OBJECTs: self 827be318

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )
Power state: 315 ( WdfDevStatePowerStopped )
Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6f3fb0
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:
[0] WdfDevStatePnpHardwareAvailable (0x108)
[1] WdfDevStatePnpEnableInterfaces (0x109)
[2] WdfDevStatePnpStarted (0x119)
[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)
[4] WdfDevStatePnpFailedIoStarting (0x129)
[5] WdfDevStatePnpFailedOwnHardware (0x12a)
[6] WdfDevStatePnpFailed (0x12b)
[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:
[0] WdfDevStatePowerD0Starting (0x30f)
[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)
[2] WdfDevStatePowerD0StartingDmaEnable (0x311)
[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)
[4] WdfDevStatePowerDecideD0State (0x313)
[5] WdfDevStatePowerD0BusWakeOwner (0x309)
[6] WdfDevStatePowerGotoD3Stopped (0x314)
[7] WdfDevStatePowerStopped (0x315)

Power policy state history:
[0] WdfDevStatePwrPolObjectCreated (0x500)
[1] WdfDevStatePwrPolStarting (0x501)
[2] WdfDevStatePwrPolStarted (0x565)
[3] WdfDevStatePwrPolStartingSucceeded (0x502)
[4] WdfDevStatePwrPolStopping (0x55b)
[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)
[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)
[7] WdfDevStatePwrPolStopped (0x563)

Properties:
SynchronizationScope: WdfSynchronizationScopeNone
ExecutionLevel: WdfExecutionLevelDispatch
IoType: WdfDeviceIoBuffered
FileObjectClass: WdfFileObjectNotRequired
Exclusive: No
AutoForwardCleanupClose: No
DefaultIoPriorityBoot: 0

kd> !devstack 0x827be318
!DevObj !DrvObj !DevExt ObjectName
826eabc8 \Driver\USBSTOR 826eac80 000000a2
> 827be318 \Driver\panobus 826e7d20 000000a1
!DevNode 82917600 :
DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”
ServiceName is “USBSTOR”
kd>
kd> !DevNode 82917600 0xf
DevNode 0x82917600 for PDO 0x827be318
InstancePath is “USB\Vid_054c&Pid_0243\OF06051608545”
ServiceName is “USBSTOR”
State = DeviceNodeDeletePendingCloses (0x313)
Previous State = DeviceNodeStarted (0x308)

Kd> !locks
DUMP OF ALL RESOURCE OBJECTS
KD: Scanning for held locks…

Resource @ 0x829c4388 Shared 1 owning threads
Threads: 82bb8b33-01<> Actual Thread 82bb8b30
KD: Scanning for held locks.

Resource @ 0x82835dc8 Shared 1 owning threads
Threads: 82bb8b33-01<
>
Actual Thread 82bb8b30
4043 total locks, 2 locks currently held
kd> !thread 82bb8b30
THREAD 82bb8b30 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000 WAIT: (WrQueue) UserMode Non-Alertable
80561640 Unknown
Not impersonating
DeviceMap e1004540
Owning Process 82bbb830 Image: System
Wait Start TickCount 184337 Ticks: 85 (0:00:00:00.851)
Context Switch Count 2641
UserTime 00:00:00.000
KernelTime 00:00:00.260
Start Address nt!ExpWorkerThread (0x804e4196)
Stack Init f7929000 Current f7928d1c Base f7929000 Limit f7926000 Call 0
Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr Args to Child
f7928d34 804dc0f7 82bb8ba0 82bb8b30 804e407e nt!KiSwapContext+0x2e (FPO: [Uses EBP] [0,0,4])
f7928d40 804e407e 82bb51e8 80561640 82bb8b30 nt!KiSwapThread+0x46 (FPO: [0,0,0])
f7928d6c 804e423d 00000001 00000001 00000000 nt!KeRemoveQueue+0x20e (FPO: [Non-Fpo])
f7928dac 8057d0f1 82bb51e8 00000000 00000000 nt!ExpWorkerThread+0xd6 (FPO: [Non-Fpo])
f7928ddc 804f827a 804e4196 00000000 00000000 nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

kd> !wdfqueue 0x7D87F580

Dumping WDFQUEUE 0x7d87f580
=========================
Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0

EvtIoDefault: (0xf7478670) panobus!Device_EvtIoDefault
EvtIoRead: (0xf74786c0) panobus!Device_EvtIoRead
EvtIoWrite: (0xf74786f0) panobus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf7478750) panobus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf74789e0) panobus!Device_EvtIoInternalDeviceControl
EvtIoCanceledOnQueue: (0xf7478720) panobus!Device_EvtIoCancelled

________________________________
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 10:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

what is the output of !devnode (in this case !DevNode 827cb410))? You may need to specify some flags (0xF) to to the command for it to dump the devnode’s state and history.

Also, run !locks. that will tell you if the pnp lock is being held, and if so, by which thread which you then switch to with .thread and then see if someone is blocking on the pnp remove irp

d


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 got nothing. For both the command stopped like this after going for a
few mins.

Checking handle table for process 0x827c1168

00000000: Unable to read handle table

No handles found.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, April 09, 2008 2:57 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

When this repros, run !devhandles for both the FDO and
PDO. This may take a while to run, hopefully it works with public
symbols. This will walk each process’s handle table and look for
handles open against the device object. Since both the fdo and pdo are
named, you have to search on both your PDO and the usbstor’s FDO device
object pointers

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Wednesday, April 09, 2008 1:15 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

Doron,

Here is the output for all the commands again…values are different
because I had to reproduce it again. Devnodes command shows its stuck in
DeviceNodeDeletePendingCloses.

This was a mass storage device that shows up as a drive in explorer.
There was only one instance of windows explorer running. But I can plug
and unplug the drive many times with explorer running and this only
happens 10% of the times. Also after this, I killed my explorer window
so it released any handles it was holding and that didn’t help.

Another important this is that I registered all PNP call backs and I got

PanoBus!Entered Bus_PdoEvtDeviceSurpriseRemoval

PanoBus!Entered Bus_PdoEvtSelfManagedIoSuspend

PanoBus!Entered Bus_PdoEvtSelfManagedIoFlush

Usually I would get PanoBus!Entered Bus_PdoEvtSelfManagedIoCleanup after
the Flush but it didn’t happen this time. May be that’s a clue. There
are no pending requests at all from the FDO as you can see in the
!Wdfqueue output below. I’m quite perplexed about this.

!wdfdevice 0x7D9184A0 0xf

Dumping WDFDEVICE 0x7d9184a0

=================================

WDM PDEVICE_OBJECTs: self 827be318

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )

Power state: 315 ( WdfDevStatePowerStopped )

Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6f3fb0

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:

[0] WdfDevStatePnpHardwareAvailable (0x108)

[1] WdfDevStatePnpEnableInterfaces (0x109)

[2] WdfDevStatePnpStarted (0x119)

[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)

[4] WdfDevStatePnpFailedIoStarting (0x129)

[5] WdfDevStatePnpFailedOwnHardware (0x12a)

[6] WdfDevStatePnpFailed (0x12b)

[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:

[0] WdfDevStatePowerD0Starting (0x30f)

[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)

[2] WdfDevStatePowerD0StartingDmaEnable (0x311)

[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)

[4] WdfDevStatePowerDecideD0State (0x313)

[5] WdfDevStatePowerD0BusWakeOwner (0x309)

[6] WdfDevStatePowerGotoD3Stopped (0x314)

[7] WdfDevStatePowerStopped (0x315)

Power policy state history:

[0] WdfDevStatePwrPolObjectCreated (0x500)

[1] WdfDevStatePwrPolStarting (0x501)

[2] WdfDevStatePwrPolStarted (0x565)

[3] WdfDevStatePwrPolStartingSucceeded (0x502)

[4] WdfDevStatePwrPolStopping (0x55b)

[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)

[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)

[7] WdfDevStatePwrPolStopped (0x563)

Properties:

SynchronizationScope: WdfSynchronizationScopeNone

ExecutionLevel: WdfExecutionLevelDispatch

IoType: WdfDeviceIoBuffered

FileObjectClass: WdfFileObjectNotRequired

Exclusive: No

AutoForwardCleanupClose: No

DefaultIoPriorityBoot: 0

kd> !devstack 0x827be318

!DevObj !DrvObj !DevExt ObjectName

826eabc8 \Driver\USBSTOR 826eac80 000000a2

> 827be318 \Driver\panobus 826e7d20 000000a1

!DevNode 82917600 :

DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”

ServiceName is “USBSTOR”

kd>

kd> !DevNode 82917600 0xf

DevNode 0x82917600 for PDO 0x827be318

InstancePath is “USB\Vid_054c&Pid_0243\OF06051608545”

ServiceName is “USBSTOR”

State = DeviceNodeDeletePendingCloses (0x313)

Previous State = DeviceNodeStarted (0x308)

Kd> !locks

DUMP OF ALL RESOURCE OBJECTS

KD: Scanning for held
locks…


Resource @ 0x829c4388 Shared 1 owning threads

Threads: 82bb8b33-01<> Actual Thread 82bb8b30

KD: Scanning for held locks.

Resource @ 0x82835dc8 Shared 1 owning threads

Threads: 82bb8b33-01<
>
Actual Thread 82bb8b30

4043 total locks, 2 locks currently held

kd> !thread 82bb8b30

THREAD 82bb8b30 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000
WAIT: (WrQueue) UserMode Non-Alertable

80561640 Unknown

Not impersonating

DeviceMap e1004540

Owning Process 82bbb830 Image: System

Wait Start TickCount 184337 Ticks: 85 (0:00:00:00.851)

Context Switch Count 2641

UserTime 00:00:00.000

KernelTime 00:00:00.260

Start Address nt!ExpWorkerThread (0x804e4196)

Stack Init f7929000 Current f7928d1c Base f7929000 Limit f7926000 Call 0

Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16

ChildEBP RetAddr Args to Child

f7928d34 804dc0f7 82bb8ba0 82bb8b30 804e407e nt!KiSwapContext+0x2e (FPO:
[Uses EBP] [0,0,4])

f7928d40 804e407e 82bb51e8 80561640 82bb8b30 nt!KiSwapThread+0x46 (FPO:
[0,0,0])

f7928d6c 804e423d 00000001 00000001 00000000 nt!KeRemoveQueue+0x20e
(FPO: [Non-Fpo])

f7928dac 8057d0f1 82bb51e8 00000000 00000000 nt!ExpWorkerThread+0xd6
(FPO: [Non-Fpo])

f7928ddc 804f827a 804e4196 00000000 00000000
nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])

00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

kd> !wdfqueue 0x7D87F580

Dumping WDFQUEUE 0x7d87f580

=========================

Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 0

EvtIoDefault: (0xf7478670) panobus!Device_EvtIoDefault

EvtIoRead: (0xf74786c0) panobus!Device_EvtIoRead

EvtIoWrite: (0xf74786f0) panobus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf7478750) panobus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf74789e0)
panobus!Device_EvtIoInternalDeviceControl

EvtIoCanceledOnQueue: (0xf7478720) panobus!Device_EvtIoCancelled

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 10:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

what is the output of !devnode (in this case !DevNode
827cb410))? You may need to specify some flags (0xF) to to the command
for it to dump the devnode’s state and history.

Also, run !locks. that will tell you if the pnp lock is being held, and
if so, by which thread which you then switch to with .thread
and then see if someone is blocking on the pnp remove irp

d


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


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

Perhaps you can track the handles as they are opened. !drvobj 3 will give you the IRP_MJ_CREATE and MJ_CLEANUP dispatch routines. Put a bp on these 2 and look at the stack to see who is opening the handle, something like this may work

bp “.reload /user;kb;g”

this will break in, reload user symbols for the current context, dump the stack (hopefully back into the um process) and then proceed. Hopefully it does not slow down the machine too much ;). After you have those 2 bp’s, you can then manually match up the handles that are being opened and closed from the output in the debugger and see who is orphaning the handle

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Wednesday, April 09, 2008 3:38 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

I got nothing. For both the command stopped like this after going for a few mins.

Checking handle table for process 0x827c1168
00000000: Unable to read handle table

No handles found.


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, April 09, 2008 2:57 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

When this repros, run !devhandles for both the FDO and PDO. This may take a while to run, hopefully it works with public symbols. This will walk each process’s handle table and look for handles open against the device object. Since both the fdo and pdo are named, you have to search on both your PDO and the usbstor’s FDO device object pointers

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Wednesday, April 09, 2008 1:15 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

Doron,

Here is the output for all the commands again…values are different because I had to reproduce it again. Devnodes command shows its stuck in DeviceNodeDeletePendingCloses.
This was a mass storage device that shows up as a drive in explorer. There was only one instance of windows explorer running. But I can plug and unplug the drive many times with explorer running and this only happens 10% of the times. Also after this, I killed my explorer window so it released any handles it was holding and that didn’t help.

Another important this is that I registered all PNP call backs and I got

PanoBus!Entered Bus_PdoEvtDeviceSurpriseRemoval
PanoBus!Entered Bus_PdoEvtSelfManagedIoSuspend
PanoBus!Entered Bus_PdoEvtSelfManagedIoFlush

Usually I would get PanoBus!Entered Bus_PdoEvtSelfManagedIoCleanup after the Flush but it didn’t happen this time. May be that’s a clue. There are no pending requests at all from the FDO as you can see in the !Wdfqueue output below. I’m quite perplexed about this.

!wdfdevice 0x7D9184A0 0xf

Dumping WDFDEVICE 0x7d9184a0
=================================

WDM PDEVICE_OBJECTs: self 827be318

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )
Power state: 315 ( WdfDevStatePowerStopped )
Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6f3fb0
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:
[0] WdfDevStatePnpHardwareAvailable (0x108)
[1] WdfDevStatePnpEnableInterfaces (0x109)
[2] WdfDevStatePnpStarted (0x119)
[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)
[4] WdfDevStatePnpFailedIoStarting (0x129)
[5] WdfDevStatePnpFailedOwnHardware (0x12a)
[6] WdfDevStatePnpFailed (0x12b)
[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:
[0] WdfDevStatePowerD0Starting (0x30f)
[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)
[2] WdfDevStatePowerD0StartingDmaEnable (0x311)
[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)
[4] WdfDevStatePowerDecideD0State (0x313)
[5] WdfDevStatePowerD0BusWakeOwner (0x309)
[6] WdfDevStatePowerGotoD3Stopped (0x314)
[7] WdfDevStatePowerStopped (0x315)

Power policy state history:
[0] WdfDevStatePwrPolObjectCreated (0x500)
[1] WdfDevStatePwrPolStarting (0x501)
[2] WdfDevStatePwrPolStarted (0x565)
[3] WdfDevStatePwrPolStartingSucceeded (0x502)
[4] WdfDevStatePwrPolStopping (0x55b)
[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)
[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)
[7] WdfDevStatePwrPolStopped (0x563)

Properties:
SynchronizationScope: WdfSynchronizationScopeNone
ExecutionLevel: WdfExecutionLevelDispatch
IoType: WdfDeviceIoBuffered
FileObjectClass: WdfFileObjectNotRequired
Exclusive: No
AutoForwardCleanupClose: No
DefaultIoPriorityBoot: 0

kd> !devstack 0x827be318
!DevObj !DrvObj !DevExt ObjectName
826eabc8 \Driver\USBSTOR 826eac80 000000a2
> 827be318 \Driver\panobus 826e7d20 000000a1
!DevNode 82917600 :
DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”
ServiceName is “USBSTOR”
kd>
kd> !DevNode 82917600 0xf
DevNode 0x82917600 for PDO 0x827be318
InstancePath is “USB\Vid_054c&Pid_0243\OF06051608545”
ServiceName is “USBSTOR”
State = DeviceNodeDeletePendingCloses (0x313)
Previous State = DeviceNodeStarted (0x308)

Kd> !locks
DUMP OF ALL RESOURCE OBJECTS
KD: Scanning for held locks…

Resource @ 0x829c4388 Shared 1 owning threads
Threads: 82bb8b33-01<> Actual Thread 82bb8b30
KD: Scanning for held locks.

Resource @ 0x82835dc8 Shared 1 owning threads
Threads: 82bb8b33-01<
>
Actual Thread 82bb8b30
4043 total locks, 2 locks currently held
kd> !thread 82bb8b30
THREAD 82bb8b30 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000 WAIT: (WrQueue) UserMode Non-Alertable
80561640 Unknown
Not impersonating
DeviceMap e1004540
Owning Process 82bbb830 Image: System
Wait Start TickCount 184337 Ticks: 85 (0:00:00:00.851)
Context Switch Count 2641
UserTime 00:00:00.000
KernelTime 00:00:00.260
Start Address nt!ExpWorkerThread (0x804e4196)
Stack Init f7929000 Current f7928d1c Base f7929000 Limit f7926000 Call 0
Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr Args to Child
f7928d34 804dc0f7 82bb8ba0 82bb8b30 804e407e nt!KiSwapContext+0x2e (FPO: [Uses EBP] [0,0,4])
f7928d40 804e407e 82bb51e8 80561640 82bb8b30 nt!KiSwapThread+0x46 (FPO: [0,0,0])
f7928d6c 804e423d 00000001 00000001 00000000 nt!KeRemoveQueue+0x20e (FPO: [Non-Fpo])
f7928dac 8057d0f1 82bb51e8 00000000 00000000 nt!ExpWorkerThread+0xd6 (FPO: [Non-Fpo])
f7928ddc 804f827a 804e4196 00000000 00000000 nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

kd> !wdfqueue 0x7D87F580

Dumping WDFQUEUE 0x7d87f580
=========================
Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0

EvtIoDefault: (0xf7478670) panobus!Device_EvtIoDefault
EvtIoRead: (0xf74786c0) panobus!Device_EvtIoRead
EvtIoWrite: (0xf74786f0) panobus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf7478750) panobus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf74789e0) panobus!Device_EvtIoInternalDeviceControl
EvtIoCanceledOnQueue: (0xf7478720) panobus!Device_EvtIoCancelled


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 10:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

what is the output of !devnode (in this case !DevNode 827cb410))? You may need to specify some flags (0xF) to to the command for it to dump the devnode’s state and history.

Also, run !locks. that will tell you if the pnp lock is being held, and if so, by which thread which you then switch to with .thread and then see if someone is blocking on the pnp remove irp

d


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


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


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

Also now that I’m in WdfDevStatePnpFailedWaitForRemove, can I somehow
recover from this? I’m not seeing anyway of coming out of it. I killed
all my apps etc just to see if some handle gets freed and this device
goes away but it doesn’t help. Is there any kmdf call that can help me
get out of this state because I can add code to detect that I’m in this
stuck state and try some cleanup code.

I’m not even seeing any difference (prior to the point where problem
shows up) between a good cleanup vs this stuck device.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, April 09, 2008 2:57 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

When this repros, run !devhandles for both the FDO and
PDO. This may take a while to run, hopefully it works with public
symbols. This will walk each process’s handle table and look for
handles open against the device object. Since both the fdo and pdo are
named, you have to search on both your PDO and the usbstor’s FDO device
object pointers

d

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Wednesday, April 09, 2008 1:15 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

Doron,

Here is the output for all the commands again…values are different
because I had to reproduce it again. Devnodes command shows its stuck in
DeviceNodeDeletePendingCloses.

This was a mass storage device that shows up as a drive in explorer.
There was only one instance of windows explorer running. But I can plug
and unplug the drive many times with explorer running and this only
happens 10% of the times. Also after this, I killed my explorer window
so it released any handles it was holding and that didn’t help.

Another important this is that I registered all PNP call backs and I got

PanoBus!Entered Bus_PdoEvtDeviceSurpriseRemoval

PanoBus!Entered Bus_PdoEvtSelfManagedIoSuspend

PanoBus!Entered Bus_PdoEvtSelfManagedIoFlush

Usually I would get PanoBus!Entered Bus_PdoEvtSelfManagedIoCleanup after
the Flush but it didn’t happen this time. May be that’s a clue. There
are no pending requests at all from the FDO as you can see in the
!Wdfqueue output below. I’m quite perplexed about this.

!wdfdevice 0x7D9184A0 0xf

Dumping WDFDEVICE 0x7d9184a0

=================================

WDM PDEVICE_OBJECTs: self 827be318

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )

Power state: 315 ( WdfDevStatePowerStopped )

Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6f3fb0

Parent states:

Pnp state: 119 ( WdfDevStatePnpStarted )

Power state: 307 ( WdfDevStatePowerD0 )

Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:

[0] WdfDevStatePnpHardwareAvailable (0x108)

[1] WdfDevStatePnpEnableInterfaces (0x109)

[2] WdfDevStatePnpStarted (0x119)

[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)

[4] WdfDevStatePnpFailedIoStarting (0x129)

[5] WdfDevStatePnpFailedOwnHardware (0x12a)

[6] WdfDevStatePnpFailed (0x12b)

[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:

[0] WdfDevStatePowerD0Starting (0x30f)

[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)

[2] WdfDevStatePowerD0StartingDmaEnable (0x311)

[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)

[4] WdfDevStatePowerDecideD0State (0x313)

[5] WdfDevStatePowerD0BusWakeOwner (0x309)

[6] WdfDevStatePowerGotoD3Stopped (0x314)

[7] WdfDevStatePowerStopped (0x315)

Power policy state history:

[0] WdfDevStatePwrPolObjectCreated (0x500)

[1] WdfDevStatePwrPolStarting (0x501)

[2] WdfDevStatePwrPolStarted (0x565)

[3] WdfDevStatePwrPolStartingSucceeded (0x502)

[4] WdfDevStatePwrPolStopping (0x55b)

[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)

[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)

[7] WdfDevStatePwrPolStopped (0x563)

Properties:

SynchronizationScope: WdfSynchronizationScopeNone

ExecutionLevel: WdfExecutionLevelDispatch

IoType: WdfDeviceIoBuffered

FileObjectClass: WdfFileObjectNotRequired

Exclusive: No

AutoForwardCleanupClose: No

DefaultIoPriorityBoot: 0

kd> !devstack 0x827be318

!DevObj !DrvObj !DevExt ObjectName

826eabc8 \Driver\USBSTOR 826eac80 000000a2

> 827be318 \Driver\panobus 826e7d20 000000a1

!DevNode 82917600 :

DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”

ServiceName is “USBSTOR”

kd>

kd> !DevNode 82917600 0xf

DevNode 0x82917600 for PDO 0x827be318

InstancePath is “USB\Vid_054c&Pid_0243\OF06051608545”

ServiceName is “USBSTOR”

State = DeviceNodeDeletePendingCloses (0x313)

Previous State = DeviceNodeStarted (0x308)

Kd> !locks

DUMP OF ALL RESOURCE OBJECTS

KD: Scanning for held
locks…


Resource @ 0x829c4388 Shared 1 owning threads

Threads: 82bb8b33-01<> Actual Thread 82bb8b30

KD: Scanning for held locks.

Resource @ 0x82835dc8 Shared 1 owning threads

Threads: 82bb8b33-01<
>
Actual Thread 82bb8b30

4043 total locks, 2 locks currently held

kd> !thread 82bb8b30

THREAD 82bb8b30 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000
WAIT: (WrQueue) UserMode Non-Alertable

80561640 Unknown

Not impersonating

DeviceMap e1004540

Owning Process 82bbb830 Image: System

Wait Start TickCount 184337 Ticks: 85 (0:00:00:00.851)

Context Switch Count 2641

UserTime 00:00:00.000

KernelTime 00:00:00.260

Start Address nt!ExpWorkerThread (0x804e4196)

Stack Init f7929000 Current f7928d1c Base f7929000 Limit f7926000 Call 0

Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16

ChildEBP RetAddr Args to Child

f7928d34 804dc0f7 82bb8ba0 82bb8b30 804e407e nt!KiSwapContext+0x2e (FPO:
[Uses EBP] [0,0,4])

f7928d40 804e407e 82bb51e8 80561640 82bb8b30 nt!KiSwapThread+0x46 (FPO:
[0,0,0])

f7928d6c 804e423d 00000001 00000001 00000000 nt!KeRemoveQueue+0x20e
(FPO: [Non-Fpo])

f7928dac 8057d0f1 82bb51e8 00000000 00000000 nt!ExpWorkerThread+0xd6
(FPO: [Non-Fpo])

f7928ddc 804f827a 804e4196 00000000 00000000
nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])

00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

kd> !wdfqueue 0x7D87F580

Dumping WDFQUEUE 0x7d87f580

=========================

Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch,
ExecutionLevelDispatch, SynchronizationScopeNone

Number of driver owned requests: 0

Number of waiting requests: 0

EvtIoDefault: (0xf7478670) panobus!Device_EvtIoDefault

EvtIoRead: (0xf74786c0) panobus!Device_EvtIoRead

EvtIoWrite: (0xf74786f0) panobus!Device_EvtIoWrite

EvtIoDeviceControl: (0xf7478750) panobus!Device_EvtIoDeviceControl

EvtIoInternalDeviceControl: (0xf74789e0)
panobus!Device_EvtIoInternalDeviceControl

EvtIoCanceledOnQueue: (0xf7478720) panobus!Device_EvtIoCancelled

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 10:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

what is the output of !devnode (in this case !DevNode
827cb410))? You may need to specify some flags (0xF) to to the command
for it to dump the devnode’s state and history.

Also, run !locks. that will tell you if the pnp lock is being held, and
if so, by which thread which you then switch to with .thread
and then see if someone is blocking on the pnp remove irp

d


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


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

This state is a pnp state based on the pnp irps that the pnp manager has sent. You are in the surprise removed state, waiting for the final handle to be closed and go to the removed state. there is nothing you could do in KMDF or WDM to move to the removed state. note that even if you find the leaked handle here, you will still have to handle this state where you have 1+N PDOs for the same physical device. one will be in the started state and the remaining N PDOs can be in the surprise removed state until the final handle is closed (if ever)

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Wednesday, April 09, 2008 3:57 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

Also now that I’m in WdfDevStatePnpFailedWaitForRemove, can I somehow recover from this? I’m not seeing anyway of coming out of it. I killed all my apps etc just to see if some handle gets freed and this device goes away but it doesn’t help. Is there any kmdf call that can help me get out of this state because I can add code to detect that I’m in this stuck state and try some cleanup code.

I’m not even seeing any difference (prior to the point where problem shows up) between a good cleanup vs this stuck device.


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, April 09, 2008 2:57 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

When this repros, run !devhandles for both the FDO and PDO. This may take a while to run, hopefully it works with public symbols. This will walk each process’s handle table and look for handles open against the device object. Since both the fdo and pdo are named, you have to search on both your PDO and the usbstor’s FDO device object pointers

d

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pankaj Garg
Sent: Wednesday, April 09, 2008 1:15 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

Doron,

Here is the output for all the commands again…values are different because I had to reproduce it again. Devnodes command shows its stuck in DeviceNodeDeletePendingCloses.
This was a mass storage device that shows up as a drive in explorer. There was only one instance of windows explorer running. But I can plug and unplug the drive many times with explorer running and this only happens 10% of the times. Also after this, I killed my explorer window so it released any handles it was holding and that didn’t help.

Another important this is that I registered all PNP call backs and I got

PanoBus!Entered Bus_PdoEvtDeviceSurpriseRemoval
PanoBus!Entered Bus_PdoEvtSelfManagedIoSuspend
PanoBus!Entered Bus_PdoEvtSelfManagedIoFlush

Usually I would get PanoBus!Entered Bus_PdoEvtSelfManagedIoCleanup after the Flush but it didn’t happen this time. May be that’s a clue. There are no pending requests at all from the FDO as you can see in the !Wdfqueue output below. I’m quite perplexed about this.

!wdfdevice 0x7D9184A0 0xf

Dumping WDFDEVICE 0x7d9184a0
=================================

WDM PDEVICE_OBJECTs: self 827be318

Pnp state: 12e ( WdfDevStatePnpFailedWaitForRemove )
Power state: 315 ( WdfDevStatePowerStopped )
Power Pol state: 563 ( WdfDevStatePwrPolStopped )

Parent WDFDEVICE 7d6f3fb0
Parent states:
Pnp state: 119 ( WdfDevStatePnpStarted )
Power state: 307 ( WdfDevStatePowerD0 )
Power Pol state: 565 ( WdfDevStatePwrPolStarted )

No pended pnp or power irps

Pnp state history:
[0] WdfDevStatePnpHardwareAvailable (0x108)
[1] WdfDevStatePnpEnableInterfaces (0x109)
[2] WdfDevStatePnpStarted (0x119)
[3] WdfDevStatePnpSurpriseRemoveIoStarted (0x127)
[4] WdfDevStatePnpFailedIoStarting (0x129)
[5] WdfDevStatePnpFailedOwnHardware (0x12a)
[6] WdfDevStatePnpFailed (0x12b)
[7] WdfDevStatePnpFailedWaitForRemove (0x12e)

Power state history:
[0] WdfDevStatePowerD0Starting (0x30f)
[1] WdfDevStatePowerD0StartingConnectInterrupt (0x310)
[2] WdfDevStatePowerD0StartingDmaEnable (0x311)
[3] WdfDevStatePowerD0StartingStartSelfManagedIo (0x312)
[4] WdfDevStatePowerDecideD0State (0x313)
[5] WdfDevStatePowerD0BusWakeOwner (0x309)
[6] WdfDevStatePowerGotoD3Stopped (0x314)
[7] WdfDevStatePowerStopped (0x315)

Power policy state history:
[0] WdfDevStatePwrPolObjectCreated (0x500)
[1] WdfDevStatePwrPolStarting (0x501)
[2] WdfDevStatePwrPolStarted (0x565)
[3] WdfDevStatePwrPolStartingSucceeded (0x502)
[4] WdfDevStatePwrPolStopping (0x55b)
[5] WdfDevStatePwrPolStoppingWaitingForImplicitPowerDown (0x579)
[6] WdfDevStatePwrPolStoppingSendStatus (0x55d)
[7] WdfDevStatePwrPolStopped (0x563)

Properties:
SynchronizationScope: WdfSynchronizationScopeNone
ExecutionLevel: WdfExecutionLevelDispatch
IoType: WdfDeviceIoBuffered
FileObjectClass: WdfFileObjectNotRequired
Exclusive: No
AutoForwardCleanupClose: No
DefaultIoPriorityBoot: 0

kd> !devstack 0x827be318
!DevObj !DrvObj !DevExt ObjectName
826eabc8 \Driver\USBSTOR 826eac80 000000a2
> 827be318 \Driver\panobus 826e7d20 000000a1
!DevNode 82917600 :
DeviceInst is “USB\Vid_054c&Pid_0243\OF06051608545”
ServiceName is “USBSTOR”
kd>
kd> !DevNode 82917600 0xf
DevNode 0x82917600 for PDO 0x827be318
InstancePath is “USB\Vid_054c&Pid_0243\OF06051608545”
ServiceName is “USBSTOR”
State = DeviceNodeDeletePendingCloses (0x313)
Previous State = DeviceNodeStarted (0x308)

Kd> !locks
DUMP OF ALL RESOURCE OBJECTS
KD: Scanning for held locks…

Resource @ 0x829c4388 Shared 1 owning threads
Threads: 82bb8b33-01<> Actual Thread 82bb8b30
KD: Scanning for held locks.

Resource @ 0x82835dc8 Shared 1 owning threads
Threads: 82bb8b33-01<
>
Actual Thread 82bb8b30
4043 total locks, 2 locks currently held
kd> !thread 82bb8b30
THREAD 82bb8b30 Cid 0004.0014 Teb: 00000000 Win32Thread: 00000000 WAIT: (WrQueue) UserMode Non-Alertable
80561640 Unknown
Not impersonating
DeviceMap e1004540
Owning Process 82bbb830 Image: System
Wait Start TickCount 184337 Ticks: 85 (0:00:00:00.851)
Context Switch Count 2641
UserTime 00:00:00.000
KernelTime 00:00:00.260
Start Address nt!ExpWorkerThread (0x804e4196)
Stack Init f7929000 Current f7928d1c Base f7929000 Limit f7926000 Call 0
Priority 13 BasePriority 13 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr Args to Child
f7928d34 804dc0f7 82bb8ba0 82bb8b30 804e407e nt!KiSwapContext+0x2e (FPO: [Uses EBP] [0,0,4])
f7928d40 804e407e 82bb51e8 80561640 82bb8b30 nt!KiSwapThread+0x46 (FPO: [0,0,0])
f7928d6c 804e423d 00000001 00000001 00000000 nt!KeRemoveQueue+0x20e (FPO: [Non-Fpo])
f7928dac 8057d0f1 82bb51e8 00000000 00000000 nt!ExpWorkerThread+0xd6 (FPO: [Non-Fpo])
f7928ddc 804f827a 804e4196 00000000 00000000 nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 00000000 00000000 00000000 nt!KiThreadStartup+0x16

kd> !wdfqueue 0x7D87F580

Dumping WDFQUEUE 0x7d87f580
=========================
Parallel, Not power-managed, PowerOn, Cannot accept, Can dispatch, ExecutionLevelDispatch, SynchronizationScopeNone
Number of driver owned requests: 0
Number of waiting requests: 0

EvtIoDefault: (0xf7478670) panobus!Device_EvtIoDefault
EvtIoRead: (0xf74786c0) panobus!Device_EvtIoRead
EvtIoWrite: (0xf74786f0) panobus!Device_EvtIoWrite
EvtIoDeviceControl: (0xf7478750) panobus!Device_EvtIoDeviceControl
EvtIoInternalDeviceControl: (0xf74789e0) panobus!Device_EvtIoInternalDeviceControl
EvtIoCanceledOnQueue: (0xf7478720) panobus!Device_EvtIoCancelled

________________________________
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, April 08, 2008 10:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] KMDF Stuck Device

what is the output of !devnode (in this case !DevNode 827cb410))? You may need to specify some flags (0xF) to to the command for it to dump the devnode’s state and history.

Also, run !locks. that will tell you if the pnp lock is being held, and if so, by which thread which you then switch to with .thread and then see if someone is blocking on the pnp remove irp

d


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


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


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