Re: IRP reuse contradiction



I think it's partly a matter of using the same word to mean a few subtly different things, and i beleive this is what it's trying to explain:

If you have an IRP that completed back to your driver you can send it down again (and again and again ...). If it's an IRP you allocated then reusing it for any purpose you want is fine. If, however, it's an IRP from the I/O manager (really from outside of your driver) you shouldn't reuse it to handle some unrelated operation since that unnecessarily delays the progress of the request you do have.

So retrying a read request sent to you from NtReadFile is fine. Reusing the IRP to send a "reset" or a "get more error details" command is fine. Reusing the IRP instead of allocating a new one for some unrelated internal request isn't fine. Reusing the IRP because you failed to allocate an unrelated IRP isn't.

Anyway that's what i think.

-p

"BubbaGump" wrote in message news:3ckai2h7l5senflildlr6d0l12pi4o926o@xxxxxxxxxx
I'm trying to figure out if I'm interpreting the word "reuse" right in
different contexts, but it is true the discrepancy in that last case
must be a typo.




On Thu, 5 Oct 2006 11:19:49 -0700, "Richard [MS]"
<rwbrown@xxxxxxxxxxxxxxxxxxxx> wrote:

At the bottom of each WDK documentation page is a "Send feedback on this
topic" link. Whenever you're pretty sure that you've found a documentation
error, please click the link. It'll generate an email that you can use to
describe the problem. The email will go directly to the WDK documentation
team.

The "send feedback" link is not meant for questions or discussions about
writing drivers. Use this and other discussion forums for asking questions
and generating discussions with experienced driver writers. But when you
find a doc error, please notify the WDK doc team.

Thanks.


<BubbaGump> wrote in message
news:p6e8i2dal2re873t7jmg4t91a9ka188sl9@xxxxxxxxxx
On Wed, 04 Oct 2006 18:23:14 -0400, BubbaGump <> wrote:

There are some other statements in the "Completing IRPs" section of
the DDK documentation that seem to contradict each other about IRP
reuse.

One says that an IoCompletion routine can be used "To reuse an
incoming IRP to request that lower drivers complete some number of
operations, such as partial transfers, until the original request can
be satisfied and completed by the IoCompletion routine."

Another says that "Drivers must not attempt to reuse IRPs issued by
the I/O manager." (and that only raw memory or IRPs created by
IoAllocateIrp can be reused)

Since any incoming IRP could be from the I/O manager, which one of
these statements is right?

Also, is reusing an IRP the same as retrying an IRP on failure in the
sense that it requires IoReuseIrp or IoInitializeIrp to be used, or is
manually resetting the status fields enough?

I'm really starting to have doubts about the DDK documentation. I
found yet another set of contradictions about IRP reuse. In "Creating
IOCTL Requests in Drivers" it's implied that an IRP created using
IoBuildDeviceIoControlRequest can be reused even though the "Reusing
IRPs" section earlier says that drivers must not attempt to reuse IRPs
created by IoBuildDeviceIoControlRequest.




.



Relevant Pages

  • Re: IRP_MN_QUERY_DEVICE_RELATIONS concurrency
    ... irps that could lead to a query remove failure (like create, ... interface) are not syncronized with pnp state changing irps either. ... synchronized with any pnp state changing irp. ... That's a very narrow class of drivers. ...
    (microsoft.public.development.device.drivers)
  • Re: KMDF: how can I get usb continuous reader callbacks always in order?
    ... you cannot rely on _completion order_ in Windows. ... Nevertheless, with most drivers you can rely on _IRP submit order_, that the ... and this serialization keeps up to the client callbacks at DISPATCH. ...
    (microsoft.public.development.device.drivers)
  • Re: Isoch read request causes access violation!
    ... >Once you have completed the IRP, ... routine and complete the IRP in his read dispatch routine. ... to use an event per io request. ... Device and Filesystem Drivers ...
    (microsoft.public.development.device.drivers)
  • Re: KMDF: how can I get usb continuous reader callbacks always in order?
    ... Nevertheless, with most drivers you can rely on _IRP submit order_, that the ... just keep a serial number in your IRP context - completion context for ... Maxim Shatskih, Windows DDK MVP ...
    (microsoft.public.development.device.drivers)
  • Re: IRP reuse contradiction
    ... At the bottom of each WDK documentation page is a "Send feedback on this ... writing drivers. ... the DDK documentation that seem to contradict each other about IRP ... One says that an IoCompletion routine can be used "To reuse an ...
    (microsoft.public.development.device.drivers)