Extreme ISR Priority

I’m working on a driver for a PCI data acquisition board that will be
used in an industrial process monitoring system. This driver will be
limited in deployment to a couple dozen dedicated process montoring
computers (all uniprocessor) and will not need to be WHQLable, so let’s
not debate all the ramifications of what I’m asking here. I’m exploring
extreme, out of the box ideas to ensure certain performance
requirements.

The external hardware connected to the data acquisition board will be
triggering the board to generate interrupts to the PC at a rate of
around 200 interrupts per second. The ISR needs to reconfigure the
external hardware via the digital I/O capabilities of the data
acqusition board prior to the next interrupt. Not getting the ISR
processed in time prior to the next interrupt could be quite problematic
to the system behavior. There’s not a ton of processing that has to be
done in the ISR, but it does have to be done on time prior to the next
interrupt.

My client has commented that in the past on previous implementations of
this system, they have run into trouble where the interrupt traffic from
a network card installed in the system has resulted in the ISR for the
data acquisition board not getting processed in time. Of course, that
was also on an old system running under DOS, but I want to be sure as
much as possible that for a Win2K/XP solution that the critical ISR will
get processed on time.

So, my question is this: How can I ensure that my ISR has higher
priority than that of other devices in the system, such as the network
card? Since the HAL can arrange the IRQL priorities independent of the
traditional harwdare IRQ priorities, attempting to solve the problem by
simply playing with which board is in which slot in the system and
mucking with the PCI IRQ assignments in the BIOS configuration will not
necessarily work.

So here’s my thought…

What if, when calling IoConnectInterrupt() for my driver, instead of
passing the IRQL provided by PNP (that was obtained from the HAL) for
the Irql and/or SynchronizeIrql parameters I used a higher IRQL that
would be higher than any other installed hardware? In the truly extreme
case, I could use IRQL_HIGH_LEVEL, but perhaps there is a less extreme
choice that would do the job. Ignoring the performance impact on other
things in the system (remember, I’m looking for an extreme solution),
would this work as a solution? Or would this hopelessly screw up the
system?

Note that there isn’t all that much that needs to get done in my ISR, so
it’s not like I’m going to be hanging out there at an extreme IRQL for
extended periods of time. I just need to get the job done ASAP.

Peter & Tony’s NT4 driver book mentions the possibility of an NT driver
temporarily raising it’s IRQL to IRQL_HIGH_LEVEL, so I’m thinking I’m
not too far off base with this idea.

These systems will be running plain vanilla Win2K or XP installations on
more-or-less plain vanilla PCs.

Comments, thoughts, suggestions, other ideas???

  • Jay

Jay Talbott
Principal Consulting Engineer
SysPro Consulting, LLC
3519 E. South Fork Drive
Suite 201
Phoenix, AZ 85044
(480) 704-8045
xxxxx@sysproconsulting.com
http://www.sysproconsulting.com

Maybe I’m too extreme even for you, but I wouldn’t bother about IRQLs. I
would maybe get the IDT slot from the OS in the standard way just to try to
make sure the OS doesn’t muck with it, but then I would frig it with my own
interrupt gate- not a trap gate - so that I’d get control at interrupt time
with interrupts disabled on the interrupted processor, and I’d know that my
interrupt code will run to the end without preemption. The other component
of the equation is to get your interrupt at top priority inside the
interrupt controller, and here again, a little bit of experimentation may
show you how to do it with a few ins and outs.

Hope this helps ! If it doesn’t, just disregard it. :slight_smile:

Alberto.

-----Original Message-----
From: Jay Talbott [mailto:xxxxx@sysproconsulting.com]
Sent: Tuesday, November 12, 2002 1:25 PM
To: NT Developers Interest List
Subject: [ntdev] Extreme ISR Priority

I’m working on a driver for a PCI data acquisition board that will be
used in an industrial process monitoring system. This driver will be
limited in deployment to a couple dozen dedicated process montoring
computers (all uniprocessor) and will not need to be WHQLable, so let’s
not debate all the ramifications of what I’m asking here. I’m exploring
extreme, out of the box ideas to ensure certain performance
requirements.

The external hardware connected to the data acquisition board will be
triggering the board to generate interrupts to the PC at a rate of
around 200 interrupts per second. The ISR needs to reconfigure the
external hardware via the digital I/O capabilities of the data
acqusition board prior to the next interrupt. Not getting the ISR
processed in time prior to the next interrupt could be quite problematic
to the system behavior. There’s not a ton of processing that has to be
done in the ISR, but it does have to be done on time prior to the next
interrupt.

My client has commented that in the past on previous implementations of
this system, they have run into trouble where the interrupt traffic from
a network card installed in the system has resulted in the ISR for the
data acquisition board not getting processed in time. Of course, that
was also on an old system running under DOS, but I want to be sure as
much as possible that for a Win2K/XP solution that the critical ISR will
get processed on time.

So, my question is this: How can I ensure that my ISR has higher
priority than that of other devices in the system, such as the network
card? Since the HAL can arrange the IRQL priorities independent of the
traditional harwdare IRQ priorities, attempting to solve the problem by
simply playing with which board is in which slot in the system and
mucking with the PCI IRQ assignments in the BIOS configuration will not
necessarily work.

So here’s my thought…

What if, when calling IoConnectInterrupt() for my driver, instead of
passing the IRQL provided by PNP (that was obtained from the HAL) for
the Irql and/or SynchronizeIrql parameters I used a higher IRQL that
would be higher than any other installed hardware? In the truly extreme
case, I could use IRQL_HIGH_LEVEL, but perhaps there is a less extreme
choice that would do the job. Ignoring the performance impact on other
things in the system (remember, I’m looking for an extreme solution),
would this work as a solution? Or would this hopelessly screw up the
system?

Note that there isn’t all that much that needs to get done in my ISR, so
it’s not like I’m going to be hanging out there at an extreme IRQL for
extended periods of time. I just need to get the job done ASAP.

Peter & Tony’s NT4 driver book mentions the possibility of an NT driver
temporarily raising it’s IRQL to IRQL_HIGH_LEVEL, so I’m thinking I’m
not too far off base with this idea.

These systems will be running plain vanilla Win2K or XP installations on
more-or-less plain vanilla PCs.

Comments, thoughts, suggestions, other ideas???

  • Jay

Jay Talbott
Principal Consulting Engineer
SysPro Consulting, LLC
3519 E. South Fork Drive
Suite 201
Phoenix, AZ 85044
(480) 704-8045
xxxxx@sysproconsulting.com
http://www.sysproconsulting.com


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to %%email.unsub%%

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

