DNF_NEEDS_REBALANCE

Hello,
I’m developing a KMDF driver under XP for a pci-vme bridge device. I’m using the latest WinDDK (6001.18002). I’ve based my driver on the kmdf\pcidrv sample. I’m using a checked XP kernel and coinstaller.

My ‘getting started’ approach has been to take the pcidrv sample and disable any hardware specific code, modify the INF file for my device’s vendorID, etc and just get the driver to load and allocate memory/irq resources for my device so it’s not banged-out in dev mgr. This seemed like it should be straight forward enough.

I install the driver under SAFE mode. Then when I boot in normal mode (checked or free XP versions) it causes XP to hang (hang = progress bar keeps ticking away but never get to login screen).

With WinDbg connected, I can break into the kernel and run devnode, arbiter, etc. Here is what I see with devnode :

0: kd> !devnode 0x89f60ed8
DevNode 0x89f60ed8 for PDO 0x89f6de50
Parent 0x89f60008 Sibling 0000000000 Child 0000000000
InstancePath is “PCI
\VEN_10E3&DEV_0000&SUBSYS_00000000&REV_02\4&3abfd0ac&0&28F0”
ServiceName is “GenPCI”
State = DeviceNodeDriversAdded (0x303)
Previous State = DeviceNodeInitialized (0x302)
StateHistory[01] = DeviceNodeInitialized (0x302)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)

Flags (0x000400f0) DNF_ENUMERATED, DNF_IDS_QUERIED,
DNF_HAS_BOOT_CONFIG, DNF_BOOT_CONFIG_RESERVED,
DNF_NEEDS_REBALANCE

BootResourcesList at 0xe13a8c30 Version 1.1 Interface 0x5 Bus #0x6
Entry 0 - Memory (0x3) Undetermined Sharing (0)
Flags (0000) - READ_WRITE
Range starts at 0x00000000d7fff000 for 0x1000 bytes
Entry 1 - Interrupt (0x2) Shared (0x3)
Flags (0000) - LEVEL_SENSITIVE
Level 0xb, Vector 0xb, Group 0, Affinity 0xffffffff

IoResList at 0xe14a1178 : Interface 0x5 Bus 0x6 Slot 0x5
Alternative 0 (Version 1.1)
Preferred Descriptor 0 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
0x001000 byte range with alignment 0x000001
d7fff000 - 0xd7ffffff
Alternative Descriptor 1 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
0x001000 byte range with alignment 0x001000
0 - 0xffffffff
Descriptor 2 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) -
Data: : 0x1 0x0 0x0
Descriptor 3 - Port (0x1) Device Exclusive (0x1)
Flags (0x31) - PORT_IO 16_BIT_DECODE POSITIVE_DECODE
0x001000 byte range with alignment 0x001000
0 - 0xffffffff
Descriptor 4 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) -
Data: : 0x1 0x1 0x0
Descriptor 5 - Interrupt (0x2) Shared (0x3)
Flags (0000) - LEVEL_SENSITIVE
0x0 - 0xff
********* end of debug output ***********

So, I’m puzzled as to what aspect of this driver is hanging the OS. Obviously it’s not started.

  1. Does it have something to do with DNF_NEEDS_REBALANCE ? What does this mean?

  2. I don’t have any resource conflicts I can see with arbiter. But what does “Entry 0 - Memory (0x3) Undetermined Sharing (0)” mean and is it significant?

  3. Using devobj I see that “Current Irp 00000000” and “Device queue is not busy.” so is it safe to assume my driver isn’t blocking because it’s failed to process some IRPs?

Any help in getting past this point would be greatly appreciated.

Regards,
Brent

  1. this is a normal state on a yet to be started devnode
  2. don’t know
  3. Current Irp and device queue not busy relates to StartIo. A KMDF (nor really a wdm) driver really use start io anymore so this are not relevant.

Try running !locks to see if the pnp lock is currently being held. Also, remove your pci device from the machine and see if boot continues, this will allow you to isolate your driver’s responsibility here. If !locks fails, you can run !process 0 1 to list all threads and see if any interesting threads (esp ones containing KMDF or your driver) are blocked

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of bbartson@tc3net.com
Sent: Wednesday, January 14, 2009 1:00 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] DNF_NEEDS_REBALANCE

Hello,
I’m developing a KMDF driver under XP for a pci-vme bridge device. I’m using the latest WinDDK (6001.18002). I’ve based my driver on the kmdf\pcidrv sample. I’m using a checked XP kernel and coinstaller.

My ‘getting started’ approach has been to take the pcidrv sample and disable any hardware specific code, modify the INF file for my device’s vendorID, etc and just get the driver to load and allocate memory/irq resources for my device so it’s not banged-out in dev mgr. This seemed like it should be straight forward enough.

I install the driver under SAFE mode. Then when I boot in normal mode (checked or free XP versions) it causes XP to hang (hang = progress bar keeps ticking away but never get to login screen).

