Why aren't MSI interrupts shared?

Can any body say why MSI interrupts cannot be shared on Linux.

PIN interrupts can be shared between devices, but MSI interrupts are not used by devices, each device gets its own MSI IRQ number. Why can't interrupt MSI interrupts?

+6
source share
2 answers

Old INTx interrupts have two problematic properties:

  • Each INTx signal requires a separate signal line in the equipment; and
  • the interrupt signal is independent of other data signals, and it is sent asynchronously.

The consequences are that

  • several devices and drivers should be able to share interrupts (the interrupt handler should check if its device actually caused an interrupt); and
  • when a driver receives an interrupt, it needs to read some device register to ensure that any previous DMA entries made by the device will be visible on the CPU.

Typically, both cases are handled by a driver reading its device interrupt status register.

Signal interrupts do not require a separate signal line, but are sent as a message on the data bus. This means that the same hardware can support many more interrupts (so you do not need to use it), and that the interrupt message is automatically synchronized with any DMA accesses. As a result, the interrupt handler does not have to do anything; an interrupt is guaranteed to come from his device, and DMA'd data is guaranteed to have already arrived.

If some drivers were written to be shared by some MSIs, the interrupt handler would again need to check whether the interrupt actually occurred from its own device, and there would be no advantage over INTx interrupts.

MSIs are not shared because it would be impossible, but because it is not necessary.


Note that MSI sharing is actually possible: as shown in this excerpt from /proc/interrupts , extended error messages, power management events, and hotplugging drivers use one interrupt:

 64: 0 0 PCI-MSI-edge aerdrv, PCIe PME, pciehp 

These drivers are actually tied to the same device, but they still behave similarly to INTx drivers, i.e. register an interrupt with IRQF_SHARED , and interrupt handlers check if it was their own function that caused the interrupt.

+5
source

An interrupt exchange is a hack due to resource limitations, such as the lack of enough physical IRQ lines for each device that wants attention. If interrupts are represented by messages with a large ID space, why are you doing this?

β€œThis” means: give them the same identity so that the devices are then checked to find out which of those who encounter the same identifier is actually interrupted.

In fact, we sometimes wanted to have several interrupts for one device. For example, it is useful if the interrupt identifier tells us not only which device is interrupted and why: for example, is this due to the arrival of input or the depletion of the output buffer? If interrupt lines are β€œcheap” because they are just a software identifier with a lot of bits, we can have that.

+4
source

All Articles