"CN" <
qmbmn...@pacbell.net> wrote in message
news:msdjoo$kjk$1...@dont-email.me...
> On 9/4/2015 1:47 PM, James Harris wrote:
>> In another thread, "wolfgang kern" <
now...@never.at> wrote ...
>>
>>> What would a spurious (hardware generated) interrupt mean ?
>>
>> That's a brilliant question and a topic on which I cannot find a
>> recent
>> a.o.d discussion. Hence this new thread. I have an idea or two but
>> need
>> to check some stuff first and it would be great to hear what others
>> think. AFAICT spurious interrupts are widely misunderstood but I
>> think
>> between us all we can bottom out what causes there are for spurious
>> interrupts and what we should do about them.
>
> A spurious interrupt is a consequence of the x86 platform having
> hardware interrupt vectors. So, interrupt delivery becomes non-atomic:
>
> PIC: Hey, CPU, I have an interrupt for you!
> (a bit later) CPU: Yeah, which vector?
> PIC: Lemme see, uh, vector 39!
I like your antropomorphic way of describing it ... though I am not sure
what you mean in the final statement. I guess you mean to describe
*normal* operation.
An 80x86 CPU issues two interrupt acks to the PIC so I think there is a
bit more to it. Based on the data sheet how about this (again to
describe normal operation):
PIC (after seeing a low-to-high transition on one of its IR lines) Hey,
CPU, I have an interrupt for you (and sets the corresponding bit in its
interrupt request register, IRR)
CPU: Ack
PIC "transfers" the bit from the IRR to the in-service register, ISR
(i.e. it clears the IRR bit back to zero and sets the ISR bit).
CPU: Ack (the second one)
PIC: Here's the 8-bit vector (39 or whatever).
> Because it's not atomic, someone can make the interrupt
> non-deliverable in the meantime. For example, mask it or, in the Local
> APIC's case, raise TPR to a higher priority. I think, with the 8259,
> lowering a level-triggered interrupt level has the same effect, but
> I'm not 100% sure. So, the PIC goes "Lemme see, uh... nevermind!"
> Except it wishes it could do that, but there is no "nevermind": by
> protocol, it has to report a vector, because the CPU has already
> committed to interrupting the code. So, the PIC reports a special
> "spurious" vector. That's all there is to it.
That's good but what specifically would cause a spurious interrupt from
the 8259? Noise, certainly, but what else? In the other thread Mike
wrote
> Of course it could mean many things, but in this case it was a
> hardware
> "feature" of the PIC 8259A which would sometimes assert an interrupt
> on IRQ 7 if there was too much activity on the other lines.
I am not sure whether Mike means PIC too busy or too many requests at
once or something else? If CPU too long not servicing a certain
interrupt (which I think is most likely) why would that cause a spurious
interrupt? I can only think of one potential and off-field case where
that might happen but maybe someone can think of some real examples...?
> What do to about them? The software should ignore spurious interrupts.
Sorry, I didn't simply mean the response but what we should do overall.
For example, the spurious interrupt vector is normally the same as the
lowest priority vector, i.e. IRQ7. If a PIC has its priority
reprogrammed does the spurious interrupt vector change too? That's been
a question in the back of my mind for a while. Now I am pretty sure that
the spurious interrupt vector does *not* change but stays at 7. Anyone
disagree?
As another example, what if we want to distinguish between a real
interrupt on IR7 and a spurious one? The datasheet recommends to check
the ISR but we could be using the IRR and a comment in the Linux source
says that switching between IRR and ISR is very slow. So are there other
ways to distinguish between real and spurious interrupts?
Finally, as mentioned above I think there might be a case involving the
PIT timer wherein we could get a spurious interrupt but still want to
handle its proper source. I'll need to give that some more thought and
get back to you.
James