Skip to contentSkip to conversation

x86/irq: Fix lost interrupts on CPU hot-unplug

PATCH In review Naman Jain 6 participants 15 messages Sep 23 – Nov 3

Subsystems (8)
lore
Share & tools
lore

Naman Jain

author
#0 lore raw

v6 cover x86/irq: Fix lost interrupts on CPU hot-unplug

On CPU hot-unplug, fixup_irqs() re-injects interrupts that are still pending in the outgoing CPU's IRR via the irqchip's irq_retrigger() callback. The Hyper-V root partition PCI/MSI irqchip lost that callback when it was converted to msi_create_parent_irq_domain(), so such a pending interrupt is silently dropped, leading to lost interrupts, stalls and "No irq handler for vector" messages.

Patch 1 is the minimal, backportable fix (Fixes:/Cc: stable) that restores irq_chip_retrigger_hierarchy() on the Hyper-V root partition PCI/MSI chip. The equivalent guest pci-hyperv.c fix from the previous version is already merged, so it is dropped here.

Patch 2 then switches fixup_irqs() to call irq_chip_retrigger_hierarchy() directly which ensures that this issue does not occur for chips that miss adding this initialization.

Patch 3 makes a similar change in msi_set_affinity()

Patch 4 then drops the now-redundant irq_retrigger() initializations. This way, patch 2-4 do not need to be backported.

Changes since v5:
https://lore.kernel.org/all/[email protected]/
* Commit messages refinement/correction (Michael)

Changes since v4:
https://lore.kernel.org/all/[email protected]/
* Discussion between Thomas and Michael concluded that if-else check for irq_retrigger callback is not required, and irq_chip_retrigger_hierarchy() can safely replace all irq_retrigger invocations. Make the change to remove if-else blocks and update commit msg accordingly. Older series could not be picked because there was a genuine change in patch 1 of this series.

Changes since v3:
https://lore.kernel.org/all/[email protected]/
* Move irq_retrigger setting to hv_init_dev_msi_info() in patch 1 (Michael, Nam)
* Add if-else fallback check in msi_set_affinity() in patch 3 (Michael)
* Break patch 3 into two separate patches, while *keeping review tags*.

Changes since v2:
https://lore.kernel.org/all/[email protected]/
* Add a backportable fix for Hyper-V root partition irqchip (Wei)
* Add a check for custom irq_retrigger implementations and add direct irq_chip_retrigger_hierarchy() calls as a fallback if it is not defined by a chip. (Sashiko, Michael)
* Removed local loop variable change, and continue using the irq_desc accessor function (Michael)
* Did not pick "Acked-by: Manivannan Sadhasivam" as it was on v1, and v3 is a functionally different to some extent, specially patch 2. Requesting you to please review again.

Changes since v1:
https://lore.kernel.org/all/[email protected]/#t
* Added Review tags
* Adding minor clarification in commit msg of patch 2 (Shradha)

Original RFC: https://lore.kernel.org/all/87y0f3jhd6.ffs@fw13/

Naman Jain (4):
x86/hyperv: Set irq_retrigger for root partition PCI/MSI irqchip x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs() x86/irq: Use irq_chip_retrigger_hierarchy() in msi_set_affinity() x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger
inits

 arch/x86/kernel/apic/io_apic.c      |  2 --
 arch/x86/kernel/apic/msi.c          |  4 +---
 arch/x86/kernel/hpet.c              |  1 -
 arch/x86/kernel/irq.c               | 18 ++++++++----------
 drivers/iommu/amd/init.c            |  1 -
 drivers/pci/controller/pci-hyperv.c |  1 -
 6 files changed, 9 insertions(+), 18 deletions(-)
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v6 1/4 x86/hyperv: Set irq_retrigger for root partition PCI/MSI irqchip

The Hyper-V root partition vPCI MSI irqchip lost its irq_retrigger() callback when it was converted to msi_create_parent_irq_domain(). The callback was present on the original irqchip and was dropped during that conversion.

On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. If an interrupt still has its pending bit set in the outgoing CPU's IRR at that point, fixup_irqs() resends it on the new target through the irqchip's irq_retrigger() callback. As the root partition PCI/MSI chip no longer provides that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages during CPU hotplug.

