inter module notification

I need to implement some form of synchronization between two kernel modules.
The two modules are:

  1. A pnp enumerated Device1.
  2. A pnp enumerated Device2.

I cannot make an assumptions about the enumeration or load order on these two devices.

My requirements are that:

  1. the Device2 blocks (pends) its pnp start irp until Device1 has completed initialization.
  2. The Device1 needs to send requests to Device2 once it is initialized.

I’m considering using pnp notifications:

  • Device2 registers for arrival of Device1
  • Device1 registers for arrival of Device2 and then sends a query interface to Device2 so that it make calls to Device2.

The only reservation I have is that in my experience pnp notifications can be unreliable if the device you are waiting for has already arrived by the time you register for notifications.

Other options would be to used shared named events in the kernel, but seems like there are dependencies on what registry hives are available at the time.

Looking forward to your advise.

thanks,

Pnp notifications are reliable, so whatever you saw as unreliability is most likely due to your own bugs. Notifications on a device will not be delivered until the start irp has completed back to the pnp manager. Give what you describe below, you will deadlock. Instead of infinitely pending the start irp (which can happen if device2 fails to start for ANY reason), complete the start irp on device2 and register for pnp notifications on device2’s device interface. When device2’s interface arrives, enable device1’s device interface. Until device1’s interface is enabled, fail all incoming io that would require the presence of device2.

Note that once you solve the start problem, you will have the same problems during power down and power up. During power down, either device can be powered down first and both need to handle the other not being functional. Same for power up, the order is not guaranteed.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Monday, January 09, 2012 10:01 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] inter module notification

I need to implement some form of synchronization between two kernel modules.
The two modules are:

  1. A pnp enumerated Device1.
  2. A pnp enumerated Device2.

I cannot make an assumptions about the enumeration or load order on these two devices.

My requirements are that:

  1. the Device2 blocks (pends) its pnp start irp until Device1 has completed initialization.
  2. The Device1 needs to send requests to Device2 once it is initialized.

I’m considering using pnp notifications:

  • Device2 registers for arrival of Device1
  • Device1 registers for arrival of Device2 and then sends a query interface to Device2 so that it make calls to Device2.

The only reservation I have is that in my experience pnp notifications can be unreliable if the device you are waiting for has already arrived by the time you register for notifications.

Other options would be to used shared named events in the kernel, but seems like there are dependencies on what registry hives are available at the time.

Looking forward to your advise.

thanks,


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