enabling interrupt and IoConnectInterrupt

Hi,

Could someone please help with this question:

should I enable interrupt first and then call IoConnectInterrupt or vice versa?

Thank you,

Andrew

I’d call IoConnectInterrupt first.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Andrey
Kamchatnikov
Sent: Thursday, July 19, 2007 6:19 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] enabling interrupt and IoConnectInterrupt

Hi,

Could someone please help with this question:

should I enable interrupt first and then call IoConnectInterrupt or vice
versa?

Thank you,

Andrew


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

You never EVER, enable interrupts until you are ready to handle interrupts. Setup all of you processing control, then call IoConnectInterrupt, then enable your interrupts.


The personal opinion of
Gary G. Little

“Andrey Kamchatnikov” wrote in message news:xxxxx@ntdev…
Hi,

Could someone please help with this question:

should I enable interrupt first and then call IoConnectInterrupt or vice versa?

Thank you,

Andrew

Andrey Kamchatnikov wrote:

Could someone please help with this question:

should I enable interrupt first and then call IoConnectInterrupt or
vice versa?

With a little thought, you should be able to answer this for yourself.
If you call them in the order you have there, what happens if your
device generates an interrupt before you connect it? Answer: no driver
in the ISR chain will know how to stop your device from interrupting.
That’s called an interrupt storm, and it will shut down your machine
very efficiently.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

As a point of reference, this is what KMDF does if you use a
WDFINTERRUPT

  1. connect the interrupt via IoConnectInterrupt(Ex)
  2. raise to interrupt DIRQL by acquiring the interrupt spinlock and
    call EvtInterruptEnable. This is where you turn on interrupt
    generation. We raise to DIRQL so that if your device starts
    generating/storming interrupts during your enable code, it won’t storm
    over your interrupt enable code and we have a better chance to recover.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, July 19, 2007 10:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] enabling interrupt and IoConnectInterrupt

Andrey Kamchatnikov wrote:

Could someone please help with this question:

should I enable interrupt first and then call IoConnectInterrupt or
vice versa?

With a little thought, you should be able to answer this for yourself.
If you call them in the order you have there, what happens if your
device generates an interrupt before you connect it? Answer: no driver
in the ISR chain will know how to stop your device from interrupting.
That’s called an interrupt storm, and it will shut down your machine
very efficiently.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

>should I enable interrupt first and then call IoConnectInterrupt or vice
versa?

Vice versa.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com