Skip to content

RFC Introduce dynamic allocation/freeing of MSI-X vectors

Megha Dey intel-wired-lan 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v4 RFC Latest6 patches 0 repliesNew

Changes in v4 from the cover letter

1. Initialised first_desc for MSI as well.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6PCI/MSI: New structures/macros for dynamic MSI-X allocationinclude/linux/device.h include/linux/msi.h include/linux/pci.h+23 -00 replies
2/6PCI/MSI: Dynamic allocation of MSI-X vectors by groupdrivers/pci/msi.c drivers/pci/probe.c include/linux/pci.h +1 more+222 -270 replies
3/6x86: Introduce the dynamic teardown functionarch/x86/include/asm/x86_init.h arch/x86/kernel/x86_init.c drivers/pci/msi.c +1 more+29 -00 replies
4/6PCI/MSI: Introduce new structure to manage MSI-x entriesdrivers/pci/msi.c drivers/pci/probe.c include/linux/pci.h+24 -10 replies
5/6PCI/MSI: Free MSI-X resources by groupdrivers/pci/msi.c include/linux/msi.h include/linux/pci.h +1 more+169 -00 replies
6/6Documentation: PCI/MSI: Document dynamic MSI-X infrastructureDocumentation/PCI/MSI-HOWTO.txt+36 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [Intel-wired-lan] [RFC v4 0/6] Introduce dynamic allocation/freeing of MSI-X vectors

Currently, MSI-X vector enabling and allocation for a PCIe device is static i.e. a device driver gets only one chance to enable a specific number of MSI-X vectors, usually during device probe. Also, in many cases, drivers usually reserve more than required number of vectors anticipating their use, which unnecessarily blocks resources that could have been made available to other devices. Lastly, there is no way for drivers to reserve more vectors, if the MSI-x has already been enabled for that device.

Hence, a dynamic MSI-X kernel infrastructure can benefit drivers by deferring MSI-X allocation to post probe phase, where actual demand information is available.

This patchset enables the dynamic allocation/de-allocation of MSI-X vectors by introducing 2 new APIs: pci_alloc_irq_vectors_dyn() and pci_free_irq_vectors_grp().

Changes V3->V4
1. Initialised first_desc for MSI as well.

Changes V2->V3
1. Added a separate patch to include documentation
2. Added a lookup function pci_irq_vector_group based on group id
3. Added a 'one_shot' field to struct device
4. Ensure msix table base gets mapped only once
5. Removed redundant checks
6. Use pointer for msi related data to reduce memory footprint of struct device
7. Initialization of idrs used internally by MSI code done by the core code instead of drivers/callers..

Changes V1->V2
1. Added relavant documentation
2. Avoid code duplication by ensuring pci_alloc_irq_vectors_affinity calls pci_alloc_irq_vectors_affinity_dyn function
3. Add the pci_free_irq_vectors_grp API

Megha Dey (6):
PCI/MSI: New structures/macros for dynamic MSI-X allocation PCI/MSI: Dynamic allocation of MSI-X vectors by group
x86: Introduce the dynamic teardown function PCI/MSI: Introduce new structure to manage MSI-x entries PCI/MSI: Free MSI-X resources by group
Documentation: PCI/MSI: Document dynamic MSI-X infrastructure

 Documentation/PCI/MSI-HOWTO.txt |  36 +++++
 arch/x86/include/asm/x86_init.h |   1 +
 arch/x86/kernel/x86_init.c      |   6 +
 drivers/pci/msi.c               | 350 +++++++++++++++++++++++++++++++++++++---
 drivers/pci/probe.c             |  20 +++
 include/linux/device.h          |  14 ++
 include/linux/msi.h             |  11 ++
 include/linux/pci.h             |  56 +++++++
 kernel/irq/msi.c                |  37 ++++-
 9 files changed, 503 insertions(+), 28 deletions(-)
Signature · 1 line
2.7.4