“Jay Talbott” wrote in message
news:xxxxx@ntdev…
>
> I’m working on a driver for a PCI data acquisition board that will be
> used in an industrial process monitoring system. This driver will be
> limited in deployment to a couple dozen dedicated process montoring
> computers (all uniprocessor) and will not need to be WHQLable, so let’s
> not debate all the ramifications of what I’m asking here. I’m exploring
> extreme, out of the box ideas to ensure certain performance
> requirements.
>
> The external hardware connected to the data acquisition board will be
> triggering the board to generate interrupts to the PC at a rate of
> around 200 interrupts per second. The ISR needs to reconfigure the
> external hardware via the digital I/O capabilities of the data
> acqusition board prior to the next interrupt. Not getting the ISR
> processed in time prior to the next interrupt could be quite problematic
> to the system behavior. There’s not a ton of processing that has to be
> done in the ISR, but it does have to be done on time prior to the next
> interrupt.
>
> My client has commented that in the past on previous implementations of
> this system, they have run into trouble where the interrupt traffic from
> a network card installed in the system has resulted in the ISR for the
> data acquisition board not getting processed in time. Of course, that
> was also on an old system running under DOS, but I want to be sure as
> much as possible that for a Win2K/XP solution that the critical ISR will
> get processed on time.
>
> So, my question is this: How can I ensure that my ISR has higher
> priority than that of other devices in the system, such as the network
> card? Since the HAL can arrange the IRQL priorities independent of the
> traditional harwdare IRQ priorities, attempting to solve the problem by
> simply playing with which board is in which slot in the system and
> mucking with the PCI IRQ assignments in the BIOS configuration will not
> necessarily work.
>
> So here’s my thought…
>
> What if, when calling IoConnectInterrupt() for my driver, instead of
> passing the IRQL provided by PNP (that was obtained from the HAL) for
> the Irql and/or SynchronizeIrql parameters I used a higher IRQL that
> would be higher than any other installed hardware? In the truly extreme
> case, I could use IRQL_HIGH_LEVEL, but perhaps there is a less extreme
> choice that would do the job. Ignoring the performance impact on other
> things in the system (remember, I’m looking for an extreme solution),
> would this work as a solution? Or would this hopelessly screw up the
> system?
>
> Note that there isn’t all that much that needs to get done in my ISR, so
> it’s not like I’m going to be hanging out there at an extreme IRQL for
> extended periods of time. I just need to get the job done ASAP.
>
> Peter & Tony’s NT4 driver book mentions the possibility of an NT driver
> temporarily raising it’s IRQL to IRQL_HIGH_LEVEL, so I’m thinking I’m
> not too far off base with this idea.

This will prevent anyone from interrupting you while you are processing your
ISR, but it won’t do anything to get your ISR to interrupt the ATAPI
driver’s ISR while servicing a 64KB PIO read from a CDROM. (Not that I
think that’s likely in your scenario, I just wanted to point out a concrete
example of an ISR that is truly a pig of obnoxous nature.) You have to
ensure that your ISR gets to interrupt any other hardware’s ISR. For that
you have to elevate your priority level when you connect your interrupt, as
you discussed above. However, I’ve never tried anything like that, so I
don’t know if the means you proposed will actually work.

> These systems will be running plain vanilla Win2K or XP installations on
> more-or-less plain vanilla PCs.

OK, here is where you will probably run into corner cases that will kill
you once in a blue moon. If you need a real-time system, where RT is
defined as deterministic ISR latencies, among other things, you’ll need to
use an RTOS. There are real-time extensions to Windows that can probably
make it good enough. At the very least, you will probably need to limit or
even specify any hardware installed to minimize the probability of piggish
ISRs.

You said this is process monitoring equipment, so it’s mission-critical, to
some degree or other. Depending on the process, this could be life-safety
equipment, so throwing an arbitrary white box with an untuned OS on it into
that usage could be a recipe for disaster. It might be appropriate to at
least revisit the hardware requirements and ensure that you really don’t
need anything more robust.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842

I think you may not need anything extrame at all. NT/2k/XP has plenty room
for handling interrupt at 200/s. The most important thing is to estimate the
interrupt latency. In other word, what is the maximum time you have to
respond to an interrupt when the interrupt is asserted. The NT/2k/XP
typically has an average 50us response time. If it is like you said you have
to reprogram the board before next interrupt, it means you have 5ms, plenty
of time even for fat OS like NT/2k/XP.

The DOS does not work well because DOS is not multitasking OS, Network and
Disk IO have to be done in interrupt handler, for example. NT/2k/XP are
different, all most all interrupt handler (for recent hardware) does very
little in interrupt handler. Most works are done in DPC. If you use latest
PC, you are rest to be sure that IDE controller use DMA are used for CD/DVD.

If you are afraid that your interrupt handler get interrupt by higher
priority interrupt handler, you can raise IRQL in you interrupt handler than
lower it before it exits, or using asm cli/sti pair, no big deal there. You
won’t hurt anyone if you just do a few IO there.

If the task is extramely critical, such as if you don’t serve it on time,
some catastrophic thing would happen. I would not even use PC at all and
Windows at all. Since those things are subject to crash. I would use SBC
(Single Board Computer, X86 or some thing else) and RTOS. But the fact that
the older software is implemented in DOS says it isn’t that kind of
critical. Otherwise, I would use fault tolerated PC from Straus or NEC.

If I were you, I would just implement it to see how things go. If thing
works just fine, most likely, It would be all set. Otherwise, I would look
at from chipset spec to see how PCI interrupts are routed based on slot
number and pick a slot that its INTA# is not shared by other devices or is
least shared. (all most all the time they follow Intel multiprocessor spec).
I think NT gives all the PCI interrupts the same priority, I mean those
routed to IOAPIC INTR#15 or above (legacy interrupts such as IDE controller
are routed to the legacy INTR#). Microsoft people should correct me if I am
wrong so the disinformation can be stop short. It would be benificial if
Microsoft can show us how the hardware interrupt is mapped to IRQL. I
remember SoftICE manaul has some mention to it but don’t have it off-hand.

What you mentioned hack in IoConnectInterrupt will not work, if you
understand interrupt hardware such as IOAPIC and Local APIC. The interrupt
request lines (INTR) hook to IOAPIC pretty much follows Intel spec. OS maps
IOAPIC INTR (line) to certain interrupt vectors. Unless you know where the
map is stored, alter that map and reprogram IOAPIC, Local APIC, IDT to
reflect your new mapping, I doubt you can cheat OS on that.

If those lower hanging fruits is not enough, it is time to buy RT extension
of NT/2k/XP. That will definitely do for you. What RT extension does is to
only give rest of OS a chance to run if its assigned interrupts and threads
are idle. It does so by reprogram its assigned INTR to highest priority
interrupt vectors and if its interrupts are active, it mask off all the
others. Those RT extension guys spent big bugs for Microsoft source code
license.

Bi

-----Original Message-----
From: Phil Barila [mailto:xxxxx@Seagate.com]
Sent: Tuesday, November 12, 2002 10:49 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Extreme ISR Priority

