Skip to content

genirq/irqdomain: Add reference counting to IRQs

Alexey Kardashevskiy linux-arm-kernel linux-gpio linuxppc-dev lkml oe-kbuild-all 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 7 repliesIn review
  2. v31 patch 7 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8genirq/ipi: Simplify irq_reserve_ipikernel/irq/ipi.c+3 -131 reply
2/8genirq/irqdomain: Clean legacy IRQ allocationarch/x86/kernel/apic/io_apic.c include/linux/irqdomain.h kernel/irq/irqdomain.c+65 -403 replies
3/8genirq/irqdomain: Drop unused realloc parameter from __irq_domain_alloc_irqsarch/x86/kernel/apic/io_apic.c drivers/gpio/gpiolib.c drivers/irqchip/irq-armada-370-xp.c +9 more+11 -220 replies
4/8genirq: Free IRQ descriptor via embedded kobjectkernel/irq/irqdesc.c+12 -300 replies
5/8genirq: Add free_irq hook for IRQ descriptor and use for mapping disposalinclude/linux/irqdesc.h include/linux/irqdomain.h include/linux/irqhandler.h +2 more+17 -42 replies
6/8genirq/irqdomain: Move hierarchical IRQ cleanup to kobject_releasekernel/irq/irqdomain.c+22 -211 reply
7/8genirq/irqdomain: Reference irq_desc for already mapped irqskernel/irq/irqdomain.c+9 -10 replies
8/8powerpc/pci: Remove LSI mappings on device teardownarch/powerpc/kernel/pci-common.c+21 -00 replies

Reviews trailers per patch

2 of 8 patches have a Reviewed-by or Acked-by.

PatchCédric Le Goater
1/8R-b
2/8
3/8
4/8
5/8
6/8
7/8
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH kernel v4 0/8] genirq/irqdomain: Add reference counting to IRQs

This is another attempt to add reference counting to IRQ descriptors; or - more to the point - reuse already existing kobj from irq_desc. This allows the same IRQ to be used several times (such as legacy PCI INTx) and when disposing those, only the last reference drop clears the hardware mappings. Domains do not add references to irq_desc as the whole point of this exercise is to move actual cleanup in hardware to the last reference drop. This only changes sparse interrupts (no idea about the other case yet).

No changelog as it is all completely rewritten. I am still running tests but I hope this demonstrates the idea.

Some context from Cedric:
The background context for such a need is that the POWER9 and POWER10 processors have a new XIVE interrupt controller which uses MMIO pages for interrupt management. Each interrupt has a pair of pages which are required to be unmapped in some environment, like PHB removal. And so, all interrupts need to be unmmaped.

1/8 .. 3/8 are removing confusing "realloc" which not strictly required but I was touching this anyway and legacy interrupts should probably use the new counting anyway;

4/8 .. 6/8 is reordering irq_desc disposal;

7/8 adds extra references (probably missed other places);

8/8 is the fix for the original XIVE bug; it is here for demonstration.

I am cc'ing ppc list so people can pull the patches from that patchworks.

This is based on sha1
418baf2c28f3 Linus Torvalds "Linux 5.10-rc5".

and pushed out to
https://github.com/aik/linux/commits/irqs
sha1 3955f97c448242f6a

Please comment. Thanks.

Alexey Kardashevskiy (7):
genirq/ipi: Simplify irq_reserve_ipi
genirq/irqdomain: Clean legacy IRQ allocation genirq/irqdomain: Drop unused realloc parameter from
__irq_domain_alloc_irqs
genirq: Free IRQ descriptor via embedded kobject
genirq: Add free_irq hook for IRQ descriptor and use for mapping
disposal
genirq/irqdomain: Move hierarchical IRQ cleanup to kobject_release genirq/irqdomain: Reference irq_desc for already mapped irqs

Oliver O'Halloran (1):
powerpc/pci: Remove LSI mappings on device teardown

 include/linux/irqdesc.h             |   1 +
 include/linux/irqdomain.h           |   9 +-
 include/linux/irqhandler.h          |   1 +
 arch/powerpc/kernel/pci-common.c    |  21 ++++
 arch/x86/kernel/apic/io_apic.c      |  13 ++-
 drivers/gpio/gpiolib.c              |   1 -
 drivers/irqchip/irq-armada-370-xp.c |   2 +-
 drivers/irqchip/irq-bcm2836.c       |   3 +-
 drivers/irqchip/irq-gic-v3.c        |   3 +-
 drivers/irqchip/irq-gic-v4.c        |   6 +-
 drivers/irqchip/irq-gic.c           |   3 +-
 drivers/irqchip/irq-ixp4xx.c        |   1 -
 kernel/irq/ipi.c                    |  16 +--
 kernel/irq/irqdesc.c                |  45 +++-----
 kernel/irq/irqdomain.c              | 160 +++++++++++++++++-----------
 kernel/irq/msi.c                    |   2 +-
 16 files changed, 158 insertions(+), 129 deletions(-)
Signature · 1 line
2.17.1