none
Host controller,using UCX extension, won't unload RRS feed

  • Question

  • Hi,

    We are developing Host Controller driver using UCX extension(WDK version 1709). Currently driver has no specific logic, it just needs to load and unload, with Root Hub as a child. Everything works as expected when there is no Root Hub created, but when we add Root Hub, driver won't unload anymore. If we try to uninstall device from Device Manager it just hang(spin forever). 

    We have empty implementation of all callbacks mentioned in UCX programming reference. Do we need to add some implementation to callbacks in order for host controller(with Root Hub) to unload? Or is there any other callbacks that we need to implement(aside of DriverCleanup and DriverUnload)? 

    Thursday, November 23, 2017 12:35 PM

All replies

  • If disable is hanging in device manager, the driver stack hasn’t completed the pnp remove. You should attach a debugger and dump the stacks (!stacks 0 2) and look for suspicious stacks. Look for stacks where UCx or wdf is waiting.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, November 23, 2017 2:17 PM
  • This is the stack, from the thread, that we believe is hanging :

    Priority 12 BasePriority 12 PriorityDecrement 0 IoPriority 2 PagePriority 5

    Child-SP          RetAddr           : Args to Child                                                           : Call Site

    ffff8b84`49708a50 fffff800`31e82530 : ffff8b84`49708c30 fffff800`00000000 00000000`000000ff fffff800`31f621f5 : nt!KiSwapContext+0x76

    ffff8b84`49708b90 fffff800`31e81eae : ffffb90f`65eee1c0 ffffb90f`65eee2c0 20646574`69617720 6574756e`00000000 : nt!KiSwapThread+0x190

    ffff8b84`49708c50 fffff800`31e81689 : 75482072`00000085 6e50204f`00000000 6361626c`6c614300 ffffb90f`6a825a48 : nt!KiCommitThreadWait+0x10e

    ffff8b84`49708cf0 fffff800`3144a5e5 : ffffb90f`6a825a48 ffffb90f`00000000 00000000`00000000 fffff800`31474e00 : nt!KeWaitForSingleObject+0x1c9

    ffff8b84`49708dd0 fffff800`3142af87 : ffffb90f`6a825a48 00000000`00000005 00000000`00000005 ffffffff`dc3cba00 : UsbHub3!HUBMISC_WaitForSignal+0xb9

    ffff8b84`49708e40 fffff80d`361a49be : ffffb90f`69a6b588 ffffb90f`6a8252e0 00000000`00000000 fffff80d`36189f7a : UsbHub3!HUBFDO_EvtDeviceD0Exit+0x157

    ffff8b84`49708ea0 fffff80d`361a4832 : 00000000`00000000 00000000`00000000 fffff80d`362199a0 00000000`00000000 : Wdf01000!FxPnpDeviceD0Exit::InvokeClient+0x2e [minkernel\wdf\framework\shared\irphandlers\pnp\pnpcallbacks.cpp @ 226]

    ffff8b84`49708f00 fffff80d`3620b58f : 00000000`00000000 00000000`00000001 00000000`00000000 00000000`00000001 : Wdf01000!FxPrePostCallback::InvokeStateless+0x42 [minkernel\wdf\framework\shared\irphandlers\pnp\cxpnppowercallbacks.cpp @ 611]

    (Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : Wdf01000!FxPnpDeviceD0Exit::Invoke+0x14 (Inline Function @ fffff80d`3620b58f) [minkernel\wdf\framework\shared\irphandlers\pnp\pnpcallbacks.cpp @ 202]

    ffff8b84`49708f30 fffff80d`361992c8 : ffffb90f`69a6b020 ffff8b84`49709090 00000000`00000280 00000000`00000000 : Wdf01000!FxPkgPnp::PowerGotoD3Stopped+0x13f [minkernel\wdf\framework\shared\irphandlers\pnp\powerstatemachine.cpp @ 2513]

    (Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : Wdf01000!FxPkgPnp::PowerEnterNewState+0x103 (Inline Function @ fffff80d`361992c8) [minkernel\wdf\framework\shared\irphandlers\pnp\powerstatemachine.cpp @ 1643]

    ffff8b84`49708f90 fffff80d`36198203 : ffffb90f`69a6b220 fffff800`00000000 ffffb90f`69a6b1f8 fffff80d`3621a600 : Wdf01000!FxPkgPnp::PowerProcessEventInner+0x1f8 [minkernel\wdf\framework\shared\irphandlers\pnp\powerstatemachine.cpp @ 1557]

    ffff8b84`49709100 fffff80d`36210dfe : 00000000`00000000 ffffb90f`69a6b020 00000000`00000004 00000000`00000000 : Wdf01000!FxPkgPnp::PowerProcessEvent+0x143 [minkernel\wdf\framework\shared\irphandlers\pnp\powerstatemachine.cpp @ 1338]

    ffff8b84`497091a0 fffff80d`3619cd2f : ffffb90f`69a6b020 00000000`0000055b fffff80d`3621b2a0 00000000`00000000 : Wdf01000!FxPkgPnp::PowerPolStopping+0x1e [minkernel\wdf\framework\shared\irphandlers\pnp\powerpolicystatemachine.cpp @ 6562]

    (Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : Wdf01000!FxPkgPnp::PowerPolicyEnterNewState+0xff (Inline Function @ fffff80d`3619cd2f) [minkernel\wdf\framework\shared\irphandlers\pnp\powerpolicystatemachine.cpp @ 3427]

    ffff8b84`497091d0 fffff80d`361997fd : ffffb90f`69a6b2f8 3f051397`00000000 fffff80d`3621c2c0 ffff8b84`49709300 : Wdf01000!FxPkgPnp::PowerPolicyProcessEventInner+0x1ff [minkernel\wdf\framework\shared\irphandlers\pnp\powerpolicystatemachine.cpp @ 3263]

    ffff8b84`49709340 fffff80d`36209993 : 00000000`00000000 00000000`0000010e 00000000`00000004 00000000`00000000 : Wdf01000!FxPkgPnp::PowerPolicyProcessEvent+0x13d [minkernel\wdf\framework\shared\irphandlers\pnp\powerpolicystatemachine.cpp @ 3023]

    (Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : Wdf01000!FxPkgPnp::PnpPowerPolicyStop+0xd (Inline Function @ fffff80d`36209993) [minkernel\wdf\framework\shared\irphandlers\pnp\pnpstatemachine.cpp @ 3757]

    ffff8b84`497093e0 fffff80d`3619a451 : ffffb90f`69a6b020 00000000`0000010e 00000000`0000010c fffff80d`36219260 : Wdf01000!FxPkgPnp::PnpEventQueriedRemoving+0x13 [minkernel\wdf\framework\shared\irphandlers\pnp\pnpstatemachine.cpp @ 1772]

    (Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : Wdf01000!FxPkgPnp::PnpEnterNewState+0xc9 (Inline Function @ fffff80d`3619a451) [minkernel\wdf\framework\shared\irphandlers\pnp\pnpstatemachine.cpp @ 1234]

    ffff8b84`49709410 fffff80d`36197fad : ffffb90f`69a6b178 00000000`00000000 ffffb90f`69a6b150 fffff80d`3617d000 : Wdf01000!FxPkgPnp::PnpProcessEventInner+0x1a1 [minkernel\wdf\framework\shared\irphandlers\pnp\pnpstatemachine.cpp @ 1150]

    ffff8b84`497094c0 fffff80d`3620e74a : 00000000`00000000 00000000`00000000 ffffb90f`69a6b020 ffff8b84`49709600 : Wdf01000!FxPkgPnp::PnpProcessEvent+0x12d [minkernel\wdf\framework\shared\irphandlers\pnp\pnpstatemachine.cpp @ 933]

    ffff8b84`49709560 fffff80d`36177d9e : ffffb90f`6a8252e0 ffff8b84`49709609 00000000`00000000 ffffb90f`69a6b020 : Wdf01000!FxPkgPnp::_PnpRemoveDevice+0x9a [minkernel\wdf\framework\shared\irphandlers\pnp\fxpkgpnp.cpp @ 2404]

    ffff8b84`497095d0 fffff80d`36177400 : ffffb90f`654c3010 ffffb90f`6a8252e0 ffffb90f`69a6b020 fffff800`31ebf6a8 : Wdf01000!FxPkgPnp::Dispatch+0xee [minkernel\wdf\framework\shared\irphandlers\pnp\fxpkgpnp.cpp @ 682]

    (Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : Wdf01000!DispatchWorker+0xca (Inline Function @ fffff80d`36177400) [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1572]

    (Inline Function) --------`-------- : --------`-------- --------`-------- --------`-------- --------`-------- : Wdf01000!FxDevice::Dispatch+0xe6 (Inline Function @ fffff80d`36177400) [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1586]

    ffff8b84`49709670 fffff800`31e578d9 : ffff8b84`49709850 fffff800`31e59853 00000000`00000006 ffffb90f`6a6c1b04 : Wdf01000!FxDevice::DispatchWithLock+0x150 [minkernel\wdf\framework\shared\core\fxdevice.cpp @ 1430]

    ffff8b84`49709760 fffff800`322994d1 : ffffb90f`6a6c1bf0 00000000`00000000 ffff8b84`49709850 fffff800`323a97c1 : nt!IofCallDriver+0x59

    ffff8b84`497097a0 fffff800`323a956f : 00000000`00000002 ffff8b84`49709869 ffffb90f`6a78a8f0 ffffb90f`6a6a6060 : nt!IopSynchronousCall+0xe5

    ffff8b84`49709810 fffff800`31f37dfb : ffffcd80`da4d9260 ffffb90f`6a78a8f0 00000000`0000000a ffffb90f`00000309 : nt!IopRemoveDevice+0xdf

    ffff8b84`497098d0 fffff800`323a855a : ffffb90f`6a78a8f0 cb3a4008`00000000 60008fb0`00000000 00000000`3f051397 : nt!PnpRemoveLockedDeviceNode+0x1ab

    ffff8b84`49709930 fffff800`323a8287 : 00000000`00000000 ffff8b84`497099b0 ffffcd80`d09c7d30 00000000`00000001 : nt!PnpDeleteLockedDeviceNode+0x4e

    ffff8b84`49709970 fffff800`323a7bb8 : ffffb90f`6a366080 ffffcd80`00000002 ffffb90f`6a366080 ffffcd80`d09c7d30 : nt!PnpDeleteLockedDeviceNodes+0xb3

    ffff8b84`497099e0 fffff800`3229de42 : ffff8b84`49709b30 ffffcd80`d2998100 ffffb90f`69ab1900 00000000`00000002 : nt!PnpProcessQueryRemoveAndEject+0x280

    ffff8b84`49709ad0 fffff800`3229bd1b : ffffcd80`da4d9260 00000000`00000000 ffffb90f`650c5c00 ffffcd80`d2998120 : nt!PnpProcessTargetDeviceEvent+0xde

    ffff8b84`49709b00 fffff800`31e5be05 : ffffb90f`650c5c40 ffffb90f`65eee1c0 fffff800`3229ba80 ffffb90f`69ab1990 : nt!PnpDeviceEventWorker+0x29b

    ffff8b84`49709b80 fffff800`31e47f87 : ffffbdbe`b0043618 00000000`00000080 ffffb90f`650e3480 ffffb90f`65eee1c0 : nt!ExpWorkerThread+0xf5

    ffff8b84`49709c10 fffff800`31f88676 : fffff800`31089180 ffffb90f`65eee1c0 fffff800`31e47f40 00007ff8`00000000 : nt!PspSystemThreadStartup+0x47

    ffff8b84`49709c60 00000000`00000000 : ffff8b84`4970a000 ffff8b84`49704000 00000000`00000000 00000000`00000000 : nt!KiStartSystemThread+0x16

    As you can see, waiting is occurring in UsbHub3!HUBFDO_EvtDeviceD0Exit. We have implemented EvtDeviceD0Entry(with all other pnp callbacks) in our driver, and registered it as PNP callback, but it is not being called.

    Is there any other callback we have missed or there is some method that we need to call in order for driver to unload?

    Friday, November 24, 2017 10:28 AM