“Jay Talbott” wrote in message
news:xxxxx@ntdev…
>
> I’m working on a driver for a PCI data acquisition board that will be
> used in an industrial process monitoring system. This driver will be
> limited in deployment to a couple dozen dedicated process montoring
> computers (all uniprocessor) and will not need to be WHQLable, so let’s
> not debate all the ramifications of what I’m asking here. I’m exploring
> extreme, out of the box ideas to ensure certain performance
> requirements.
>
> The external hardware connected to the data acquisition board will be
> triggering the board to generate interrupts to the PC at a rate of
> around 200 interrupts per second. The ISR needs to reconfigure the
> external hardware via the digital I/O capabilities of the data
> acqusition board prior to the next interrupt. Not getting the ISR
> processed in time prior to the next interrupt could be quite problematic
> to the system behavior. There’s not a ton of processing that has to be
> done in the ISR, but it does have to be done on time prior to the next
> interrupt.
>
> My client has commented that in the past on previous implementations of
> this system, they have run into trouble where the interrupt traffic from
> a network card installed in the system has resulted in the ISR for the
> data acquisition board not getting processed in time. Of course, that
> was also on an old system running under DOS, but I want to be sure as
> much as possible that for a Win2K/XP solution that the critical ISR will
> get processed on time.
>
> So, my question is this: How can I ensure that my ISR has higher
> priority than that of other devices in the system, such as the network
> card? Since the HAL can arrange the IRQL priorities independent of the
> traditional harwdare IRQ priorities, attempting to solve the problem by
> simply playing with which board is in which slot in the system and
> mucking with the PCI IRQ assignments in the BIOS configuration will not
> necessarily work.
>
> So here’s my thought…
>
> What if, when calling IoConnectInterrupt() for my driver, instead of
> passing the IRQL provided by PNP (that was obtained from the HAL) for
> the Irql and/or SynchronizeIrql parameters I used a higher IRQL that
> would be higher than any other installed hardware? In the truly extreme
> case, I could use IRQL_HIGH_LEVEL, but perhaps there is a less extreme
> choice that would do the job. Ignoring the performance impact on other
> things in the system (remember, I’m looking for an extreme solution),
> would this work as a solution? Or would this hopelessly screw up the
> system?
>
> Note that there isn’t all that much that needs to get done in my ISR, so
> it’s not like I’m going to be hanging out there at an extreme IRQL for
> extended periods of time. I just need to get the job done ASAP.
>
> Peter & Tony’s NT4 driver book mentions the possibility of an NT driver
> temporarily raising it’s IRQL to IRQL_HIGH_LEVEL, so I’m thinking I’m
> not too far off base with this idea.

This will prevent anyone from interrupting you while you are processing your
ISR, but it won’t do anything to get your ISR to interrupt the ATAPI
driver’s ISR while servicing a 64KB PIO read from a CDROM. (Not that I
think that’s likely in your scenario, I just wanted to point out a concrete
example of an ISR that is truly a pig of obnoxous nature.) You have to
ensure that your ISR gets to interrupt any other hardware’s ISR. For that
you have to elevate your priority level when you connect your interrupt, as
you discussed above. However, I’ve never tried anything like that, so I
don’t know if the means you proposed will actually work.

> These systems will be running plain vanilla Win2K or XP installations on
> more-or-less plain vanilla PCs.

OK, here is where you will probably run into corner cases that will kill
you once in a blue moon. If you need a real-time system, where RT is
defined as deterministic ISR latencies, among other things, you’ll need to
use an RTOS. There are real-time extensions to Windows that can probably
make it good enough. At the very least, you will probably need to limit or
even specify any hardware installed to minimize the probability of piggish
ISRs.

You said this is process monitoring equipment, so it’s mission-critical, to
some degree or other. Depending on the process, this could be life-safety
equipment, so throwing an arbitrary white box with an untuned OS on it into
that usage could be a recipe for disaster. It might be appropriate to at
least revisit the hardware requirements and ensure that you really don’t
need anything more robust.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842


You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%

While I certainly hesitate to endorse an approach to writing a driver that
amounts to deciding that your device exists at the expense of all the others
in the system, at the very least I’d like to explain how to use
IoConnectInterrupt in a non-destructive manner.

What you want to do is specify (CLOCK_LEVEL - 1) for the SynchronizeIrql
parameter. This will cause the kernel to raise IRQL after taking your
interrupt to the highest device level, blocking out interrupts from all
other devices, while still letting things like clock ticks through.

SynchronizeIrql is intended for devices that need their ISRs to be called at
the same level as the ISR from another device. But it will do what you
want, too.

As a final note, changing the Irql parameter to IoConnectInterrupt will
probably lead to a machine that deadlocks itself, if IoConnectInterrupt even
succeeds.


Jake Oshins
Windows Kernel Group

This posting is provided “AS IS” with no warranties, and confers no rights.

“Jay Talbott” wrote in message
news:xxxxx@ntdev…
>
> I’m working on a driver for a PCI data acquisition board that will be
> used in an industrial process monitoring system. This driver will be
> limited in deployment to a couple dozen dedicated process montoring
> computers (all uniprocessor) and will not need to be WHQLable, so let’s
> not debate all the ramifications of what I’m asking here. I’m exploring
> extreme, out of the box ideas to ensure certain performance
> requirements.
>
> The external hardware connected to the data acquisition board will be
> triggering the board to generate interrupts to the PC at a rate of
> around 200 interrupts per second. The ISR needs to reconfigure the
> external hardware via the digital I/O capabilities of the data
> acqusition board prior to the next interrupt. Not getting the ISR
> processed in time prior to the next interrupt could be quite problematic
> to the system behavior. There’s not a ton of processing that has to be
> done in the ISR, but it does have to be done on time prior to the next
> interrupt.
>
> My client has commented that in the past on previous implementations of
> this system, they have run into trouble where the interrupt traffic from
> a network card installed in the system has resulted in the ISR for the
> data acquisition board not getting processed in time. Of course, that
> was also on an old system running under DOS, but I want to be sure as
> much as possible that for a Win2K/XP solution that the critical ISR will
> get processed on time.
>
> So, my question is this: How can I ensure that my ISR has higher
> priority than that of other devices in the system, such as the network
> card? Since the HAL can arrange the IRQL priorities independent of the
> traditional harwdare IRQ priorities, attempting to solve the problem by
> simply playing with which board is in which slot in the system and
> mucking with the PCI IRQ assignments in the BIOS configuration will not
> necessarily work.
>
> So here’s my thought…
>
> What if, when calling IoConnectInterrupt() for my driver, instead of
> passing the IRQL provided by PNP (that was obtained from the HAL) for
> the Irql and/or SynchronizeIrql parameters I used a higher IRQL that
> would be higher than any other installed hardware? In the truly extreme
> case, I could use IRQL_HIGH_LEVEL, but perhaps there is a less extreme
> choice that would do the job. Ignoring the performance impact on other
> things in the system (remember, I’m looking for an extreme solution),
> would this work as a solution? Or would this hopelessly screw up the
> system?
>
> Note that there isn’t all that much that needs to get done in my ISR, so
> it’s not like I’m going to be hanging out there at an extreme IRQL for
> extended periods of time. I just need to get the job done ASAP.
>
> Peter & Tony’s NT4 driver book mentions the possibility of an NT driver
> temporarily raising it’s IRQL to IRQL_HIGH_LEVEL, so I’m thinking I’m
> not too far off base with this idea.
>
> These systems will be running plain vanilla Win2K or XP installations on
> more-or-less plain vanilla PCs.
>
> Comments, thoughts, suggestions, other ideas???
>
> - Jay
>
> Jay Talbott
> Principal Consulting Engineer
> SysPro Consulting, LLC
> 3519 E. South Fork Drive
> Suite 201
> Phoenix, AZ 85044
> (480) 704-8045
> xxxxx@sysproconsulting.com
> http://www.sysproconsulting.com
>
>
>
>

RE: [ntdev] Re: Extreme ISR Priority"Bi Chen" wrote in message news:xxxxx@ntdev…
The DOS does not work well because DOS is not multitasking OS, Network and Disk IO have to be done in interrupt handler, for example. NT/2k/XP are different, all most all interrupt handler (for recent hardware) does very little in interrupt handler. Most works are done in DPC. If you use latest PC, you are rest to be sure that IDE controller use DMA are used for CD/DVD.

Not disagreeing with most of your post, but CD/DVD defaults to PIO, even on Windows XP. You can tell the system to use DMA, but the installation default is PIO. Every XP system I’ve installed has been this way.

