why does StartIo routine need irp as param?

hi all.

could not the StartIo routine assume that pDevObj->currentIrp field
points to the irp that it is supposed to act upon?

assaf


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

>could not the StartIo routine assume that pDevObj->currentIrp field

points to the irp that it is supposed to act upon?

Yes, it could. This will always be true. The pointer is passed strictly
for convenience. This is done in several other functions as well.

Peter
OSR


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

IIRC there was a window somewhere there where a cancel routine call could sneak in, that's why StartIo is given an explicit IRP pointer.

Max

----- Original Message -----
From: Assaf Wodeslavsky
To: NT Developers Interest List
Sent: Thursday, December 13, 2001 2:36 AM
Subject: [ntdev] why does StartIo routine need irp as param?

hi all.

could not the StartIo routine assume that pDevObj->currentIrp field
points to the irp that it is supposed to act upon?

assaf

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com


You are currently subscribed to ntdev as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com

> Yes, it could. This will always be true. The pointer is passed strictly

for convenience. This is done in several other functions as well.

Code sample in Art Baker’s old book relies on comparison between the parameter and DO->CurrentIrp to detect cancellation.
I remember that I found a bug (a window) in that code though.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

thanks
assaf

----- Original Message -----
From: “Peter Viscarola”
Newsgroups: ntdev
To: “NT Developers Interest List”
Sent: Friday, December 14, 2001 12:48 AM
Subject: [ntdev] Re: why does StartIo routine need irp as param?

> >could not the StartIo routine assume that pDevObj->currentIrp field
> >points to the irp that it is supposed to act upon?
>
> Yes, it could. This will always be true. The pointer is passed strictly
> for convenience. This is done in several other functions as well.
>
> Peter
> OSR
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

ignoring the bug
and cancellation issues
you seem to agree with peter

now, concerning cancellation,
how else would you avoid cancelling the current irp
is there another way?
oney, and osr books all use this method

assaf

----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Friday, December 14, 2001 2:16 AM
Subject: [ntdev] Re: why does StartIo routine need irp as param?

> > Yes, it could. This will always be true. The pointer is passed
strictly
> > for convenience. This is done in several other functions as well.
>
> Code sample in Art Baker’s old book relies on comparison between the
parameter and DO->CurrentIrp to detect cancellation.
> I remember that I found a bug (a window) in that code though.
>
> Max
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

i see you point

if startIo used currentIrp, it might be the wrong irp
and it will crash the system
oney's diagrams on p.207 make this clear

cancelRtn called IoStartNextPacket
a second startIo is now running on another cpu

cancelRtn set the cancel flag to true
assuming the first StartIo will check this flag

startIo must check the flag of the irp it got
and not the current Irp
which might be different

the second StartIo is holding the true current irp

no matter how many times i go over cancellation
i always have to rethink it all

thank you both very much
assaf
----- Original Message -----
From: Maxim S. Shatskih
To: NT Developers Interest List
Sent: Friday, December 14, 2001 2:08 AM
Subject: [ntdev] Re: why does StartIo routine need irp as param?

IIRC there was a window somewhere there where a cancel routine call could sneak in, that's why StartIo is given an explicit IRP pointer.

Max

----- Original Message -----
From: Assaf Wodeslavsky
To: NT Developers Interest List
Sent: Thursday, December 13, 2001 2:36 AM
Subject: [ntdev] why does StartIo routine need irp as param?

hi all.

could not the StartIo routine assume that pDevObj->currentIrp field
points to the irp that it is supposed to act upon?

assaf

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com

You are currently subscribed to ntdev as: xxxxx@hotmail.com
To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com


You are currently subscribed to ntdev as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com

Assaf,

