I've been struggling with writing a driver that operates on only one CPU (because it involves per-CPU registers), but is able to service multiple user clients each on a different CPU.
I've been using a single Device for the driver, and having each open File on the device supply IOCTLs that grab and release one CPU at a time. But keeping track of which File has which CPU (if any) and synchronizing all of that is somewhat messy.
However, I got a bright idea which is to have a separate Device object with its own name and symbolic link for each CPU on the system. This way, the user code opens a File with the name corresponding to the desired CPU. The Devices are Exclusive access, so that handles possible collisions between different users.
The only difficulty I see is how to manage the names for all these Devices. Instead of a constant name like L"\Device\devMyDriver", I would have to append a digit, or possibly more digits, to indicate the CPU number. A Device will allocate a bunch of nonpaged pool but only while it is open for some user File. I presume that the overhead of having several Device Objects around is not a big problem as long as the Device Extension is pretty small.
I don't really have a question here, it's more to put this idea out to future developers. And if there's some reason anyone can see it would be a poor choice, please comment about that.
It looks like you're new here. If you want to get involved, click one of these buttons!
|Upcoming OSR Seminars|
|Developing Minifilters||29 July 2019||OSR Seminar Space|
|Writing WDF Drivers||23 Sept 2019||OSR Seminar Space|
|Kernel Debugging||21 Oct 2019||OSR Seminar Space|
|Internals & Software Drivers||18 Nov 2019||Dulles, VA|