More importantly, the various flavors of storage port drivers are “special”, in that all of the important work happens in the miniport, and except for the Enable/DisableInterrupts pair, everything happens at DIRQL, so it’s effectively all ISR. And ATAPI is just a modified SCSIPORT, ATAPI, and a few other things thrown in, linked into one binary. It’s subject to the same perversities of all the other storage port drivers. This is easily seen by dumping the strings from atapi.pdb for the XP or W2K version of that driver. Or if you really want to dig, bp all the StartIo routines, there are several. look at IRQL then.

Prior to XP SP1, if there were enough errors on the ATA bus while using DMA, the system would regress to PIO, and the only way to fix it was to delete the channel from Device Manager and let it be redetected. Then you could set it to DMA again. I’ve had this happen to one of my systems with a flaky CDRW.

I don’t know if SP1 will allow you to re-enable DMA without the removal / redetect sequence. I’ve heard rumors that SP1 will actually re-enable DMA after some number of successful PIOs, in the same way that it supposedly manages SCSI speed by degrading on errors and then upgrading after some number of successful IOs. I’ve not tested either of these claimed behaviors.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
E-mail address is pointed at a domain squatter. Use reply-to instead.

Also, setting the SynchronizeIrql will not prevent the original problem,
as the interrupt is delivered to the APIC at its normal irq, is routed
to a cpu based on this irq, and the OS only gets to SynchronizeIrql
inside the OS isr pre-amble. Consequently delivery of this interrupt to
a cpu can be delayed by higher priorty interrupt requests.

Did anyone ever mention that NT is not a real time operating system?

The best suggestion I saw here was to qualify specific platforms with
specific hardware configurations, known through testing to meet the isr
service latency requirements of the product.

Also - I think Mr. Oshins mentioned here a while ago that XP does a much
better job of not plopping all the pci interrupts onto one IRQL level,
so perhaps XP or later would be a good base requirement for the product.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Jake Oshins”
To: “NT Developers Interest List”
Date: Wed, 13 Nov 2002 10:33:28 -0800
Subject: [ntdev] Re: Extreme ISR Priority

> While I certainly hesitate to endorse an approach to writing a driver
> that
> amounts to deciding that your device exists at the expense of all the
> others
> in the system, at the very least I’d like to explain how to use
> IoConnectInterrupt in a non-destructive manner.
>
> What you want to do is specify (CLOCK_LEVEL - 1) for the
> SynchronizeIrql
> parameter. This will cause the kernel to raise IRQL after taking your
> interrupt to the highest device level, blocking out interrupts from all
> other devices, while still letting things like clock ticks through.
>
> SynchronizeIrql is intended for devices that need their ISRs to be
> called at
> the same level as the ISR from another device. But it will do what you
> want, too.
>
> As a final note, changing the Irql parameter to IoConnectInterrupt will
> probably lead to a machine that deadlocks itself, if IoConnectInterrupt
> even
> succeeds.
>
> –
> Jake Oshins
> Windows Kernel Group
>
> This posting is provided “AS IS” with no warranties, and confers no
> rights.
>
> “Jay Talbott” wrote in message
> news:xxxxx@ntdev…
> >
> > I’m working on a driver for a PCI data acquisition board that will be
> > used in an industrial process monitoring system. This driver will be
> > limited in deployment to a couple dozen dedicated process montoring
> > computers (all uniprocessor) and will not need to be WHQLable, so
> let’s
> > not debate all the ramifications of what I’m asking here. I’m
> exploring
> > extreme, out of the box ideas to ensure certain performance
> > requirements.
> >
> > The external hardware connected to the data acquisition board will be
> > triggering the board to generate interrupts to the PC at a rate of
> > around 200 interrupts per second. The ISR needs to reconfigure the
> > external hardware via the digital I/O capabilities of the data
> > acqusition board prior to the next interrupt. Not getting the ISR
> > processed in time prior to the next interrupt could be quite
> problematic
> > to the system behavior. There’s not a ton of processing that has to
> be
> > done in the ISR, but it does have to be done on time prior to the
> next
> > interrupt.
> >
> > My client has commented that in the past on previous implementations
> of
> > this system, they have run into trouble where the interrupt traffic
> from
> > a network card installed in the system has resulted in the ISR for
> the
> > data acquisition board not getting processed in time. Of course,
> that
> > was also on an old system running under DOS, but I want to be sure as
> > much as possible that for a Win2K/XP solution that the critical ISR
> will
> > get processed on time.
> >
> > So, my question is this: How can I ensure that my ISR has higher
> > priority than that of other devices in the system, such as the
> network
> > card? Since the HAL can arrange the IRQL priorities independent of
> the
> > traditional harwdare IRQ priorities, attempting to solve the problem
> by
> > simply playing with which board is in which slot in the system and
> > mucking with the PCI IRQ assignments in the BIOS configuration will
> not
> > necessarily work.
> >
> > So here’s my thought…
> >
> > What if, when calling IoConnectInterrupt() for my driver, instead of
> > passing the IRQL provided by PNP (that was obtained from the HAL) for
> > the Irql and/or SynchronizeIrql parameters I used a higher IRQL that
> > would be higher than any other installed hardware? In the truly
> extreme
> > case, I could use IRQL_HIGH_LEVEL, but perhaps there is a less
> extreme
> > choice that would do the job. Ignoring the performance impact on
> other
> > things in the system (remember, I’m looking for an extreme solution),
> > would this work as a solution? Or would this hopelessly screw up the
> > system?
> >
> > Note that there isn’t all that much that needs to get done in my ISR,
> so
> > it’s not like I’m going to be hanging out there at an extreme IRQL
> for
> > extended periods of time. I just need to get the job done ASAP.
> >
> > Peter & Tony’s NT4 driver book mentions the possibility of an NT
> driver
> > temporarily raising it’s IRQL to IRQL_HIGH_LEVEL, so I’m thinking I’m
> > not too far off base with this idea.
> >
> > These systems will be running plain vanilla Win2K or XP installations
> on
> > more-or-less plain vanilla PCs.
> >
> > Comments, thoughts, suggestions, other ideas???
> >
> > - Jay
> >
> > Jay Talbott
> > Principal Consulting Engineer
> > SysPro Consulting, LLC
> > 3519 E. South Fork Drive
> > Suite 201
> > Phoenix, AZ 85044
> > (480) 704-8045
> > xxxxx@sysproconsulting.com
> > http://www.sysproconsulting.com
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%

You are right. I have seen this on my Pentium-III. However, I have not seen
this ever happened to my Pentium-IV. So I assume he could choose to use
latest PC and while his program is running, not leaving a CD in the PC
CD/DVD drive. The latest PC all use 80pin IDE ribbon cable on the primary
IDE controller with offer much cleaner signal.

I have not looked into this. Is XP SP1 supposed to use IDE minidriver
instead of the brain-dead SCSI miniport, or Longhone would be the candidate?

Bi

-----Original Message-----
From: Phil Barila [mailto:xxxxx@Seagate.com]
Sent: Wednesday, November 13, 2002 10:48 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Extreme ISR Priority

“Bi Chen” < xxxxx@AppStream.com mailto:xxxxx > wrote in
message news:xxxxx@ntdev news:xxxxx

The DOS does not work well because DOS is not multitasking OS, Network and
Disk IO have to be done in interrupt handler, for example. NT/2k/XP are
different, all most all interrupt handler (for recent hardware) does very
little in interrupt handler. Most works are done in DPC. If you use latest
PC, you are rest to be sure that IDE controller use DMA are used for CD/DVD.

