ERESOURCE question

I am trying to write a more useful (to me) version of !locks and am
digging into the structure of an ERESOURCE. If I execute !locks, I get:

0: kd> !locks 81c88784

Resource @ 0x81c88784 Shared 3 owning threads
Contention Count = 3421
NumberOfSharedWaiters = 7
NumberOfExclusiveWaiters = 1
Threads: 815684a0-01 815a16e0-01 814e9020-01 8149dda0-01

815974f0-01 814ed498-01 8169e628-01 81627aa8-01

815896a0-01 81709020-01

Dumping the structure I get:

0: kd> dt -r1 _ERESOURCE 0x81c88784
+0x000 SystemResourcesList : [0x81c887bc - 0xf8033920]
+0x000 Flink : 0x81c887bc [0x81d09c70 - 0x81c88784]
+0x004 Blink : 0xf8033920 [0x81c88784 - 0xf8034190]
+0x008 OwnerTable : 0x81584008
+0x000 OwnerThread : 0
+0x004 OwnerCount : 55
+0x004 TableSize : 0x37
+0x00c ActiveCount : 3
+0x00e Flag : 0
+0x010 SharedWaiters : 0x81d67738
+0x000 Header : _DISPATCHER_HEADER
+0x010 Limit : 2147483647
+0x014 ExclusiveWaiters : 0x81cfb410
+0x000 Header : _DISPATCHER_HEADER
+0x018 OwnerThreads : [2]
+0x000 OwnerThread : 0
+0x004 OwnerCount : 0
+0x004 TableSize : 0
+0x028 ContentionCount : 0xd5d
+0x02c NumberOfSharedWaiters : 7
+0x02e NumberOfExclusiveWaiters : 1
+0x030 Address : (null)
+0x030 CreatorBackTraceIndex : 0
+0x034 SpinLock : 0

Traversing the lists of exclusive and shared waiters, I find the correct
number of threads waiting. An examination of the threads (using
!thread) correctly shows respective calls to
ExAcquireResourceExclusiveLite and ExAcquireResourceSharedLite.
However, a dump of the owner table is confusing.

0: kd> dd 0x81584008

81584008 00000000 00000037 815a16e0 00000001
81584018 814e9020 00000001 8149dda0 00000001
81584028 815974f0 00000001 814ed498 00000001
81584038 8169e628 00000001 81627aa8 00000001
81584048 815896a0 00000001 81709020 00000001
81584058 00000000 00000000 00000000 00000000
81584068 00000000 00000000 00000000 00000000
81584078 00000000 00000000 00000000 00000000

As you can see, there are 9 threads in the table, whereas !locks reports
3 owning threads. Systematically checking the 9 threads shown, I find 6
of them are in the shared waiters list and the other 3 are indeed the
shared owners. However, the three owners are 815a16e0, 8149dda0, and
815974f0, which are the first, third and fourth entries in the table.

So… how does !locks distinguish the owners from the non-owners in this
table?

Thanks,

Mike

Recently an MS developer enhanced !locks to indicate the shared owners
with a (*) next to them -
the way it works is to identify a shared owner if he is in the owner
table, but not blocked on the semaphore.

A future update on the debugger download site
http://www.microsoft.com/DDK/Debugging/default.asp will probably
ship this extension.
Ravi

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: Michael and Karen Gilson [mailto:xxxxx@gte.net]
Sent: Monday, July 22, 2002 1:19 PM
To: File Systems Developers
Subject: [ntfsd] ERESOURCE question

I am trying to write a more useful (to me) version of !locks and am
digging into the structure of an ERESOURCE. If I execute !locks, I get:

0: kd> !locks 81c88784

Resource @ 0x81c88784 Shared 3 owning threads
Contention Count = 3421
NumberOfSharedWaiters = 7
NumberOfExclusiveWaiters = 1
Threads: 815684a0-01 815a16e0-01 814e9020-01 8149dda0-01

815974f0-01 814ed498-01 8169e628-01 81627aa8-01

815896a0-01 81709020-01

Dumping the structure I get:

0: kd> dt -r1 _ERESOURCE 0x81c88784
+0x000 SystemResourcesList : [0x81c887bc - 0xf8033920]
+0x000 Flink : 0x81c887bc [0x81d09c70 - 0x81c88784]
+0x004 Blink : 0xf8033920 [0x81c88784 - 0xf8034190]
+0x008 OwnerTable : 0x81584008
+0x000 OwnerThread : 0
+0x004 OwnerCount : 55
+0x004 TableSize : 0x37
+0x00c ActiveCount : 3
+0x00e Flag : 0
+0x010 SharedWaiters : 0x81d67738
+0x000 Header : _DISPATCHER_HEADER
+0x010 Limit : 2147483647
+0x014 ExclusiveWaiters : 0x81cfb410
+0x000 Header : _DISPATCHER_HEADER
+0x018 OwnerThreads : [2]
+0x000 OwnerThread : 0
+0x004 OwnerCount : 0
+0x004 TableSize : 0
+0x028 ContentionCount : 0xd5d
+0x02c NumberOfSharedWaiters : 7
+0x02e NumberOfExclusiveWaiters : 1
+0x030 Address : (null)
+0x030 CreatorBackTraceIndex : 0
+0x034 SpinLock : 0

Traversing the lists of exclusive and shared waiters, I find the correct
number of threads waiting. An examination of the threads (using
!thread) correctly shows respective calls to
ExAcquireResourceExclusiveLite and ExAcquireResourceSharedLite. However,
a dump of the owner table is confusing.

0: kd> dd 0x81584008

81584008 00000000 00000037 815a16e0 00000001
81584018 814e9020 00000001 8149dda0 00000001
81584028 815974f0 00000001 814ed498 00000001
81584038 8169e628 00000001 81627aa8 00000001
81584048 815896a0 00000001 81709020 00000001
81584058 00000000 00000000 00000000 00000000
81584068 00000000 00000000 00000000 00000000
81584078 00000000 00000000 00000000 00000000

As you can see, there are 9 threads in the table, whereas !locks reports
3 owning threads. Systematically checking the 9 threads shown, I find 6
of them are in the shared waiters list and the other 3 are indeed the
shared owners. However, the three owners are 815a16e0, 8149dda0, and
815974f0, which are the first, third and fourth entries in the table.

So… how does !locks distinguish the owners from the non-owners in this
table?

Thanks,

Mike


You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%