With WinDbg connected, I can break into the kernel and run devnode, arbiter, etc. Here is what I see with devnode :

0: kd> !devnode 0x89f60ed8
DevNode 0x89f60ed8 for PDO 0x89f6de50
Parent 0x89f60008 Sibling 0000000000 Child 0000000000
InstancePath is “PCI
\VEN_10E3&DEV_0000&SUBSYS_00000000&REV_02\4&3abfd0ac&0&28F0”
ServiceName is “GenPCI”
State = DeviceNodeDriversAdded (0x303)
Previous State = DeviceNodeInitialized (0x302)
StateHistory[01] = DeviceNodeInitialized (0x302)
StateHistory[00] = DeviceNodeUninitialized (0x301)
StateHistory[19] = Unknown State (0x0)

Flags (0x000400f0) DNF_ENUMERATED, DNF_IDS_QUERIED,
DNF_HAS_BOOT_CONFIG, DNF_BOOT_CONFIG_RESERVED,
DNF_NEEDS_REBALANCE

BootResourcesList at 0xe13a8c30 Version 1.1 Interface 0x5 Bus #0x6
Entry 0 - Memory (0x3) Undetermined Sharing (0)
Flags (0000) - READ_WRITE
Range starts at 0x00000000d7fff000 for 0x1000 bytes
Entry 1 - Interrupt (0x2) Shared (0x3)
Flags (0000) - LEVEL_SENSITIVE
Level 0xb, Vector 0xb, Group 0, Affinity 0xffffffff

IoResList at 0xe14a1178 : Interface 0x5 Bus 0x6 Slot 0x5
Alternative 0 (Version 1.1)
Preferred Descriptor 0 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
0x001000 byte range with alignment 0x000001
d7fff000 - 0xd7ffffff
Alternative Descriptor 1 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
0x001000 byte range with alignment 0x001000
0 - 0xffffffff
Descriptor 2 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) -
Data: : 0x1 0x0 0x0
Descriptor 3 - Port (0x1) Device Exclusive (0x1)
Flags (0x31) - PORT_IO 16_BIT_DECODE POSITIVE_DECODE
0x001000 byte range with alignment 0x001000
0 - 0xffffffff
Descriptor 4 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) -
Data: : 0x1 0x1 0x0
Descriptor 5 - Interrupt (0x2) Shared (0x3)
Flags (0000) - LEVEL_SENSITIVE
0x0 - 0xff
********* end of debug output ***********

So, I’m puzzled as to what aspect of this driver is hanging the OS. Obviously it’s not started.

  1. Does it have something to do with DNF_NEEDS_REBALANCE ? What does this mean?

  2. I don’t have any resource conflicts I can see with arbiter. But what does “Entry 0 - Memory (0x3) Undetermined Sharing (0)” mean and is it significant?

  3. Using devobj I see that “Current Irp 00000000” and “Device queue is not busy.” so is it safe to assume my driver isn’t blocking because it’s failed to process some IRPs?

Any help in getting past this point would be greatly appreciated.

Regards,
Brent


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

OK, so I uninstalled my driver and rebooted (the device cannot be removed from the system since it’s integral to the motherboard). My driver is the problem, the OS will boot without it.

When I run !locks I see three locks. One is exclusively owned. How can I tell which one is possibly in contention with my driver? Here is the exclusive lock info :

THREAD 89ba5da8 Cid 0004.003c Teb: 00000000 Win32Thread: 00000000 RUNNING on processor 0
Not impersonating
DeviceMap e1009200
Owning Process 89ba8830 Image: System
Attached Process N/A Image: N/A
Wait Start TickCount 9550 Ticks: 1 (0:00:00:00.015)
Context Switch Count 7091
UserTime 00:00:00.000
KernelTime 00:01:27.921
Start Address nt!ExpWorkerThread (0x80537668)
Stack Init bad08000 Current bad07770 Base bad08000 Limit bad05000 Call 0
Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr
bad07770 80544109 nt!RtlpBreakWithStatusInstruction (FPO: [1,0,0])
bad07770 805dc24a nt!KeUpdateSystemTime+0x175 (FPO: [0,2] TrapFrame @ bad07784)
bad07800 805dc42d nt!RtlGetNextRange+0xa2 (FPO: [3,0,4])
bad0781c 805dc546 nt!RtlpIsRangeAvailable+0xc5 (FPO: [11,0,0])
bad07874 ba774f54 nt!RtlFindRange+0xfc (FPO: [12,6,4])
WARNING: Frame IP not in any known module. Following frames may be wrong.
bad0792c 80594982 0xba774f54
bad0795c 80595c01 nt!IopTestConfiguration+0x42 (FPO: [1,4,4])
bad0798c 80596fde nt!IopFindBestConfiguration+0x3d (FPO: [3,6,4])
bad079e0 805974b2 nt!IopRebalance+0x1da (FPO: [2,13,0])
bad07a38 8059a09a nt!IopAllocateResources+0x1bc (FPO: [5,15,0])
bad07a90 8059a202 nt!IopAssignResourcesToDevices+0x100 (FPO: [4,13,0])
bad07ac8 80590e26 nt!IopProcessAssignResources+0xd6 (FPO: [3,5,0])
bad07d24 805914ba nt!PipProcessDevNodeTree+0xa6 (FPO: [8,143,4])
bad07d54 804f66bc nt!PiRestartDevice+0x80 (FPO: [1,0,0])
bad07d7c 80537757 nt!PipDeviceActionWorker+0x168 (FPO: [1,4,0])
bad07dac 805ce794 nt!ExpWorkerThread+0xef (FPO: [1,6,0])
bad07ddc 805450ce nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 nt!KiThreadStartup+0x16
*****************************************************************