Not disagreeing with most of your post, but CD/DVD defaults to PIO, even on
Windows XP. You can tell the system to use DMA, but the installation
default is PIO. Every XP system I’ve installed has been this way.

More importantly, the various flavors of storage port drivers are “special”,
in that all of the important work happens in the miniport, and except for
the Enable/DisableInterrupts pair, everything happens at DIRQL, so it’s
effectively all ISR. And ATAPI is just a modified SCSIPORT, ATAPI, and a
few other things thrown in, linked into one binary. It’s subject to the
same perversities of all the other storage port drivers. This is easily
seen by dumping the strings from atapi.pdb for the XP or W2K version of that
driver. Or if you really want to dig, bp all the StartIo routines, there
are several. look at IRQL then.

Prior to XP SP1, if there were enough errors on the ATA bus while using DMA,
the system would regress to PIO, and the only way to fix it was to delete
the channel from Device Manager and let it be redetected. Then you could
set it to DMA again. I’ve had this happen to one of my systems with a flaky
CDRW.

I don’t know if SP1 will allow you to re-enable DMA without the removal /
redetect sequence. I’ve heard rumors that SP1 will actually re-enable DMA
after some number of successful PIOs, in the same way that it supposedly
manages SCSI speed by degrading on errors and then upgrading after some
number of successful IOs. I’ve not tested either of these claimed
behaviors.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
E-mail address is pointed at a domain squatter. Use reply-to instead.

You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%</news:xxxxx></mailto:xxxxx>

Is this (downgrading from DMA to PIO) a possibility in Win2K? WinNT 4? We have witnessed systems that have inexplicably “slowed down”. How can one tell this is happening? Look at a registry key? (Which?) How can it be reset? (Another Registry key?)

Thanks,

John Miramonti
CTO
Livingston & Co., Inc.
8 Commerce Avenue
West Lebanon, NH 03784
603 298 9600
603 298 7878 Fax

-----Original Message-----
From: Bi Chen [mailto:xxxxx@AppStream.com]
Sent: Wednesday, November 13, 2002 2:03 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Extreme ISR Priority

You are right. I have seen this on my Pentium-III. However, I have not seen this ever happened to my Pentium-IV. So I assume he could choose to use latest PC and while his program is running, not leaving a CD in the PC CD/DVD drive. The latest PC all use 80pin IDE ribbon cable on the primary IDE controller with offer much cleaner signal.

I have not looked into this. Is XP SP1 supposed to use IDE minidriver instead of the brain-dead SCSI miniport, or Longhone would be the candidate?

Bi

-----Original Message-----
From: Phil Barila [mailto:xxxxx@Seagate.com]
Sent: Wednesday, November 13, 2002 10:48 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Extreme ISR Priority

“Bi Chen” < xxxxx@AppStream.com> wrote in message news:xxxxx@ntdev…

The DOS does not work well because DOS is not multitasking OS, Network and Disk IO have to be done in interrupt handler, for example. NT/2k/XP are different, all most all interrupt handler (for recent hardware) does very little in interrupt handler. Most works are done in DPC. If you use latest PC, you are rest to be sure that IDE controller use DMA are used for CD/DVD.

Not disagreeing with most of your post, but CD/DVD defaults to PIO, even on Windows XP. You can tell the system to use DMA, but the installation default is PIO. Every XP system I’ve installed has been this way.

More importantly, the various flavors of storage port drivers are “special”, in that all of the important work happens in the miniport, and except for the Enable/DisableInterrupts pair, everything happens at DIRQL, so it’s effectively *all* ISR. And ATAPI is just a modified SCSIPORT, ATAPI, and a few other things thrown in, linked into one binary. It’s subject to the same perversities of all the other storage port drivers. This is easily seen by dumping the strings from atapi.pdb for the XP or W2K version of that driver. Or if you really want to dig, bp all the StartIo routines, there are several. look at IRQL then.

Prior to XP SP1, if there were enough errors on the ATA bus while using DMA, the system would regress to PIO, and the only way to fix it was to delete the channel from Device Manager and let it be redetected. Then you could set it to DMA again. I’ve had this happen to one of my systems with a flaky CDRW.

I don’t know if SP1 will allow you to re-enable DMA without the removal / redetect sequence. I’ve heard rumors that SP1 will actually re-enable DMA after some number of successful PIOs, in the same way that it supposedly manages SCSI speed by degrading on errors and then upgrading after some number of successful IOs. I’ve not tested either of these claimed behaviors.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842
E-mail address is pointed at a domain squatter. Use reply-to instead.

You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@livco.com
To unsubscribe send a blank email to %%email.unsub%%

RE: [ntdev] Re: Extreme ISR PriorityI’ve heard that Windows 2000 does this,
though I haven’t seen it myself. I think the first I heard of anything like
this was a Windows 2000 server slowing down the SCSI bus in response to
errors. That might have even been on this list, though it might be in one
of the newsgroups. I don’t know about NT4, I haven’t looked at that beast
in a long time. However, I do remember that the DMA support in NT4 was
somewhat fragile, and that you had to enable it with a gadget from the
ResKit (DMACheck?) or something like that.

To find out what mode your CD/DVD is in on W2K/XP, open the device manager,
select the ATA channel on which the device resides, and open the
Properties -> Advanced Settings tab. It will show you the Current Transfer
Mode.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842

“Miramonti, John” wrote in message
news:xxxxx@ntdev…
Is this (downgrading from DMA to PIO) a possibility in Win2K? WinNT 4? We
have witnessed systems that have inexplicably “slowed down”. How can one
tell this is happening? Look at a registry key? (Which?) How can it be
reset? (Another Registry key?)

RE: [ntdev] Re: Extreme ISR PriorityIf you’ve seen XP install with DMA
enabled by default, that’s the first I’ve heard of it, regardless of the
cable. I should throw in the caveat that my experience only applies to
those ATA HBAs that ATAPI supports directly, not to ATA HBAs that provide
their own SCSI miniport, such as a Promise.

The XP SP1 atapi driver removes all reference to SCSIPORT, all of the port
level routines are now called IdePort. It’s still all smashed together into
one binary, with that PCIIDEX mini-miniport thing, and the PCIIDE minidriver
still there.

I don’t know if IdePort as a miniport interface will appear in .NET server,
or in the follow-on to XP. I would guess the latter, since IDEPORT doesn’t
show up at all in a full search of the MSDN site, and STORPORT does, plenty
of times. So IdePort probably isn’t in the current DDK, so it’s probably
not in the server, either.

Phil

Philip D. Barila
Seagate Technology, LLC
(720) 684-1842

“Bi Chen” wrote in message news:xxxxx@ntdev…
You are right. I have seen this on my Pentium-III. However, I have not seen
this ever happened to my Pentium-IV. So I assume he could choose to use
latest PC and while his program is running, not leaving a CD in the PC
CD/DVD drive. The latest PC all use 80pin IDE ribbon cable on the primary
IDE controller with offer much cleaner signal.

I have not looked into this. Is XP SP1 supposed to use IDE minidriver
instead of the brain-dead SCSI miniport, or Longhone would be the candidate?

> -----Original Message-----

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
Sent: Wednesday, November 13, 2002 11:33 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Extreme ISR Priority

While I certainly hesitate to endorse an approach to writing
a driver that
amounts to deciding that your device exists at the expense of
all the others
in the system, at the very least I’d like to explain how to use
IoConnectInterrupt in a non-destructive manner.

