I wanted to post a few more "findings" of dubious quality. If anyone can make a quick clarification about the mandated behavior for edge-triggered interrupts that arise concurrently to the processing of the current in-service interrupt, I ask you to come forward.
I stand by my previous post for the time being, with the slight correction that spurious interrupts do not set bit 7 of the IRR, but are rather recorded somewhere out of band (for later delivery, if I interpret the spec correctly.) I tried to look into the APIC related specs that Intel has for comparison. They are not as deep regarding the signal timings, but the most detailed treatment is in the chipset datasheets. I need to say, I did not read them from end to end, but they copy almost verbatim the information about the legacy PIC circuitry, and have certain differences for the APIC mode. For example, this is the
datasheet for ICH3-S. I just stumbled on it arbitrarily, but it has the same 8259 paragraph:
In both the edge and level triggered modes, the IRQ inputs must remain active until after the falling edge of the first internal INTA#. If the IRQ input goes inactive before this time, a default IRQ7 vector will be returned.
Here is what I consider the relevant APIC paragraph from that document ("EOI Message for Level Triggered Interrupts"):
EOI messages are used by local APICs to send an EOI cycle occurring for a level triggered interrupt to an I/O APIC. This message is needed so that the I/O APIC can differentiate between a new interrupt on the interrupt line versus the same interrupt on the interrupt line. The target of the EOI is given by the local APIC through the transmission of the priority vector (V7 through V0) of the interrupt. Upon receiving this message, the I/O APIC resets the Remote IRR bit for that interrupt. If the interrupt signal is still active after the IRR bit is reset, the I/O APIC will treat it as a new interrupt.
Note that according to this spec, the EOI directly affects the IRR on the IO APIC, and the possible condition of losing is stated explicitly. Here is the
datasheet for the more recent PCH chipset. From randomly searching through it, here is another relevant snippet (in "REDIR_TBL—Redirection Table Register"..):
The APIC will respond to an edge triggered interrupt as long as the interrupt is held until after the acknowledge cycle has begun. Once the interrupt is detected, a delivery status bit internally to the I/O APIC is set. The state machine will step ahead and wait for an acknowledgment from the APIC unit that the interrupt message was sent. Only then will the I/O APIC be able to recognize a new edge on that interrupt pin. That new edge will only result in a new invocation of the handler if its acceptance by the destination APIC causes the Interrupt Request Register bit to go from 0 to 1. (In other words, if the interrupt was not already pending at the destination.)
Again, the circumstances of losing edge triggered interrupt are explicitly stated. Or so I think.
In other words, with 8259a, before the iret or sti, the edge-triggered interrupt becomes IR7 (because INTA will be possible much after the IR pulse reaches its falling edge). APIC (IO APIC proper) straight ditches the new interrupt before EOI, but at least records it between EOI and iret/sti. In my opinion, the situation on legacy PIC is more severe.
Edit: In retrospect, the ICH3-S paragraph about level-triggered interrupts may not be relevant, because they are quite different. Also, at my current knowledge, considering the matrix of chipsets and interrupt mechanics, my interpretations may be significantly off.