What is the purpose of a processor sending an Inter Processor Interrupt to itself on the IA-32 architecture?
According to the Intel IA-32 Architecture Software Developer's Manual, Vol. 3, Ch. 10.1:
IPIs are used for software self-interrupts, interrupt forwarding, or preemptive scheduling.
But why would you use a self IPI when the processor can also interrupt itself with an INT instruction? This feature seems to be redundant.
I think the big reason is consistency: If you are writing software for a multi core processor, and you want to send an interrupt out to all cores in the system, it would suck to have to do an IPI to every other core, then execute INT to interrupt the current core, and of course you will also have to setup the handlers for both interrupt sources etc... It is just much easier to send IPI to everyone.
Another scenario might be a multi core system where you are passing work or messages around to a "free" core to handle the load. The "free" core might be the current core, again you don't want to have a special case in software just because you are sending an interrupt to yourself.
I guess you have already known the reason since 2 years have passed.
But here's my understanding:
IPI can be blocked when IRQ is disabled, it is kept by the IOAPIC, until the destined core re-enables IRQ with an sti instruction. However an int instruction always traps the CPU into a lower ring level, no matter whether IRQ is enabled or not.
So maybe self-IPI is needed when the kernel wants to do something, but not now when the IRQ is disabled. Thus, it sends itself an IPI, making such interrupt happens as soon as the IRQ on that core is re-enabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With