Remember that this driver is being developed for a special purpose
application that will never be widely distributed. Under normal
operating conditions, all that will ever be running on this machine
other than the basics of Windows is my driver for the data acquisition
board and a user-mode service which allows users on other machines to
access the driver via the network.

My client wants to use mainstream components (HW and OS), which is why
this is being done on a PC with Windows 2K/XP and not as a custom
embedded system using an RTOS. What I need to do should be doable with
Windows assuming I can twiddle things to ensure that my ISR gets
processed on time. There is PLENTY of processing power in a modern PC
to do what we need to do on this machine (their original DOS
implementation originally ran on a 10 MHz 286 back in the dark ages of
computing). I just need my ISR to be top dog over any other “piggy”
ISRs.

What you want to do is specify (CLOCK_LEVEL - 1) for the
SynchronizeIrql
parameter. This will cause the kernel to raise IRQL after taking your
interrupt to the highest device level, blocking out
interrupts from all
other devices, while still letting things like clock ticks through.

SynchronizeIrql is intended for devices that need their ISRs
to be called at
the same level as the ISR from another device. But it will
do what you
want, too.

Will that cause my ISR to preempt any currently running ISR that might
have a DIRQL greater than my IRQL that I got from the HAL that I passed
to the Irql parameter to IoConnectInterrupt(), or will I still have to
wait until that ISR completes before I get raised up to CLOCK_LEVEL-1?
In other words, does this give me the power to preempt other ISRs that
have a DIRQL greater than my DIRQL, or does it just prevent them from
preempting mine once mine gets going?

As a final note, changing the Irql parameter to
IoConnectInterrupt will
probably lead to a machine that deadlocks itself, if
IoConnectInterrupt even
succeeds.

So, if I understand what you’re saying here, I absolutely have to put
the IRQL I received from the HAL in for the Irql parameter or the system
will be totally fubar, right?

Is there any way to influence what IRQL the HAL will assign to my device
that might help my ISR be highest priority over other HW in the system?

  • Jay

Jay Talbott
Principal Consulting Engineer
SysPro Consulting, LLC
3519 E. South Fork Drive
Suite 201
Phoenix, AZ 85044
(480) 704-8045
xxxxx@sysproconsulting.com
http://www.sysproconsulting.com

Jay,

As I recall, DIRQL starts at about 3 and goes up to about 17 (??). Any IRQL
above that will not be associated with a device. (… shoulders hunched …
waiting for the slap across the head …)


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105

“Jay Talbott” wrote in message
news:xxxxx@ntdev…
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
> > Sent: Wednesday, November 13, 2002 11:33 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Extreme ISR Priority
> >
> >
> > While I certainly hesitate to endorse an approach to writing
> > a driver that
> > amounts to deciding that your device exists at the expense of
> > all the others
> > in the system, at the very least I’d like to explain how to use
> > IoConnectInterrupt in a non-destructive manner.
> >
>
> Remember that this driver is being developed for a special purpose
> application that will never be widely distributed. Under normal
> operating conditions, all that will ever be running on this machine
> other than the basics of Windows is my driver for the data acquisition
> board and a user-mode service which allows users on other machines to
> access the driver via the network.
>
> My client wants to use mainstream components (HW and OS), which is why
> this is being done on a PC with Windows 2K/XP and not as a custom
> embedded system using an RTOS. What I need to do should be doable with
> Windows assuming I can twiddle things to ensure that my ISR gets
> processed on time. There is PLENTY of processing power in a modern PC
> to do what we need to do on this machine (their original DOS
> implementation originally ran on a 10 MHz 286 back in the dark ages of
> computing). I just need my ISR to be top dog over any other “piggy”
> ISRs.
>
> > What you want to do is specify (CLOCK_LEVEL - 1) for the
> > SynchronizeIrql
> > parameter. This will cause the kernel to raise IRQL after taking your
> > interrupt to the highest device level, blocking out
> > interrupts from all
> > other devices, while still letting things like clock ticks through.
> >
> > SynchronizeIrql is intended for devices that need their ISRs
> > to be called at
> > the same level as the ISR from another device. But it will
> > do what you
> > want, too.
> >
>
> Will that cause my ISR to preempt any currently running ISR that might
> have a DIRQL greater than my IRQL that I got from the HAL that I passed
> to the Irql parameter to IoConnectInterrupt(), or will I still have to
> wait until that ISR completes before I get raised up to CLOCK_LEVEL-1?
> In other words, does this give me the power to preempt other ISRs that
> have a DIRQL greater than my DIRQL, or does it just prevent them from
> preempting mine once mine gets going?
>
> > As a final note, changing the Irql parameter to
> > IoConnectInterrupt will
> > probably lead to a machine that deadlocks itself, if
> > IoConnectInterrupt even
> > succeeds.
> >
>
> So, if I understand what you’re saying here, I absolutely have to put
> the IRQL I received from the HAL in for the Irql parameter or the system
> will be totally fubar, right?
>
> Is there any way to influence what IRQL the HAL will assign to my device
> that might help my ISR be highest priority over other HW in the system?
>
> - Jay
>
> Jay Talbott
> Principal Consulting Engineer
> SysPro Consulting, LLC
> 3519 E. South Fork Drive
> Suite 201
> Phoenix, AZ 85044
> (480) 704-8045
> xxxxx@sysproconsulting.com
> http://www.sysproconsulting.com
>
>
>
>
>

If you look at the NTDEV archives, you’ll notice I brought up the same
subject back in September of this year.

I too have a device that interrupts 200 times per second. The only problem
I’ve had regarding timely servicing of those interrupts has been related to
the ATAPI driver’s ISR hogging the CPU for PIO devices.

The problem only occurred on systems that enabled the APIC. Systems using
the PIC didn’t experience any problem. This was because the priority of
each IRQ has a fixed relationship with its IRQ number. I believe IRQ
priority in PIC based systems is (highest to lowest) 0, 1, 8, 9, 10, 11,
12, 13, 14, 15, 3, 4, 5, 6, 7. The IDE controller interrupts are always
routed to IRQ 14 & 15 in such systems. Therefore, if you can get IRQ 9,
10, or 11, you can avoid the ATAPI problems I faced. Maybe you can handle
IRP_MN_FILTER_RESOURCE_REQUIREMENTS to report support for certain IRQs only.

If your (single CPU) machine is a P4, Windows probably chose to activate
the APIC. In other words, the setup program chose to install the APIC HAL
(original file name: halaacpi.dll). My guess is that MS avoided the APIC
on earlier single CPU machines because they feared the platform designers
wouldn’t implement the APIC bus. P4 based machines don’t require a
dedicated APIC bus.

Anyway, if the APIC is enabled on your system, you can forget about the
fixed IRQ to IRQL mapping. I do recall having success reverting such
systems to the PIC. I did that by replacing HAL.DLL with the PIC version
of HAL.DLL and rebooting. I obtained the replacement HAL from another (P3
or earlier) machine running the same OS.

I suspect you may have to get into the IDT, etc. You may also need to mess
with some fields in your KINTERRUPT object. I’ve done it before but I
don’t remember the details. I did figure out some of the fields in Win2K’s
KINTERRUPT objects and I even wrote it down. Here it is if it helps:

KINTERRUPT:
Offset Contents Comment
+0x04 LIST_ENTRY forward pointer to next KINTERRUPT object
+0x08 LIST_ENTRY backward pointer to previous KINTERRUPT object