One important point in all of this that you may be unaware of, is that this
issue, while informative, may be irrelevant in a modern driver design. The
canceled IRP in StartIo problem is avoidable if you design your own IRP
queuing methodology and avoid using what we call system IRP queuing. That
is you create your own IRP queues and IRP queue functions to handle queuing
IRPs in your driver. The main reason you want to do this is to avoid using
the system wide cancel spinlock and instead use a unique spinlock for each
queue. This cuts down the use of the system wide cancel spinlock in a
driver somewhere probably on the order of 99%. This is important as the
system wide cancel spinlock is a single spinlock resource used by all
drivers in the system. Microsoft has deemed this a significant bottleneck
on MP systems and highly encourages driver developers to use their own
queuing methodologies. Just FYI.

Bill McKenzie
Software Engineer
bSquare Corporation

On 12/13/01, ““Assaf Wodeslavsky” ” wrote:
>
> i see you point
>
> if startIo used currentIrp, it might be the wrong irp
> and it will crash the system
> oney’s diagrams on p.207 make this clear
>
> cancelRtn called IoStartNextPacket
> a second startIo is now running on another cpu
>
> cancelRtn set the cancel flag to true
> assuming the first StartIo will check this flag
>
> startIo must check the flag of the irp it got
> and not the current Irp
> which might be different
>
> the second StartIo is holding the true current irp
>
>
>
> no matter how many times i go over cancellation
> i always have to rethink it all
>
>
> thank you both very much
> assaf
> ----- Original Message -----=20
> From: Maxim S. Shatskih=20
> To: NT Developers Interest List=20
> Sent: Friday, December 14, 2001 2:08 AM
> Subject: [ntdev] Re: why does StartIo routine need irp as param?
>
>
> IIRC there was a window somewhere there where a cancel routine call =
> could sneak in, that’s why StartIo is given an explicit IRP pointer.
>
> Max
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

thanks
i am asking these basic questions while writing up my course
i have been developing drivers for 6 years sir
jfyi
so i kind of know what you are talking about :slight_smile:

assaf

----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Friday, December 14, 2001 12:40 PM
Subject: [ntdev] Re: why does StartIo routine need irp as param?

> Assaf,
>
> One important point in all of this that you may be unaware of, is that
this
> issue, while informative, may be irrelevant in a modern driver design.
The
> canceled IRP in StartIo problem is avoidable if you design your own IRP
> queuing methodology and avoid using what we call system IRP queuing. That
> is you create your own IRP queues and IRP queue functions to handle
queuing
> IRPs in your driver. The main reason you want to do this is to avoid
using
> the system wide cancel spinlock and instead use a unique spinlock for each
> queue. This cuts down the use of the system wide cancel spinlock in a
> driver somewhere probably on the order of 99%. This is important as the
> system wide cancel spinlock is a single spinlock resource used by all
> drivers in the system. Microsoft has deemed this a significant bottleneck
> on MP systems and highly encourages driver developers to use their own
> queuing methodologies. Just FYI.
>
> Bill McKenzie
> Software Engineer
> bSquare Corporation
>
>
> On 12/13/01, ““Assaf Wodeslavsky” ” wrote:
> >
> > i see you point
> >
> > if startIo used currentIrp, it might be the wrong irp
> > and it will crash the system
> > oney’s diagrams on p.207 make this clear
> >
> > cancelRtn called IoStartNextPacket
> > a second startIo is now running on another cpu
> >
> > cancelRtn set the cancel flag to true
> > assuming the first StartIo will check this flag
> >
> > startIo must check the flag of the irp it got
> > and not the current Irp
> > which might be different
> >
> > the second StartIo is holding the true current irp
> >
> >
> >
> > no matter how many times i go over cancellation
> > i always have to rethink it all
> >
> >
> > thank you both very much
> > assaf
> > ----- Original Message -----=20
> > From: Maxim S. Shatskih=20
> > To: NT Developers Interest List=20
> > Sent: Friday, December 14, 2001 2:08 AM
> > Subject: [ntdev] Re: why does StartIo routine need irp as param?
> >
> >
> > IIRC there was a window somewhere there where a cancel routine call =
> > could sneak in, that’s why StartIo is given an explicit IRP pointer.
> >
> > Max
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com