Re: Cancel-safe without a thread?



Look at the IoCsqXXX routines, there are flaws in the method in the book!


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
http://www.windrvr.com
Remove StopSpam from the email to reply


<BubbaGump> wrote in message
news:mt5hf2lai33r6qujcna0nbonqgg9cc7o00@xxxxxxxxxx
On Fri, 1 Sep 2006 11:33:09 -0400, "Don Burn" <burn@xxxxxxxxxxxxxxxx>
wrote:

Invention is fine if you are solving a new problem. The problem here is
that a lot of driver writing with WDM is boilerplate code, and getting it
right is not always easy (if you search the archives of this group and the
OSR groups you will see an amazing amount of thrashing on handling cancel
before the Cancel Safe queue routines).

Back on a more technical note, I got the impression (from the WDM
driver book) that cancel-safe queues required a dedicated thread to
de-queue each IRP, and now I'm reading about some sort of custom
DEVQUEUE structure the author came up with.

A dedicated thread seems like overhead, but I'd prefer to use the DDK
as much as possible. Do I really need a dedicated thread? It looks
like I could just have my normal DPC do the de-queuing and start the
next I/O (twiddle device registers) either in my dispatch routine or
the DPC, depending on whether there was an I/O in progress. I think
I'd need a lock to protect the queue and in-progress bit/pointer
together, but it doesn't look like I could use the same lock as the
one used by the cancel-safe wrappers because the cancel-safe remove
releases the lock after its touched the queue, without leaving a
chance to atomically update another variable based on the result of
the remove.



.



Relevant Pages

  • Re: location of bioq lock
    ... Poul-Henning Kamp wrote: ... > routines of the drivers which do not use geom_disk. ... > and when the driver is ready again, ... > pulls the request out of the side queue again. ...
    (freebsd-current)
  • Re: [PATCH 2/2] Initial generic hypertransport interrupt support.
    ... It is quite similar to MSI but with a different ... from the perspective of a driver. ... break other people with HyperTransport chips and cards as well. ... Unless we add a full set of ht_* routines ...
    (Linux-Kernel)
  • Re: GRX is sooo slow
    ... Any idea to speed it up?(using VESA driver) ... GRX has for handling memory fills and copies, ... pull in generic routines that you try to minimize that. ... want to ensure that you're compiling with optimizations enabled such ...
    (comp.os.msdos.djgpp)
  • Re: USBD routines
    ... there are some routines that are exported via ... > We have a single driver sys file that is loaded for PS/2, Serial, and USB ... > adding a USB device object. ...
    (microsoft.public.development.device.drivers)
  • Re: [PATCH 2/2] Initial generic hypertransport interrupt support.
    ... It is quite similar to MSI but with a different ... from the perspective of a driver. ... break other people with HyperTransport chips and cards as well. ... I don't see a reason to do it for just these routines, ...
    (Linux-Kernel)