+0x0C PKSERVICE_ROUTINE Pointer to the ISR
+0x10 PVOID Pointer to the ISR’s context

+0x24 DWORD Vector number
+0x28 IRQL
+0x29 SyncIRQL

I believe I had to monkey with the last three fields in addition to fooling
around with the IDT and/or APIC.

Good luck !

At 12:00 AM 11/14/2002 , you wrote:
>Subject: Re: Extreme ISR Priority
>From: “Jay Talbott”
>>Date: Wed, 13 Nov 2002 18:34:29 -0700
>>X-Message-Number: 29
>>
>> > -----Original Message-----
>> > From: xxxxx@lists.osr.com
>> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
>> > Sent: Wednesday, November 13, 2002 11:33 AM
>> > To: NT Developers Interest List
>> > Subject: [ntdev] Re: Extreme ISR Priority
>> >
>> >
>> > While I certainly hesitate to endorse an approach to writing
>> > a driver that
>> > amounts to deciding that your device exists at the expense of
>> > all the others
>> > in the system, at the very least I’d like to explain how to use
>> > IoConnectInterrupt in a non-destructive manner.
>> >
>>Remember that this driver is being developed for a special purpose
>>application that will never be widely distributed. Under normal
>>operating conditions, all that will ever be running on this machine
>>other than the basics of Windows is my driver for the data acquisition
>>board and a user-mode service which allows users on other machines to
>>access the driver via the network.
>>
>>My client wants to use mainstream components (HW and OS), which is why
>>this is being done on a PC with Windows 2K/XP and not as a custom
>>embedded system using an RTOS. What I need to do should be doable with
>>Windows assuming I can twiddle things to ensure that my ISR gets
>>processed on time. There is PLENTY of processing power in a modern PC
>>to do what we need to do on this machine (their original DOS
>>implementation originally ran on a 10 MHz 286 back in the dark ages of
>>computing). I just need my ISR to be top dog over any other “piggy”
>>ISRs.
>>
>> > What you want to do is specify (CLOCK_LEVEL - 1) for the
>> > SynchronizeIrql
>> > parameter. This will cause the kernel to raise IRQL after taking your
>> > interrupt to the highest device level, blocking out
>> > interrupts from all
>> > other devices, while still letting things like clock ticks through.
>> >
>> > SynchronizeIrql is intended for devices that need their ISRs
>> > to be called at
>> > the same level as the ISR from another device. But it will
>> > do what you
>> > want, too.
>> >
>>
>>Will that cause my ISR to preempt any currently running ISR that might
>>have a DIRQL greater than my IRQL that I got from the HAL that I passed
>>to the Irql parameter to IoConnectInterrupt(), or will I still have to
>>wait until that ISR completes before I get raised up to CLOCK_LEVEL-1?
>>In other words, does this give me the power to preempt other ISRs that
>>have a DIRQL greater than my DIRQL, or does it just prevent them from
>>preempting mine once mine gets going?
>>
>> > As a final note, changing the Irql parameter to
>> > IoConnectInterrupt will
>> > probably lead to a machine that deadlocks itself, if
>> > IoConnectInterrupt even
>> > succeeds.
>> >
>>
>>So, if I understand what you’re saying here, I absolutely have to put
>>the IRQL I received from the HAL in for the Irql parameter or the system
>>will be totally fubar, right?
>>
>>Is there any way to influence what IRQL the HAL will assign to my device
>>that might help my ISR be highest priority over other HW in the system?
>>
>>- Jay
>>
>>Jay Talbott
>>Principal Consulting Engineer
>>SysPro Consulting, LLC
>>3519 E. South Fork Drive
>>Suite 201
>>Phoenix, AZ 85044
>>(480) 704-8045
>>xxxxx@sysproconsulting.com
>>http://www.sysproconsulting.com

Art Edwards

