EvtDeviceAdd concurrency for USB devices?

I’m working on a USB driver which needs to share data between driver objects.

From the documentation I see that EvtDeviceAdd runs at IRQL passive level which means

it could be interrupted by the scheduler?

Question is: In case I have many identical USB devices (i.o.w. EvtDeviceAdd is called several times) are callbacks to EvtDeviceAdd (and other callbacks) serialized in the PnP manager or do I need to ensure correct access (i.e. locks) to common resources at this level?

Thanks!

Anything that runs below below DISPATCH_LEVEL can be interrupted by scheduler. Keep in mind you can always be interrupted by external interrupts, and even NMIs, which you can't do much about.

I scanned the MSDN for EvtDeviceAdd. There is no mention of concurrency or serialization. I believe more experienced members will help you. Until then, if its urgent, you can try to add statements and fuzz it to see if it serializes the callbacks. (Note that you are scanning for overlaps. If it overlaps even once, then it isn't serialized.) You can also still acquire locks, it won't hurt if performance isn't your top goal.

Thanks for your feedback. I found an article in the official docs “Using automatic synchronization”

and it seems that some callbacks are indeed serialized!

But maybe the experts here can give even more insight?

Yeah. I found that too. But it isn't the callback in our interest. It's not specified as "unsafe" nor "safe"