More info. I think my driver is one of the threads holding a lock, although it’s not an exclusive lock :

Here’s one of the locks…

0: kd> !locks -v 0x8055a560

Resource @ nt!IopDeviceTreeLock (0x8055a560) Shared 1 owning threads
Threads: 89ba5da8-01<*>

THREAD 89ba5da8 Cid 0004.003c Teb: 00000000 Win32Thread: 00000000 RUNNING on processor 0
Not impersonating
DeviceMap e1009200
Owning Process 89ba8830 Image: System
Attached Process N/A Image: N/A
Wait Start TickCount 2008 Ticks: 14294 (0:00:03:43.343)
Context Switch Count 2144
UserTime 00:00:00.000
KernelTime 00:04:05.125
Start Address nt!ExpWorkerThread (0x80537668)
Stack Init bad08000 Current bad07768 Base bad08000 Limit bad05000 Call 0
Priority 12 BasePriority 12 PriorityDecrement 0 DecrementCount 16
ChildEBP RetAddr
bad07794 80544109 nt!RtlpBreakWithStatusInstruction (FPO: [1,0,0])
bad07794 805dc3c2 nt!KeUpdateSystemTime+0x175 (FPO: [0,2] TrapFrame @ bad077a8)
bad07824 805dc546 nt!RtlpIsRangeAvailable+0x5a (FPO: [11,0,0])
bad0787c ba774f54 nt!RtlFindRange+0xfc (FPO: [12,6,4])
bad078c4 ba76dd12 pci!ArbFindSuitableRange+0x9e (FPO: [2,1,4])
bad078dc ba773c6f pci!ario_FindSuitableRange+0xb6 (FPO: [2,0,0])
bad078f8 ba7749a6 pci!ArbAllocateEntry+0x8d (FPO: [2,0,4])
bad07918 ba773ac0 pci!ArbTestAllocation+0xb2 (FPO: [2,1,4])
bad07934 80594982 pci!ArbArbiterHandler+0x32 (FPO: [3,0,4])
bad07964 80595c01 nt!IopTestConfiguration+0x42 (FPO: [1,4,4])
bad07994 80596fde nt!IopFindBestConfiguration+0x3d (FPO: [3,6,4])
bad079e8 805974b2 nt!IopRebalance+0x1da (FPO: [2,13,0])
bad07a40 8059a09a nt!IopAllocateResources+0x1bc (FPO: [5,15,0])
bad07a98 8059a202 nt!IopAssignResourcesToDevices+0x100 (FPO: [4,13,0])
bad07ad0 80590e26 nt!IopProcessAssignResources+0xd6 (FPO: [3,5,0])
bad07d2c 8059142e nt!PipProcessDevNodeTree+0xa6 (FPO: [8,143,4])
bad07d54 804f66c4 nt!PiProcessStartSystemDevices+0x3a (FPO: [1,0,0])
bad07d7c 80537757 nt!PipDeviceActionWorker+0x170 (FPO: [1,4,0])
bad07dac 805ce794 nt!ExpWorkerThread+0xef (FPO: [1,6,0])
bad07ddc 805450ce nt!PspSystemThreadStartup+0x34 (FPO: [Non-Fpo])
00000000 00000000 nt!KiThreadStartup+0x16

1 total locks, 1 locks currently held

And then if I run ERESOURCE on it’s thread … I see ‘pcidrv’ (my driver)

0: kd> dt ERESOURCE 0x8055a560
pcidrv!ERESOURCE
+0x000 SystemResourcesList : _LIST_ENTRY [0x8055a520 - 0x80559fa0]
+0x008 OwnerTable : (null)
+0x00c ActiveCount : 1
+0x00e Flag : 0
+0x010 SharedWaiters : (null)
+0x014 ExclusiveWaiters : (null)
+0x018 OwnerEntry : _OWNER_ENTRY
+0x020 ActiveEntries : 0x89ba5da8
+0x024 ContentionCount : 1
+0x028 NumberOfSharedWaiters : 0
+0x02c NumberOfExclusiveWaiters : 0
+0x030 Address : (null)
+0x030 CreatorBackTraceIndex : 0
+0x034 SpinLock : 0

So what useful thing can I learn from this ‘dt ERESOURCE 0x8055a560’ output ?

Thanks,
Brent