-------------
The contents of this email together with any attachments, are completely
useless and are the property of no one. If you received this message in
error, you are encouraged to read it and reply with comments about
misspelling, bad grammar, incorrect word usage (e.g. their instead of
they’re), or anything else. In addition, you are encouraged to go
skydiving. Check out the USPA web site (http://www.uspa.org) to find a
drop zone near you.
-------------

By not leaving a CD disk in CD/DVD drive, as I mentioned early, NT/2k/XP
will not mount CD file system, there will be no the ISR hogging PIO on ATAPI
device. Doesn’t that solve the problem?

Bi

-----Original Message-----
From: Arthur [mailto:xxxxx@localnet.com]
Sent: Thursday, November 14, 2002 8:40 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Extreme ISR Priority

If you look at the NTDEV archives, you’ll notice I brought up the same
subject back in September of this year.

I too have a device that interrupts 200 times per second. The only problem
I’ve had regarding timely servicing of those interrupts has been related to
the ATAPI driver’s ISR hogging the CPU for PIO devices.

The problem only occurred on systems that enabled the APIC. Systems using
the PIC didn’t experience any problem. This was because the priority of
each IRQ has a fixed relationship with its IRQ number. I believe IRQ
priority in PIC based systems is (highest to lowest) 0, 1, 8, 9, 10, 11,
12, 13, 14, 15, 3, 4, 5, 6, 7. The IDE controller interrupts are always
routed to IRQ 14 & 15 in such systems. Therefore, if you can get IRQ 9,
10, or 11, you can avoid the ATAPI problems I faced. Maybe you can handle
IRP_MN_FILTER_RESOURCE_REQUIREMENTS to report support for certain IRQs only.

If your (single CPU) machine is a P4, Windows probably chose to activate
the APIC. In other words, the setup program chose to install the APIC HAL
(original file name: halaacpi.dll). My guess is that MS avoided the APIC
on earlier single CPU machines because they feared the platform designers
wouldn’t implement the APIC bus. P4 based machines don’t require a
dedicated APIC bus.

Anyway, if the APIC is enabled on your system, you can forget about the
fixed IRQ to IRQL mapping. I do recall having success reverting such
systems to the PIC. I did that by replacing HAL.DLL with the PIC version
of HAL.DLL and rebooting. I obtained the replacement HAL from another (P3
or earlier) machine running the same OS.

I suspect you may have to get into the IDT, etc. You may also need to mess
with some fields in your KINTERRUPT object. I’ve done it before but I
don’t remember the details. I did figure out some of the fields in Win2K’s
KINTERRUPT objects and I even wrote it down. Here it is if it helps:

KINTERRUPT:
Offset Contents Comment
+0x04 LIST_ENTRY forward pointer to next KINTERRUPT object
+0x08 LIST_ENTRY backward pointer to previous KINTERRUPT
object

+0x0C PKSERVICE_ROUTINE Pointer to the ISR
+0x10 PVOID Pointer to the ISR’s context

+0x24 DWORD Vector number
+0x28 IRQL
+0x29 SyncIRQL

I believe I had to monkey with the last three fields in addition to fooling
around with the IDT and/or APIC.

Good luck !

At 12:00 AM 11/14/2002 , you wrote:
>Subject: Re: Extreme ISR Priority
>From: “Jay Talbott”
>>Date: Wed, 13 Nov 2002 18:34:29 -0700
>>X-Message-Number: 29
>>
>> > -----Original Message-----
>> > From: xxxxx@lists.osr.com
>> > [mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
>> > Sent: Wednesday, November 13, 2002 11:33 AM
>> > To: NT Developers Interest List
>> > Subject: [ntdev] Re: Extreme ISR Priority
>> >
>> >
>> > While I certainly hesitate to endorse an approach to writing
>> > a driver that
>> > amounts to deciding that your device exists at the expense of
>> > all the others
>> > in the system, at the very least I’d like to explain how to use
>> > IoConnectInterrupt in a non-destructive manner.
>> >
>>Remember that this driver is being developed for a special purpose
>>application that will never be widely distributed. Under normal
>>operating conditions, all that will ever be running on this machine
>>other than the basics of Windows is my driver for the data acquisition
>>board and a user-mode service which allows users on other machines to
>>access the driver via the network.
>>
>>My client wants to use mainstream components (HW and OS), which is why
>>this is being done on a PC with Windows 2K/XP and not as a custom
>>embedded system using an RTOS. What I need to do should be doable with
>>Windows assuming I can twiddle things to ensure that my ISR gets
>>processed on time. There is PLENTY of processing power in a modern PC
>>to do what we need to do on this machine (their original DOS
>>implementation originally ran on a 10 MHz 286 back in the dark ages of
>>computing). I just need my ISR to be top dog over any other “piggy”
>>ISRs.
>>
>> > What you want to do is specify (CLOCK_LEVEL - 1) for the
>> > SynchronizeIrql
>> > parameter. This will cause the kernel to raise IRQL after taking your
>> > interrupt to the highest device level, blocking out
>> > interrupts from all
>> > other devices, while still letting things like clock ticks through.
>> >
>> > SynchronizeIrql is intended for devices that need their ISRs
>> > to be called at
>> > the same level as the ISR from another device. But it will
>> > do what you
>> > want, too.
>> >
>>
>>Will that cause my ISR to preempt any currently running ISR that might
>>have a DIRQL greater than my IRQL that I got from the HAL that I passed
>>to the Irql parameter to IoConnectInterrupt(), or will I still have to
>>wait until that ISR completes before I get raised up to CLOCK_LEVEL-1?
>>In other words, does this give me the power to preempt other ISRs that
>>have a DIRQL greater than my DIRQL, or does it just prevent them from
>>preempting mine once mine gets going?
>>
>> > As a final note, changing the Irql parameter to
>> > IoConnectInterrupt will
>> > probably lead to a machine that deadlocks itself, if
>> > IoConnectInterrupt even
>> > succeeds.
>> >
>>
>>So, if I understand what you’re saying here, I absolutely have to put
>>the IRQL I received from the HAL in for the Irql parameter or the system
>>will be totally fubar, right?
>>
>>Is there any way to influence what IRQL the HAL will assign to my device
>>that might help my ISR be highest priority over other HW in the system?
>>
>>- Jay
>>
>>Jay Talbott
>>Principal Consulting Engineer
>>SysPro Consulting, LLC
>>3519 E. South Fork Drive
>>Suite 201
>>Phoenix, AZ 85044
>>(480) 704-8045
>>xxxxx@sysproconsulting.com
>>http://www.sysproconsulting.com

Art Edwards

-------------
The contents of this email together with any attachments, are completely
useless and are the property of no one. If you received this message in
error, you are encouraged to read it and reply with comments about
misspelling, bad grammar, incorrect word usage (e.g. their instead of
they’re), or anything else. In addition, you are encouraged to go
skydiving. Check out the USPA web site (http://www.uspa.org) to find a
drop zone near you.
-------------


You are currently subscribed to ntdev as: xxxxx@appstream.com
To unsubscribe send a blank email to %%email.unsub%%

Well, I hesitate to actually slap you across the head but…

DIRQL is HAL-dependent. You can’t know which are populated a-priori.
Furthermore, when they aren’t populated, the unpopulated ones don’t even
exist. They just equal the highest populated DIRQL.


Jake Oshins
Windows Kernel Group

This posting is provided “AS IS” with no warranties, and confers no rights.

“Gary G. Little” wrote in message news:xxxxx@ntdev…
>
> Jay,
>
> As I recall, DIRQL starts at about 3 and goes up to about 17 (??). Any
IRQL
> above that will not be associated with a device. (… shoulders hunched

> waiting for the slap across the head …)
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
>
> “Jay Talbott” wrote in message
> news:xxxxx@ntdev…
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
> > > Sent: Wednesday, November 13, 2002 11:33 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Extreme ISR Priority
> > >
> > >
> > > While I certainly hesitate to endorse an approach to writing
> > > a driver that
> > > amounts to deciding that your device exists at the expense of
> > > all the others
> > > in the system, at the very least I’d like to explain how to use
> > > IoConnectInterrupt in a non-destructive manner.
> > >
> >
> > Remember that this driver is being developed for a special purpose
> > application that will never be widely distributed. Under normal
> > operating conditions, all that will ever be running on this machine
> > other than the basics of Windows is my driver for the data acquisition
> > board and a user-mode service which allows users on other machines to
> > access the driver via the network.
> >
> > My client wants to use mainstream components (HW and OS), which is why
> > this is being done on a PC with Windows 2K/XP and not as a custom
> > embedded system using an RTOS. What I need to do should be doable with
> > Windows assuming I can twiddle things to ensure that my ISR gets
> > processed on time. There is PLENTY of processing power in a modern PC
> > to do what we need to do on this machine (their original DOS
> > implementation originally ran on a 10 MHz 286 back in the dark ages of
> > computing). I just need my ISR to be top dog over any other “piggy”
> > ISRs.
> >
> > > What you want to do is specify (CLOCK_LEVEL - 1) for the
> > > SynchronizeIrql
> > > parameter. This will cause the kernel to raise IRQL after taking your
> > > interrupt to the highest device level, blocking out
> > > interrupts from all
> > > other devices, while still letting things like clock ticks through.
> > >
> > > SynchronizeIrql is intended for devices that need their ISRs
> > > to be called at
> > > the same level as the ISR from another device. But it will
> > > do what you
> > > want, too.
> > >
> >
> > Will that cause my ISR to preempt any currently running ISR that might
> > have a DIRQL greater than my IRQL that I got from the HAL that I passed
> > to the Irql parameter to IoConnectInterrupt(), or will I still have to
> > wait until that ISR completes before I get raised up to CLOCK_LEVEL-1?
> > In other words, does this give me the power to preempt other ISRs that
> > have a DIRQL greater than my DIRQL, or does it just prevent them from
> > preempting mine once mine gets going?
> >
> > > As a final note, changing the Irql parameter to
> > > IoConnectInterrupt will
> > > probably lead to a machine that deadlocks itself, if
> > > IoConnectInterrupt even
> > > succeeds.
> > >
> >
> > So, if I understand what you’re saying here, I absolutely have to put
> > the IRQL I received from the HAL in for the Irql parameter or the system
> > will be totally fubar, right?
> >
> > Is there any way to influence what IRQL the HAL will assign to my device
> > that might help my ISR be highest priority over other HW in the system?
> >
> > - Jay
> >
> > Jay Talbott
> > Principal Consulting Engineer
> > SysPro Consulting, LLC
> > 3519 E. South Fork Drive
> > Suite 201
> > Phoenix, AZ 85044
> > (480) 704-8045
> > xxxxx@sysproconsulting.com
> > http://www.sysproconsulting.com
> >
> >
> >
> >
> >
>
>
>
>

> So, my question is this: How can I ensure that my ISR has higher

priority than that of other devices in the system, such as the
network
card? Since the HAL can arrange the IRQL priorities independent of
the

Try go to BIOS setup and assign the IRQ for the slot manually, most
BIOSes have this functionality.

Max