Hi all,
I was just reading a document “Flow of control for Cancel-Safe IRP Queuing”. I am confused about the flow diagram of IoCsqInsertIrp function. When CSQ library sets its own cancel routine and IRP is cancelled, CSQ library cancel routine will be called lets suppose. Then, I/O manager before calling the CSQ library cancel routine, it will acquire system wide cancel spinlock. If that system wide spinlock is already acquired by some other driver, then it will wait for the cancel spinlock. This will decrease the driver performance.
Similarly, I have another question that lets suppose CSQ library cancel routine is called which callback routine will be called as to notify the driver that IRP is cancelled.
Thank you.
xxxxx@gmail.com wrote:
I was just reading a document “Flow of control for Cancel-Safe IRP Queuing”. I am confused about the flow diagram of IoCsqInsertIrp function. When CSQ library sets its own cancel routine and IRP is cancelled, CSQ library cancel routine will be called lets suppose. Then, I/O manager before calling the CSQ library cancel routine, it will acquire system wide cancel spinlock. If that system wide spinlock is already acquired by some other driver, then it will wait for the cancel spinlock. This will decrease the driver performance.
Compared to what? Compared to a driver that doesn’t grab the spinlock
and crashes mysteriously every now and then?
You are worried about the wrong metrics.
Similarly, I have another question that lets suppose CSQ library cancel routine is called which callback routine will be called as to notify the driver that IRP is cancelled.
CsqCompleteCanceledIrp.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Alternately consider the tiime required NOT to use CSQ in your driver and
attempt to get IRP cancelling on your own. In about 6 to 7 months you will
quietly embrace CSQ, or WDF, and never, ever worry about such silly little
metrics again
–
The personal opinion of
Gary G. Little
“Tim Roberts” wrote in message news:xxxxx@ntdev…
> xxxxx@gmail.com wrote:
>> I was just reading a document “Flow of control for Cancel-Safe IRP
>> Queuing”. I am confused about the flow diagram of IoCsqInsertIrp
>> function. When CSQ library sets its own cancel routine and IRP is
>> cancelled, CSQ library cancel routine will be called lets suppose. Then,
>> I/O manager before calling the CSQ library cancel routine, it will
>> acquire system wide cancel spinlock. If that system wide spinlock is
>> already acquired by some other driver, then it will wait for the cancel
>> spinlock. This will decrease the driver performance.
>>
>
> Compared to what? Compared to a driver that doesn’t grab the spinlock
> and crashes mysteriously every now and then?
>
> You are worried about the wrong metrics.
>
>> Similarly, I have another question that lets suppose CSQ library cancel
>> routine is called which callback routine will be called as to notify the
>> driver that IRP is cancelled.
>>
>
> CsqCompleteCanceledIrp.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
>library cancel routine, it will acquire system wide cancel spinlock. If that
system
wide spinlock is already acquired by some other driver, then it will wait for
the
cancel spinlock. This will decrease the driver performance.
Correct, but pre-CSQ old IoStartPacket-based queue was even worse - it used the
global cancel spinlock to protect the queue itself.
So, not only cancellation, but putting IRP to the queue and taking it from the
queue also needed to take this lock.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
I wrote my own CSQ in 1 day, based on the logic seen in the Walter Oney’s
book, some MS’s guidelines and the common sense 
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
“Gary G. Little” wrote in message
news:xxxxx@ntdev…
> Alternately consider the tiime required NOT to use CSQ in your driver and
> attempt to get IRP cancelling on your own. In about 6 to 7 months you will
> quietly embrace CSQ, or WDF, and never, ever worry about such silly little
> metrics again
>
> –
> The personal opinion of
> Gary G. Little
>
> “Tim Roberts” wrote in message news:xxxxx@ntdev…
> > xxxxx@gmail.com wrote:
> >> I was just reading a document “Flow of control for Cancel-Safe IRP
> >> Queuing”. I am confused about the flow diagram of IoCsqInsertIrp
> >> function. When CSQ library sets its own cancel routine and IRP is
> >> cancelled, CSQ library cancel routine will be called lets suppose. Then,
> >> I/O manager before calling the CSQ library cancel routine, it will
> >> acquire system wide cancel spinlock. If that system wide spinlock is
> >> already acquired by some other driver, then it will wait for the cancel
> >> spinlock. This will decrease the driver performance.
> >>
> >
> > Compared to what? Compared to a driver that doesn’t grab the spinlock
> > and crashes mysteriously every now and then?
> >
> > You are worried about the wrong metrics.
> >
> >> Similarly, I have another question that lets suppose CSQ library cancel
> >> routine is called which callback routine will be called as to notify the
> >> driver that IRP is cancelled.
> >>
> >
> > CsqCompleteCanceledIrp.
> >
> > –
> > Tim Roberts, xxxxx@probo.com
> > Providenza & Boekelheide, Inc.
> >
> >
>
>
>