I never said there was no lock in the callback object, I said the lock was not necessarily held across registered callbacks on a the callback object. The synchronization that the callback object is against the unregistration of a callback while a notification is in progress and calling the callback. The callback object does not serialize multiple notifications made on it at the same time.
Let’s say ExNotifyCallback() is called by thread A on CPU X at PASSIVE_LEVEL. If thread A does not obtain a
spinlock before invoking callbacks, what is going to happen if thread B that runs on CPU Y at DISPATCH_LEVEL
calls ExNotifyCallback() with the same parameters thread A did??? Therefore, it looks like MSDN statement
about synchronization that ExNotifyCallback() provides is not really true…
Given what I said above, they are not serialized against each other. Let’s say that thread A on CPU1 calls ExNotifyCallback and has called (or is about to call) callback1. Then thread B on CPU2 unregisters callback1. The unregister call will not return until callback1 returns and the callback object has processed that return.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Saturday, December 22, 2007 9:16 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Are callbacks guaranteed to run consecutively?
Doron,
You are making a mountain out of a mole hill here
Not really - the only thing I am doing here is trying to figure out how it all works internally. In my opinion, there is some inconsistency in MSDN documentation - on one hand, it says that
ExNotifyCallback() provides synchronization, but, one another hand, it says that callback routine is invoked at caller’s IRQL. Taking into consideration that ExNotifyCallback() is callable at IRQL<= DISPATCH_LEVEL, these 2 statements seem to be mutually exclusive for SMP system
(although perfectly consistent with one another if we speak about UP system)
each ex callback object has its own lock to maintain the list of callbacks registered on it
This is what we should have started with. However, originally you said that there is no spinlock to guard every *given* callback object. Furthermore, another question is still open. More on it below
the callbacks may or not may not be called with the list lock being held
(this is so calls made to ExNotifyCallback at passive invoke the callback at passive
Let’s say ExNotifyCallback() is called by thread A on CPU X at PASSIVE_LEVEL. If thread A does not obtain a spinlock before invoking callbacks, what is going to happen if thread B that runs on CPU Y at DISPATCH_LEVEL calls ExNotifyCallback() with the same parameters thread A did??? Therefore, it looks like MSDN statement about synchronization that ExNotifyCallback() provides is not really true…
Anton Bassov
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