Restore irq_chip_retrigger_hierarchy() as the irq_retrigger() callback for the root partition PCI/MSI irqchip, so that a pending interrupt is resent on its new target CPU via the parent x86 vector domain.

Fixes 4691db0704ac ("x86/hyperv: Switch to msi_create_parent_irq_domain()")
---
 arch/x86/hyperv/irqdomain.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/hyperv/irqdomain.c +1 -0
index b3ad50a874dca..6d790636c8b95 100644
@@ -316,6 +316,7 @@ static bool hv_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 		return false;
 
 	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;
+	chip->irq_retrigger = irq_chip_retrigger_hierarchy;
 
 	info->ops->msi_prepare = pci_msi_prepare;
 
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH v6 2/4 x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs()

In reply to Naman Jain

fixup_irqs() re-injects a pending interrupt on its new target CPU by looking at the outermost domain chip and invoking its irq_retrigger() callback directly. When the outermost chip does not implement irq_retrigger(), the pending interrupt is silently dropped, which can lead to lost interrupts on CPU hot-unplug.

Use irq_chip_retrigger_hierarchy() instead, which walks up the interrupt hierarchy until it finds a chip that implements irq_retrigger(). This fixes the issues for those chips which miss initializing irq_retrigger callback.

While at it, use a scoped guard for desc->lock. VECTOR_RETRIGGERED is now set only when the retrigger succeeds instead of unconditionally, which is harmless today since apic_retrigger_irq() always returns 1.

---
 arch/x86/kernel/irq.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
arch/x86/kernel/irq.c +8 -10
index 30122f0b3af96..acdc1145cce6d 100644
@@ -469,7 +469,7 @@ void fixup_irqs(void)
 	unsigned int vector;
 	struct irq_desc *desc;
 	struct irq_data *data;
-	struct irq_chip *chip;
+	int ret;
 
 	irq_migrate_all_off_this_cpu();
 
@@ -490,21 +490,19 @@ void fixup_irqs(void)
 	 * nothing else will touch it.
 	 */
 	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
-		if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
+		desc = __this_cpu_read(vector_irq[vector]);
+
+		if (IS_ERR_OR_NULL(desc))
 			continue;
 
 		if (is_vector_pending(vector)) {
-			desc = __this_cpu_read(vector_irq[vector]);
-
-			raw_spin_lock(&desc->lock);
+			guard(raw_spinlock)(&desc->lock);
 			data = irq_desc_get_irq_data(desc);
-			chip = irq_data_get_irq_chip(data);
-			if (chip->irq_retrigger) {
-				chip->irq_retrigger(data);
+			ret = irq_chip_retrigger_hierarchy(data);
+			if (ret)
 				__this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED);
-			}
-			raw_spin_unlock(&desc->lock);
 		}
+
 		if (__this_cpu_read(vector_irq[vector]) != VECTOR_RETRIGGERED)
 			__this_cpu_write(vector_irq[vector], VECTOR_UNUSED);
 	}
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH v6 3/4 x86/irq: Use irq_chip_retrigger_hierarchy() in msi_set_affinity()

In reply to Naman Jain

The irqchips used by msi_set_affinity() are initialized by x86_init_dev_msi_info(), which sets their irq_retrigger() callback to irq_chip_retrigger_hierarchy(). Call the hierarchy helper directly instead of invoking it indirectly through the irqchip callback.

---
 arch/x86/kernel/apic/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/msi.c +1 -1
index 66bc5d3e79db3..9160227b9b32a 100644
@@ -137,7 +137,7 @@ msi_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force)
 	 * IRR.
 	 */
 	if (lapic_vector_set_in_irr(cfg->vector))
-		irq_data_get_irq_chip(irqd)->irq_retrigger(irqd);
+		irq_chip_retrigger_hierarchy(irqd);
 
 	return ret;
 }
Signature · 1 line
2.43.0
author
#8 lore raw

PATCH v6 4/4 x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger inits

In reply to Naman Jain

With fixup_irqs() and msi_set_affinity() now using irq_chip_retrigger_hierarchy(), the outermost domain chips no longer need the helper as their irq_retrigger() callback. The generic resend path already uses the hierarchy helper.

The hierarchy walk reaches the x86 vector domain's apic_retrigger_irq() for all of these stacked domain chips.

Remove the now redundant irq_retrigger() initializations from the outermost domain interrupt chips, including the Hyper-V root partition PCI/MSI chip.

No functional change intended.

---
 arch/x86/hyperv/irqdomain.c         | 1 -
 arch/x86/kernel/apic/io_apic.c      | 2 --
 arch/x86/kernel/apic/msi.c          | 2 --
 arch/x86/kernel/hpet.c              | 1 -
 drivers/iommu/amd/init.c            | 1 -
 drivers/pci/controller/pci-hyperv.c | 1 -
 6 files changed, 8 deletions(-)
arch/x86/hyperv/irqdomain.c +0 -1
index 6d790636c8b95..b3ad50a874dca 100644
@@ -316,7 +316,6 @@ static bool hv_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 		return false;
 
 	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;
-	chip->irq_retrigger = irq_chip_retrigger_hierarchy;
 
 	info->ops->msi_prepare = pci_msi_prepare;
 
arch/x86/kernel/apic/io_apic.c +0 -2
index 7d7175d012288..18f49a251f23b 100644
@@ -1857,7 +1857,6 @@ static struct irq_chip ioapic_chip __read_mostly = {
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_get_irqchip_state	= ioapic_irq_get_chip_state,
 	.flags			= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED |
 				  IRQCHIP_AFFINITY_PRE_STARTUP,
@@ -1871,7 +1870,6 @@ static struct irq_chip ioapic_ir_chip __read_mostly = {
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ir_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_get_irqchip_state	= ioapic_irq_get_chip_state,
 	.flags			= IRQCHIP_SKIP_SET_WAKE |
 				  IRQCHIP_AFFINITY_PRE_STARTUP,
arch/x86/kernel/apic/msi.c +0 -2
index 9160227b9b32a..aad2f15eb2176 100644
@@ -246,7 +246,6 @@ static bool x86_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 	info->ops->msi_prepare		= x86_msi_prepare;
 
 	info->chip->irq_ack		= irq_chip_ack_parent;
-	info->chip->irq_retrigger	= irq_chip_retrigger_hierarchy;
 	info->chip->flags		|= IRQCHIP_SKIP_SET_WAKE |
 					   IRQCHIP_AFFINITY_PRE_STARTUP;
 
@@ -313,7 +312,6 @@ static struct irq_chip dmar_msi_controller = {
 	.irq_mask		= dmar_msi_mask,
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_set_affinity	= msi_domain_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_compose_msi_msg	= dmar_msi_compose_msg,
 	.irq_write_msi_msg	= dmar_msi_write_msg,
 	.flags			= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED |
arch/x86/kernel/hpet.c +0 -1
index 8dc7b710e1250..2bb7a6f466af3 100644
@@ -509,7 +509,6 @@ static struct irq_chip hpet_msi_controller __ro_after_init = {
 	.irq_mask = hpet_msi_mask,
 	.irq_ack = irq_chip_ack_parent,
 	.irq_set_affinity = msi_domain_set_affinity,
-	.irq_retrigger = irq_chip_retrigger_hierarchy,
 	.irq_write_msi_msg = hpet_msi_write_msg,
 	.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_AFFINITY_PRE_STARTUP,
 };
drivers/iommu/amd/init.c +0 -1
index 8a410d4aa3704..0d22324568911 100644
@@ -2477,7 +2477,6 @@ static struct irq_chip intcapxt_controller = {
 	.irq_unmask		= intcapxt_unmask_irq,
 	.irq_mask		= intcapxt_mask_irq,
 	.irq_ack		= irq_chip_ack_parent,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_set_affinity       = intcapxt_set_affinity,
 	.irq_set_wake		= intcapxt_set_wake,
 	.flags			= IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_MOVE_DEFERRED,
drivers/pci/controller/pci-hyperv.c +0 -1
index 056d379b3cee4..a004b08d68fe9 100644
@@ -2119,7 +2119,6 @@ static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom
 	info->ops->msi_prepare = hv_msi_prepare;
 
 	chip->irq_set_affinity = irq_chip_set_affinity_parent;
-	chip->irq_retrigger = irq_chip_retrigger_hierarchy;
 
 	if (IS_ENABLED(CONFIG_X86))
 		chip->flags |= IRQCHIP_MOVE_DEFERRED;
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v6 1/4] x86/hyperv: Set irq_retrigger for root partition PCI/MSI irqchip

In reply to Naman Jain
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 17 lines

The Hyper-V root partition vPCI MSI irqchip lost its irq_retrigger() callback when it was converted to msi_create_parent_irq_domain(). The callback was present on the original irqchip and was dropped during that conversion.

On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. If an interrupt still has its pending bit set in the outgoing CPU's IRR at that point, fixup_irqs() resends it on the new target through the irqchip's irq_retrigger() callback. As the root partition PCI/MSI chip no longer provides that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages during CPU hotplug.

Restore irq_chip_retrigger_hierarchy() as the irq_retrigger() callback for the root partition PCI/MSI irqchip, so that a pending interrupt is resent on its new target CPU via the parent x86 vector domain.

Quoted 5 lines
Fixes 4691db0704ac ("x86/hyperv: Switch to msi_create_parent_irq_domain()")

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#4 lore raw

Re: [PATCH v6 2/4] x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs()

In reply to Naman Jain
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] x86/irq: lost interrupts in fixup_irqs() due to bypassed irq_retrigger --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] x86/irq: lost interrupts in fixup_irqs() due to bypassed irq_retrigger --

commit a27ffeac3562f1a871ba38be5a47e5097ea4e9f4
Author: Naman Jain <[email protected]>

x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs()

fixup_irqs() re-injects a pending interrupt on its new target CPU by looking at the outermost domain chip and invoking its irq_retrigger() callback directly. This commit changes the implementation to use irq_chip_retrigger_hierarchy() instead, which walks up the interrupt hierarchy until it finds a chip that implements irq_retrigger(). It also changes desc->lock to use a scoped guard.

Quoted 14 lines
arch/x86/kernel/irq.c +3 -1
index 30122f0b3af96..acdc1145cce6d 100644
@@ -490,21 +490,19 @@ void fixup_irqs(void)
 	 * nothing else will touch it.
 	 */
 	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
-		if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
+		desc = __this_cpu_read(vector_irq[vector]);
+
+		if (IS_ERR_OR_NULL(desc))
 			continue;
 

arch/x86/kernel/irq.c void fixup_irqs(void) · line 501

Quoted 10 lines
arch/x86/kernel/irq.c +2 -6
 		if (is_vector_pending(vector)) {
-			desc = __this_cpu_read(vector_irq[vector]);
-
-			raw_spin_lock(&desc->lock);
+			guard(raw_spinlock)(&desc->lock);
 			data = irq_desc_get_irq_data(desc);
-			chip = irq_data_get_irq_chip(data);
-			if (chip->irq_retrigger) {
-				chip->irq_retrigger(data);
+			ret = irq_chip_retrigger_hierarchy(data);

[Severity: High]
Does this skip the outermost chip and potentially drop the interrupt?

In fixup_irqs(), data is passed to irq_chip_retrigger_hierarchy(), which begins by immediately advancing to data->parent_data:

kernel/irq/chip.c:irq_chip_retrigger_hierarchy() {
	for (data = data->parent_data; data; data = data->parent_data)
		if (data->chip && data->chip->irq_retrigger)
			return data->chip->irq_retrigger(data);

	return 0;
}

If the outermost chip (such as lapic_controller for legacy IRQs) implements irq_retrigger itself, the original irq_data is skipped and the loop will terminate immediately if data->parent_data is NULL.

This can lead to hardware interrupts pending during CPU hot-unplug being silently dropped. It appears this logic error is not fixed by subsequent patches in the series either.

Quoted 6 lines
arch/x86/kernel/irq.c +2 -2
+			if (ret)
 				__this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED);
-			}
-			raw_spin_unlock(&desc->lock);
 		}
+
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#6 lore raw

Re: [PATCH v6 3/4] x86/irq: Use irq_chip_retrigger_hierarchy() in msi_set_affinity()

In reply to Naman Jain
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

The irqchips used by msi_set_affinity() are initialized by x86_init_dev_msi_info(), which sets their irq_retrigger() callback to irq_chip_retrigger_hierarchy(). Call the hierarchy helper directly instead of invoking it indirectly through the irqchip callback.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#9 lore raw

Re: [PATCH v6 4/4] x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger inits

In reply to Naman Jain
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] irq: lost interrupts during CPU hotplug due to skipped top-level chip in fixup_irqs() --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] irq: lost interrupts during CPU hotplug due to skipped top-level chip in fixup_irqs() --

commit 7fb72a647b56b7209b19850bb988eed0fff8563c
Author: Naman Jain <[email protected]>

x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger inits

This commit removes the redundant irq_retrigger() initializations from the outermost domain interrupt chips. The commit message notes this is because fixup_irqs() and msi_set_affinity() now use irq_chip_retrigger_hierarchy().

Quoted 4 lines

With fixup_irqs() and msi_set_affinity() now using irq_chip_retrigger_hierarchy(), the outermost domain chips no longer need the helper as their irq_retrigger() callback. The generic resend path already uses the hierarchy helper.

[Severity: High]
Can the transition to using irq_chip_retrigger_hierarchy() directly in fixup_irqs() result in a regression where hardware interrupts are lost during CPU hotplug?

When a CPU is taken offline, fixup_irqs() is called to migrate and retrigger pending interrupts. It retrieves the top-level irq_data and calls irq_chip_retrigger_hierarchy():

arch/x86/kernel/irq.c:fixup_irqs() {
    ...
    data = irq_desc_get_irq_data(desc);
    ret = irq_chip_retrigger_hierarchy(data);
    ...
}

However, irq_chip_retrigger_hierarchy() is designed to be used as a chip callback, so it unconditionally starts its search at data->parent_data, skipping the top-level chip itself:

kernel/irq/chip.c:irq_chip_retrigger_hierarchy() {
    ...
    for (data = data->parent_data; data; data = data->parent_data)
        if (data->chip && data->chip->irq_retrigger)
    ...
}

If an interrupt is non-hierarchical (e.g., directly managed by lapic_controller in the root x86_vector_domain), it has no parent (parent_data == NULL).

Will the retrigger loop fail to execute, returning 0 without calling apic_retrigger_irq(), and silently dropping the pending interrupt?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Reviewed-by on v6 3/4
#7 lore raw

RE: [PATCH v6 3/4] x86/irq: Use irq_chip_retrigger_hierarchy() in msi_set_affinity()

In reply to Naman Jain

From: Naman Jain <[email protected]> Sent: Tuesday, September 22, 2026 9:30 PM

Quoted 19 lines

The irqchips used by msi_set_affinity() are initialized by x86_init_dev_msi_info(), which sets their irq_retrigger() callback to irq_chip_retrigger_hierarchy(). Call the hierarchy helper directly instead of invoking it indirectly through the irqchip callback.

---
 arch/x86/kernel/apic/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/msi.c +0 -0
index 66bc5d3e79db3..9160227b9b32a 100644

arch/x86/kernel/apic/msi.c msi_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force) · line 143

Quoted 8 lines
arch/x86/kernel/apic/msi.c +1 -1
@@ -137,7 +137,7 @@ msi_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force)
 	 * IRR.
 	 */
 	if (lapic_vector_set_in_irr(cfg->vector))
-		irq_data_get_irq_chip(irqd)->irq_retrigger(irqd);
+		irq_chip_retrigger_hierarchy(irqd);
 
 	return ret;
 }
Reviewed-by on v6 4/4
#10 lore raw

RE: [PATCH v6 4/4] x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger inits

In reply to Naman Jain

From: Naman Jain <[email protected]> Sent: Tuesday, September 22, 2026 9:30 PM

Quoted 12 lines

With fixup_irqs() and msi_set_affinity() now using irq_chip_retrigger_hierarchy(), the outermost domain chips no longer need the helper as their irq_retrigger() callback. The generic resend path already uses the hierarchy helper.

The hierarchy walk reaches the x86 vector domain's apic_retrigger_irq() for all of these stacked domain chips.

Remove the now redundant irq_retrigger() initializations from the outermost domain interrupt chips, including the Hyper-V root partition PCI/MSI chip.

Quoted 6 lines

No functional change intended.

Quoted 100 lines
---
 arch/x86/hyperv/irqdomain.c         | 1 -
 arch/x86/kernel/apic/io_apic.c      | 2 --
 arch/x86/kernel/apic/msi.c          | 2 --
 arch/x86/kernel/hpet.c              | 1 -
 drivers/iommu/amd/init.c            | 1 -
 drivers/pci/controller/pci-hyperv.c | 1 -
 6 files changed, 8 deletions(-)
arch/x86/hyperv/irqdomain.c +0 -1
index 6d790636c8b95..b3ad50a874dca 100644
@@ -316,7 +316,6 @@ static bool hv_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 		return false;
 
 	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;
-	chip->irq_retrigger = irq_chip_retrigger_hierarchy;
 
 	info->ops->msi_prepare = pci_msi_prepare;
 
arch/x86/kernel/apic/io_apic.c +0 -2
index 7d7175d012288..18f49a251f23b 100644
@@ -1857,7 +1857,6 @@ static struct irq_chip ioapic_chip __read_mostly = {
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_get_irqchip_state	= ioapic_irq_get_chip_state,
 	.flags			= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED |
 				  IRQCHIP_AFFINITY_PRE_STARTUP,
@@ -1871,7 +1870,6 @@ static struct irq_chip ioapic_ir_chip __read_mostly = {
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ir_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_get_irqchip_state	= ioapic_irq_get_chip_state,
 	.flags			= IRQCHIP_SKIP_SET_WAKE |
 				  IRQCHIP_AFFINITY_PRE_STARTUP,
arch/x86/kernel/apic/msi.c +0 -2
index 9160227b9b32a..aad2f15eb2176 100644
@@ -246,7 +246,6 @@ static bool x86_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 	info->ops->msi_prepare		= x86_msi_prepare;
 
 	info->chip->irq_ack		= irq_chip_ack_parent;
-	info->chip->irq_retrigger	= irq_chip_retrigger_hierarchy;
 	info->chip->flags		|= IRQCHIP_SKIP_SET_WAKE |
 					   IRQCHIP_AFFINITY_PRE_STARTUP;
 
@@ -313,7 +312,6 @@ static struct irq_chip dmar_msi_controller = {
 	.irq_mask		= dmar_msi_mask,
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_set_affinity	= msi_domain_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_compose_msi_msg	= dmar_msi_compose_msg,
 	.irq_write_msi_msg	= dmar_msi_write_msg,
 	.flags			= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED |
arch/x86/kernel/hpet.c +0 -1
index 8dc7b710e1250..2bb7a6f466af3 100644
@@ -509,7 +509,6 @@ static struct irq_chip hpet_msi_controller __ro_after_init = {
 	.irq_mask = hpet_msi_mask,
 	.irq_ack = irq_chip_ack_parent,
 	.irq_set_affinity = msi_domain_set_affinity,
-	.irq_retrigger = irq_chip_retrigger_hierarchy,
 	.irq_write_msi_msg = hpet_msi_write_msg,
 	.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_AFFINITY_PRE_STARTUP,
 };
drivers/iommu/amd/init.c +0 -1
index 8a410d4aa3704..0d22324568911 100644
@@ -2477,7 +2477,6 @@ static struct irq_chip intcapxt_controller = {
 	.irq_unmask		= intcapxt_unmask_irq,
 	.irq_mask		= intcapxt_mask_irq,
 	.irq_ack		= irq_chip_ack_parent,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_set_affinity       = intcapxt_set_affinity,
 	.irq_set_wake		= intcapxt_set_wake,
 	.flags			= IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_MOVE_DEFERRED,
drivers/pci/controller/pci-hyperv.c +0 -2
index 056d379b3cee4..a004b08d68fe9 100644
@@ -2119,7 +2119,6 @@ static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom
 	info->ops->msi_prepare = hv_msi_prepare;
 
 	chip->irq_set_affinity = irq_chip_set_affinity_parent;
-	chip->irq_retrigger = irq_chip_retrigger_hierarchy;
 
 	if (IS_ENABLED(CONFIG_X86))
 		chip->flags |= IRQCHIP_MOVE_DEFERRED;
--

2.43.0

author
#12 lore raw
In reply to Naman Jain
Quoted 12 lines · Naman Jain

On CPU hot-unplug, fixup_irqs() re-injects interrupts that are still pending in the outgoing CPU's IRR via the irqchip's irq_retrigger() callback. The Hyper-V root partition PCI/MSI irqchip lost that callback when it was converted to msi_create_parent_irq_domain(), so such a pending interrupt is silently dropped, leading to lost interrupts, stalls and "No irq handler for vector" messages.

Patch 1 is the minimal, backportable fix (Fixes:/Cc: stable) that restores irq_chip_retrigger_hierarchy() on the Hyper-V root partition PCI/MSI chip. The equivalent guest pci-hyperv.c fix from the previous version is already merged, so it is dropped here.

Quoted 9 lines

Patch 2 then switches fixup_irqs() to call irq_chip_retrigger_hierarchy() directly which ensures that this issue does not occur for chips that miss adding this initialization.

Patch 3 makes a similar change in msi_set_affinity()

Patch 4 then drops the now-redundant irq_retrigger() initializations. This way, patch 2-4 do not need to be backported.

Hi Thomas, maintainers,
Gentle ping on this patch series. Please let me know if this is good to be picked in next merge cycle or if any changes are needed from my side.

Regards,
Naman

maintainer Reviewed-by on the v6 series
#13 lore raw
In reply to Naman Jain
Quoted 12 lines · Naman Jain

On CPU hot-unplug, fixup_irqs() re-injects interrupts that are still pending in the outgoing CPU's IRR via the irqchip's irq_retrigger() callback. The Hyper-V root partition PCI/MSI irqchip lost that callback when it was converted to msi_create_parent_irq_domain(), so such a pending interrupt is silently dropped, leading to lost interrupts, stalls and "No irq handler for vector" messages.

Patch 1 is the minimal, backportable fix (Fixes:/Cc: stable) that restores irq_chip_retrigger_hierarchy() on the Hyper-V root partition PCI/MSI chip. The equivalent guest pci-hyperv.c fix from the previous version is already merged, so it is dropped here.

Quoted 8 lines

Patch 2 then switches fixup_irqs() to call irq_chip_retrigger_hierarchy() directly which ensures that this issue does not occur for chips that miss adding this initialization.

Patch 3 makes a similar change in msi_set_affinity()

Patch 4 then drops the now-redundant irq_retrigger() initializations. This way, patch 2-4 do not need to be backported.

Acked-by on v6 4/4
#11 lore raw

Re: [PATCH v6 4/4] x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger inits

In reply to Naman Jain
Quoted 11 lines · Naman Jain

With fixup_irqs() and msi_set_affinity() now using irq_chip_retrigger_hierarchy(), the outermost domain chips no longer need the helper as their irq_retrigger() callback. The generic resend path already uses the hierarchy helper.

The hierarchy walk reaches the x86 vector domain's apic_retrigger_irq() for all of these stacked domain chips.

Remove the now redundant irq_retrigger() initializations from the outermost domain interrupt chips, including the Hyper-V root partition PCI/MSI chip.

Quoted 6 lines

No functional change intended.

Quoted 100 lines
---
 arch/x86/hyperv/irqdomain.c         | 1 -
 arch/x86/kernel/apic/io_apic.c      | 2 --
 arch/x86/kernel/apic/msi.c          | 2 --
 arch/x86/kernel/hpet.c              | 1 -
 drivers/iommu/amd/init.c            | 1 -
 drivers/pci/controller/pci-hyperv.c | 1 -
 6 files changed, 8 deletions(-)
arch/x86/hyperv/irqdomain.c +0 -1
index 6d790636c8b95..b3ad50a874dca 100644
@@ -316,7 +316,6 @@ static bool hv_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 		return false;
 
 	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;
-	chip->irq_retrigger = irq_chip_retrigger_hierarchy;
 
 	info->ops->msi_prepare = pci_msi_prepare;
 
arch/x86/kernel/apic/io_apic.c +0 -2
index 7d7175d012288..18f49a251f23b 100644
@@ -1857,7 +1857,6 @@ static struct irq_chip ioapic_chip __read_mostly = {
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_get_irqchip_state	= ioapic_irq_get_chip_state,
 	.flags			= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED |
 				  IRQCHIP_AFFINITY_PRE_STARTUP,
@@ -1871,7 +1870,6 @@ static struct irq_chip ioapic_ir_chip __read_mostly = {
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_eoi		= ioapic_ir_ack_level,
 	.irq_set_affinity	= ioapic_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_get_irqchip_state	= ioapic_irq_get_chip_state,
 	.flags			= IRQCHIP_SKIP_SET_WAKE |
 				  IRQCHIP_AFFINITY_PRE_STARTUP,
arch/x86/kernel/apic/msi.c +0 -2
index 9160227b9b32a..aad2f15eb2176 100644
@@ -246,7 +246,6 @@ static bool x86_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
 	info->ops->msi_prepare		= x86_msi_prepare;
 
 	info->chip->irq_ack		= irq_chip_ack_parent;
-	info->chip->irq_retrigger	= irq_chip_retrigger_hierarchy;
 	info->chip->flags		|= IRQCHIP_SKIP_SET_WAKE |
 					   IRQCHIP_AFFINITY_PRE_STARTUP;
 
@@ -313,7 +312,6 @@ static struct irq_chip dmar_msi_controller = {
 	.irq_mask		= dmar_msi_mask,
 	.irq_ack		= irq_chip_ack_parent,
 	.irq_set_affinity	= msi_domain_set_affinity,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_compose_msi_msg	= dmar_msi_compose_msg,
 	.irq_write_msi_msg	= dmar_msi_write_msg,
 	.flags			= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED |
arch/x86/kernel/hpet.c +0 -1
index 8dc7b710e1250..2bb7a6f466af3 100644
@@ -509,7 +509,6 @@ static struct irq_chip hpet_msi_controller __ro_after_init = {
 	.irq_mask = hpet_msi_mask,
 	.irq_ack = irq_chip_ack_parent,
 	.irq_set_affinity = msi_domain_set_affinity,
-	.irq_retrigger = irq_chip_retrigger_hierarchy,
 	.irq_write_msi_msg = hpet_msi_write_msg,
 	.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_AFFINITY_PRE_STARTUP,
 };
drivers/iommu/amd/init.c +0 -1
index 8a410d4aa3704..0d22324568911 100644
@@ -2477,7 +2477,6 @@ static struct irq_chip intcapxt_controller = {
 	.irq_unmask		= intcapxt_unmask_irq,
 	.irq_mask		= intcapxt_mask_irq,
 	.irq_ack		= irq_chip_ack_parent,
-	.irq_retrigger		= irq_chip_retrigger_hierarchy,
 	.irq_set_affinity       = intcapxt_set_affinity,
 	.irq_set_wake		= intcapxt_set_wake,
 	.flags			= IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_MOVE_DEFERRED,
drivers/pci/controller/pci-hyperv.c +0 -1
index 056d379b3cee4..a004b08d68fe9 100644
@@ -2119,7 +2119,6 @@ static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom
 	info->ops->msi_prepare = hv_msi_prepare;
 
 	chip->irq_set_affinity = irq_chip_set_affinity_parent;
-	chip->irq_retrigger = irq_chip_retrigger_hierarchy;
 
 	if (IS_ENABLED(CONFIG_X86))
 		chip->flags |= IRQCHIP_MOVE_DEFERRED;
Signature · 1 line
2.43.0
maintainer
#14 lore raw
In reply to Naman Jain

On Wed, Sep 23, 2026 at 04:30:19AM +0000, Naman Jain wrote:
[...]

Quoted 5 lines

Changes since v1:
https://lore.kernel.org/all/[email protected]/#t
* Added Review tags
* Adding minor clarification in commit msg of patch 2 (Shradha)

Quoted 9 lines

Original RFC: https://lore.kernel.org/all/87y0f3jhd6.ffs@fw13/

Naman Jain (4):
x86/hyperv: Set irq_retrigger for root partition PCI/MSI irqchip x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs() x86/irq: Use irq_chip_retrigger_hierarchy() in msi_set_affinity() x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger
inits

This series has been reviewed but not picked up. I queued it up to the hyperv tree. Let me know if you have objections.

Wei

Quoted 11 lines
 arch/x86/kernel/apic/io_apic.c      |  2 --
 arch/x86/kernel/apic/msi.c          |  4 +---
 arch/x86/kernel/hpet.c              |  1 -
 arch/x86/kernel/irq.c               | 18 ++++++++----------
 drivers/iommu/amd/init.c            |  1 -
 drivers/pci/controller/pci-hyperv.c |  1 -
 6 files changed, 9 insertions(+), 18 deletions(-)
Signature · 1 line
2.43.0