Technically, message signaled interrupts are shareable. You’ll see this in
action when two drivers in a device stack need to share interrupts, as when
you have AER or something else where a spec-defined PCI Express capability
says that the endpoint generates an interrupt and that interrupt will be the
Nth interrupt message. Then the PCI driver will also register for that
interrupt, so that it can handle it. (Whether the FDO registers for that
one or not is up to the FDO author.)
It’s also possible to share message signaled interrupts between devices,
though no shipping version of Windows will make that sort of assignment. We
have chosen to fall back on a line-based interrupt instead. (Beta versions
of Vista would have enabled sharing in the case of extreme pressure on IDT
entry space.)
You should, as much as possible, attempt to discover whether your device
generated the message, usually by examining the in-memory work lists. If
you actually have to touch your device to find out if it delivered the
message, you’ve lost much of the reason for using MSIs in the first place.
So please try to get your hardware designers to make it possible to examine
memory to find out if a transaction is complete.
Note that the edge-triggered interrupt handling protocol has always been
(and needs to remain) the following:
- When handling a shared edge-triggered interrupt ISR chain, the kernel runs
all of the ISRs until *every single one* of them returns “FALSE, it wasn’t
mine” before dropping IRQL and running other code. (This ensures that
interrupts which were collapsed in the APIC aren’t lost.)
So if you find yourself with a shared MSI and you always return TRUE in your
ISR, sharing will hang the system.
Jake Oshins
(former Interrupt Guy)
Windows Kernel Team
This message implies no warranties and confers no rights.
“solotim” wrote in message news:xxxxx@ntdev…
Yes, you wrote that. I need to figure this out because currently I
didn’t do any check in my ISR(messaged-based) to make sure the
interrupt is from my device. This is not safe if the MSI address is
shared between multiple devices. As you said, devices will not share
MSI addresses, so I think my ISR is ok now.
However, from this doc:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff547940(v=vs.85).aspx
“For example, if a message-based interrupt is shared,
InterruptMessageService can be called for interrupts belonging to
other devices. The routine must check whether the value for the
ServiceContext parameter matches the value passed to
IoConnectInterruptEx. If the value does match, InterruptMessageService
handles the interrupt and returns TRUE. Otherwise,
InterruptMessageService does not handle the interrupt and returns
FALSE.”
Why? It still claims that MSI is possibly shared between multiple
devices… I don’t understand it.
By the way, another thing confuses me too: (from the doc above)
“Note that since message-based interrupts are level-sensitive,
InterruptMessageService must guarantee the device is no longer
interrupting before it returns.”
In another thread created by me, you wrote:
"
That satisfies the contract, even though there are 5 interrups and only
3 ISR runs. If the interrupt happens to fire while the ISR is running,
I believe the contract requires the ISR to run again.
Interrupt v v vvv v
ISR XX XX XX XX
"
You took this example by implying that the device is still
interrupting during the time the ISR is executed. This is contradict
to the MS doc I mentioned above. Why?
Besides, I don’t understand that “MSI is level-sensitive”, don’t we
always say that MSI is edge-triggered?
Thanks,
solotim
2012/4/10 Tim Roberts :
> solotim wrote:
>> Hi Tim, when I review this thread today, I was confused by your
>> statement:
>> "Your MSI Address might be shared among several different devices, and
>> the operating
>> system uses the MSI Data Register to tell who fired the interrupt. "
>> Isn’t MSI designed for eliminating interrupt sharing?
>
> Did I write that? I wonder what I was thinking. I’m sure it made sense
> at the time. An MSI Address is not shared between multiple devices.
> Now, if a single device needs to have multiple interrupts, it’s quite
> possible to have them all share a single MSI Address with different MSI
> Data values, but the MSI Address will not be used by other devices.
>
> Interrupt sharing was one of the things addressed by MSI, but the cost
> of interrupt sharing is rather low. Equally as important is being able
> to support more than one interrupt source in a single PCI function.
>
>
>> How can I be sure that my device is not sharing MSI address with others?
>
> It won’t be, but even if it were, why would you care? As long as your
> interrupt results in a call to your interrupt handler, why do you care
> about the plumbing used to get there?
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer