Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


How device scope affect Queues dispatching mode

remyavu10remyavu10 Member Posts: 53

I read that "device scope results in serialized calls to the I/O event callbacks for an individual device object".
If parallel dispatching mode is set for the queue, Would this 'device scope' causes serialized calls (sequential) calls to the I/O callbacks which driver registered for read, write and control?

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,913

    Yes.

    Sync Scope Device locates a lock at the device level. Before calling any of your driver’s EvtIo Event Processing Callbacks, the Framework acquires this lock exclusive. That means that while one of your EvtIo callbacks (EvtIoRead, for example) is running no other such callback EvtIo callback can be made active. When it’s about to call, the Framework will just wait to acquire the lock.

    Note the lock is only held while the callback is in progress. As soon as the EvtIo routine holding the lock returns, the lock is release, and the next (one) such callback can run.

    And, let me add, that Sync Scope Device is rarely the right answer to anything. In most drivers where I’ve seen it used, it’s the result of the dev not really understanding the synchronization needs of their driver. I’m not saying I’ve never used it (I have... in a very complex driver I wrote last year). I’m just saying it’s rarely the best option (and, truth be told, if I had more time to work on that driver that I wrote where I used it, I wouldn’t have used it there either).

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,498

    Yes. One of the things I learned very early in my experience with KMDF is that the framework makes it very easy to oversynchronize yourself. Before I figured out their scheme, I had some very nasty hangs .

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • remyavu10remyavu10 Member Posts: 53
    edited August 1
    Thanks all.
    Suppose, I have three different queues with sequential dispatching (for read, write and control). Does this device scope means, only one IO event callback function shall be in progress at anytime?
  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,913

    Does this device scope means, only one IO event callback function shall be in progress at anytime

    Yes. That’s what it means.

    Apparently I did not do a good job of explaining that in my initial reply.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • remyavu10remyavu10 Member Posts: 53

    Thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA