I’m doing an fsd proof-of-concept, and I got into a discussion with
another dev about apc delivery and critical regions. A couple of
questions:
-
Why, in general, are FSDs not reentrant, such that disabling normal
kernel and user APCs is required? You obviously have to manage
synchronization to specific data structures, but this global disabling
of APCs sort of violates the idea of “hold the fewest locks for the
least time possible”. It’s clearly not a problem to enter the code
multiple times by different threads - only reentry by the same thread is
prevented here. What’s the deal? -
The opposite question is also on my mind: why not just KeRaiseIrql
to APC_LEVEL, instead of needing a critical region? I realize io
completion is a special kernel apc, but the fsd would presumably lower
the irql back to passive before queuing that apc – or does this open
you up to the very race you were trying to prevent, hence the need for
the critical region level?
It seems that critical regions are kind of an add-on to the irql model -
they don’t quite fit cleanly in with the rest of the architecture.
Regardless, I’m definitely missing something about reentrancy here.
Thanks.
-sd