Skip to contentSkip to conversation

x86/irq: Fix lost interrupts on CPU hot-unplug for Hyper-V PCI/MSI

PATCH Superseded Naman Jain 6 participants 21 messages Jul 28 – Sep 1

Subsystems (8)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Naman Jain

author
#0 lore raw

cover x86/irq: Fix lost interrupts on CPU hot-unplug for Hyper-V PCI/MSI

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 vPCI MSI irqchip never installs one, 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 installs irq_chip_retrigger_hierarchy() on the Hyper-V PCI/MSI chip. Patch 2 then switches fixup_irqs() to call irq_chip_retrigger_hierarchy() directly, so the retrigger works for any stacked irqchip without a per-chip callback. Patch 3 drops the now-redundant irq_retrigger() initializations. This way, patch 2 and 3 do not need to be backported.

The series follows the original RFC:

Naman Jain (3):
PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs() x86/irq, iommu/amd, 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          | 23 +++++++----------------
 drivers/iommu/amd/init.c       |  1 -
 5 files changed, 8 insertions(+), 23 deletions(-)

base-commit: 0d33d21e47d9dc66f91e44da3fc9220c74d93df7

Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/3 PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback.

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 Hyper-V PCI/MSI chip does not provide 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.

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

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
---
 drivers/pci/controller/pci-hyperv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/pci-hyperv.c +1 -0
index cfc8fa403dad6..89816a2bd7cd3 100644
@@ -2119,6 +2119,7 @@ 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
author
#9 lore raw

PATCH 2/3 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. That only works when the outermost chip happens to install an irq_retrigger() callback, which is not guaranteed for every irqchip and could 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().

While at it, move the loop-local variables into the loop scope and use a scoped guard for desc->lock.

No functional change intended for chips which already provide an irq_retrigger() callback on the outermost domain.

---
 arch/x86/kernel/irq.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)
arch/x86/kernel/irq.c +7 -16
index 30122f0b3af96..ef1bdd3c4659a 100644
@@ -466,11 +466,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
 /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
 void fixup_irqs(void)
 {
-	unsigned int vector;
-	struct irq_desc *desc;
-	struct irq_data *data;
-	struct irq_chip *chip;
-
 	irq_migrate_all_off_this_cpu();
 
 	/*
@@ -489,22 +484,18 @@ void fixup_irqs(void)
 	 * vector_lock because the cpu is already marked !online, so
 	 * 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])))
+	for (unsigned int vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
+		struct irq_desc *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);
-			data = irq_desc_get_irq_data(desc);
-			chip = irq_data_get_irq_chip(data);
-			if (chip->irq_retrigger) {
-				chip->irq_retrigger(data);
+			guard(raw_spinlock)(&desc->lock);
+			if (irq_chip_retrigger_hierarchy(&desc->irq_data))
 				__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
#14 lore raw

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

In reply to Naman Jain

With fixup_irqs() now using irq_chip_retrigger_hierarchy() and the generic resend path (try_retrigger()) already falling back to it, installing irq_chip_retrigger_hierarchy() as the irq_retrigger() callback on the outermost domain chips is no longer required. 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.
msi_set_affinity() is the only site that invoked the outermost chip's irq_retrigger() directly. Convert it to irq_chip_retrigger_hierarchy() so the x86_init_dev_msi_info() initialization can be dropped as well.

No functional change intended.

---
 arch/x86/kernel/apic/io_apic.c      | 2 --
 arch/x86/kernel/apic/msi.c          | 4 +---
 arch/x86/kernel/hpet.c              | 1 -
 drivers/iommu/amd/init.c            | 1 -
 drivers/pci/controller/pci-hyperv.c | 1 -
 5 files changed, 1 insertion(+), 8 deletions(-)
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 +1 -3
index 66bc5d3e79db3..aad2f15eb2176 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;
 }
@@ -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 ea3377e61aa5c..0c362e86a09d9 100644
@@ -2468,7 +2468,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 89816a2bd7cd3..cfc8fa403dad6 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
#15 lore raw

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

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

With fixup_irqs() now using irq_chip_retrigger_hierarchy() and the generic resend path (try_retrigger()) already falling back to it, installing irq_chip_retrigger_hierarchy() as the irq_retrigger() callback on the outermost domain chips is no longer required. 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.
msi_set_affinity() is the only site that invoked the outermost chip's irq_retrigger() directly. Convert it to irq_chip_retrigger_hierarchy() so the x86_init_dev_msi_info() initialization can be dropped as well.

Quoted 4 lines

No functional change intended.

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
#10 lore raw

Re: [PATCH 2/3] 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] The patch replaces the direct invocation of the outermost chip's irq_retrigger() callback with…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch replaces the direct invocation of the outermost chip's irq_retrigger() callback with irq_chip_retrigger_hierarchy(). However, irq_chip_retrigger_hierarchy() initializes its loop with data = data->parent_data, completely skipping the outermost chip. This breaks interrupt retriggering for flat domains (like native lapic_controller) and any hierarchical domain where the outermost chip directly implements the retrigger callback. --

--- Patch [2]: [PATCH 2/3] x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs() --- commit f97e883de2f6626561de48c426194caa41c3e062
Author: Naman Jain <[email protected]>
x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs()

This commit modifies fixup_irqs() to use irq_chip_retrigger_hierarchy() instead of invoking the outermost domain chip's irq_retrigger() callback directly. It also refactors the loop to use scoped guards for the irq descriptor lock.

Quoted 4 lines
arch/x86/kernel/irq.c +0 -0
index 30122f0b3af96..ef1bdd3c4659a 100644

[ ... ]

Quoted 1 line
arch/x86/kernel/irq.c +0 -0
@@ -489,22 +484,18 @@ void fixup_irqs(void)

[ ... ]

Quoted 8 lines
arch/x86/kernel/irq.c +4 -2
-	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
-		if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
+	for (unsigned int vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
+		struct irq_desc *desc = __this_cpu_read(vector_irq[vector]);
+
+		if (IS_ERR_OR_NULL(desc))
 			continue;
 

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

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

[Severity: High]
Will this skip the outermost chip and cause a regression for flat domains?

Looking at kernel/irq/chip.c:irq_chip_retrigger_hierarchy(), the loop initializes by immediately moving to the parent_data:

    int irq_chip_retrigger_hierarchy(struct irq_data *data)
    {
        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;
    }

By passing &desc->irq_data directly to this function, it seems any retrigger callback on the outermost chip itself will be bypassed.

Could this lead to dropped hardware interrupts during CPU hot-unplug for flat domains (like native lapic_controller) or any hierarchical domain where the outermost chip implements the retrigger callback?

Quoted 4 lines
arch/x86/kernel/irq.c +0 -2
 				__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
#2 lore raw

Re: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

In reply to Naman Jain
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The fix for dropped pending interrupts during CPU hot-unplug was missed in the sister Hyper-V root partition MSI domain. --

--- Patch [1]: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip --- commit b8b1c843c457dd145f0d360b44f4b1bf34bd8cf5
Author: Naman Jain <[email protected]>

PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback. On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. As the Hyper-V PCI/MSI chip does not provide that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages.

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2122

Quoted 9 lines
drivers/pci/controller/pci-hyperv.c +1 -0
index cfc8fa403dad6..89816a2bd7cd3 100644
@@ -2119,6 +2119,7 @@ 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;

[Severity: High]
This isn't a bug introduced by this patch, but does the sister Hyper-V root partition MSI domain in arch/x86/hyperv/irqdomain.c also need this fix?

Looking at hv_init_dev_msi_info(), it appears to be missing the exact same callback initialization for the root partition's top-level irq_chip:

arch/x86/hyperv/irqdomain.c:hv_init_dev_msi_info() {
	...
	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
		return false;

	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;

	info->ops->msi_prepare = pci_msi_prepare;

	return true;
}

If a CPU is hot-unplugged while a device MSI interrupt is pending in its local APIC IRR, could fixup_irqs() fail to resend the pending interrupt to the new target CPU because this callback is NULL?

This could potentially lead to the same lost interrupts and I/O stalls described in this commit message, just in the root partition MSI domain instead of the guest paravirtual MSI domain.

Quoted 4 lines
drivers/pci/controller/pci-hyperv.c +0 -0
 	if (IS_ENABLED(CONFIG_X86))
 		chip->flags |= IRQCHIP_MOVE_DEFERRED;
 
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#11 lore raw

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

In reply to [email protected]
Quoted 57 lines · On 7/28/2026 7:33 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch replaces the direct invocation of the outermost chip's irq_retrigger() callback with irq_chip_retrigger_hierarchy(). However, irq_chip_retrigger_hierarchy() initializes its loop with data = data->parent_data, completely skipping the outermost chip. This breaks interrupt retriggering for flat domains (like native lapic_controller) and any hierarchical domain where the outermost chip directly implements the retrigger callback. --

--- Patch [2]: [PATCH 2/3] x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs() --- commit f97e883de2f6626561de48c426194caa41c3e062
Author: Naman Jain <[email protected]>
x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs()

This commit modifies fixup_irqs() to use irq_chip_retrigger_hierarchy() instead of invoking the outermost domain chip's irq_retrigger() callback directly. It also refactors the loop to use scoped guards for the irq descriptor lock.

Quoted 4 lines
arch/x86/kernel/irq.c +0 -0
index 30122f0b3af96..ef1bdd3c4659a 100644

[ ... ]

Quoted 1 line
arch/x86/kernel/irq.c +0 -0
@@ -489,22 +484,18 @@ void fixup_irqs(void)

[ ... ]

Quoted 8 lines
arch/x86/kernel/irq.c +4 -2
-	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
-		if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
+	for (unsigned int vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
+		struct irq_desc *desc = __this_cpu_read(vector_irq[vector]);
+
+		if (IS_ERR_OR_NULL(desc))
  			continue;
 

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

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

[Severity: High]
Will this skip the outermost chip and cause a regression for flat domains?

Looking at kernel/irq/chip.c:irq_chip_retrigger_hierarchy(), the loop initializes by immediately moving to the parent_data:

     int irq_chip_retrigger_hierarchy(struct irq_data *data)
     {
         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;
     }

By passing &desc->irq_data directly to this function, it seems any retrigger callback on the outermost chip itself will be bypassed.

Quoted 9 lines

Could this lead to dropped hardware interrupts during CPU hot-unplug for flat domains (like native lapic_controller) or any hierarchical domain where the outermost chip implements the retrigger callback?

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

Quoted 4 lines
  				__this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED);
arch/x86/kernel/irq.c +0 -2
-			}
-			raw_spin_unlock(&desc->lock);
  		}

I think this is a false positive, considering we are not changing the behavior for any of the existing chip->irq_retrigger(data) which come in this path (irq_chip_retrigger_hierarchy()).

Regards,
Naman

author
#3 lore raw

Re: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

In reply to [email protected]
Quoted 54 lines · On 7/28/2026 7:34 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The fix for dropped pending interrupts during CPU hot-unplug was missed in the sister Hyper-V root partition MSI domain. --

--- Patch [1]: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip --- commit b8b1c843c457dd145f0d360b44f4b1bf34bd8cf5
Author: Naman Jain <[email protected]>

PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback. On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. As the Hyper-V PCI/MSI chip does not provide that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages.

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2122

Quoted 9 lines
drivers/pci/controller/pci-hyperv.c +1 -0
index cfc8fa403dad6..89816a2bd7cd3 100644
@@ -2119,6 +2119,7 @@ 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;

[Severity: High]
This isn't a bug introduced by this patch, but does the sister Hyper-V root partition MSI domain in arch/x86/hyperv/irqdomain.c also need this fix?

Looking at hv_init_dev_msi_info(), it appears to be missing the exact same callback initialization for the root partition's top-level irq_chip:

arch/x86/hyperv/irqdomain.c:hv_init_dev_msi_info() {
	...
	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
		return false;

	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;

	info->ops->msi_prepare = pci_msi_prepare;

	return true;
}
Quoted 13 lines

If a CPU is hot-unplugged while a device MSI interrupt is pending in its local APIC IRR, could fixup_irqs() fail to resend the pending interrupt to the new target CPU because this callback is NULL?

This could potentially lead to the same lost interrupts and I/O stalls described in this commit message, just in the root partition MSI domain instead of the guest paravirtual MSI domain.

Quoted 4 lines
drivers/pci/controller/pci-hyperv.c +0 -0
  	if (IS_ENABLED(CONFIG_X86))
  		chip->flags |= IRQCHIP_MOVE_DEFERRED;
 

I am not planning to include this in this series, since this issue is not seen in root partition yet and I am not sure if it is applicable here. Second patch would anyways fix it going forward, but I am OK adding the change for this, if we need.

Regards,
Naman

Reviewed-by on v1 1/3
#8 lore raw

Re: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

In reply to Naman Jain
Quoted 28 lines · Naman Jain

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback.

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 Hyper-V PCI/MSI chip does not provide 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.

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

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
---
  drivers/pci/controller/pci-hyperv.c | 1 +
  1 file changed, 1 insertion(+)
drivers/pci/controller/pci-hyperv.c +0 -0
index cfc8fa403dad6..89816a2bd7cd3 100644

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2125

Quoted 7 lines
drivers/pci/controller/pci-hyperv.c +1 -0
@@ -2119,6 +2119,7 @@ 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;
Reviewed-by on the v1 series
#18 lore raw
In reply to Naman Jain
Quoted 6 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 vPCI MSI irqchip never installs one, so such a pending interrupt is silently dropped, leading to lost interrupts, stalls and "No irq handler for vector" messages.

Quoted 6 lines

Patch 1 is the minimal, backportable fix (Fixes:/Cc: stable) that installs irq_chip_retrigger_hierarchy() on the Hyper-V PCI/MSI chip. Patch 2 then switches fixup_irqs() to call irq_chip_retrigger_hierarchy() directly, so the retrigger works for any stacked irqchip without a per-chip callback. Patch 3 drops the now-redundant irq_retrigger() initializations. This way, patch 2 and 3 do not need to be backported.

Thanks Naman, the series looks good to me.

I just have a small nit. In the old code, VECTOR_RETRIGGERED is set unconditionally after calling chip->irq_retrigger(), regardless of its return value. In the new code, VECTOR_RETRIGGERED is only set when irq_chip_retrigger_hierarchy() returns non-zero. So retrigger failures would now result in VECTOR_UNUSED instead of VECTOR_RETRIGGERED.

In practice this doesn't matter since apic_retrigger_irq() always returns 1, but it is technically a behavior change and I think it is a correct one. Just that it might be worth noting this in the commit message to avoid confusion.

Quoted 21 lines

The series follows the original RFC:

Naman Jain (3):
PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs() x86/irq, iommu/amd, 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          | 23 +++++++----------------
 drivers/iommu/amd/init.c       |  1 -
 5 files changed, 8 insertions(+), 23 deletions(-)

base-commit: 0d33d21e47d9dc66f91e44da3fc9220c74d93df7

Signature · 1 line
2.43.0
author
#19 lore raw
Quoted 22 lines · Shradha Gupta
Quoted 6 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 vPCI MSI irqchip never installs one, so such a pending interrupt is silently dropped, leading to lost interrupts, stalls and "No irq handler for vector" messages.

Quoted 6 lines

Patch 1 is the minimal, backportable fix (Fixes:/Cc: stable) that installs irq_chip_retrigger_hierarchy() on the Hyper-V PCI/MSI chip. Patch 2 then switches fixup_irqs() to call irq_chip_retrigger_hierarchy() directly, so the retrigger works for any stacked irqchip without a per-chip callback. Patch 3 drops the now-redundant irq_retrigger() initializations. This way, patch 2 and 3 do not need to be backported.

Thanks Naman, the series looks good to me.

I just have a small nit. In the old code, VECTOR_RETRIGGERED is set unconditionally after calling chip->irq_retrigger(), regardless of its return value. In the new code, VECTOR_RETRIGGERED is only set when irq_chip_retrigger_hierarchy() returns non-zero. So retrigger failures would now result in VECTOR_UNUSED instead of VECTOR_RETRIGGERED.

Quoted 8 lines

In practice this doesn't matter since apic_retrigger_irq() always returns 1, but it is technically a behavior change and I think it is a correct one. Just that it might be worth noting this in the commit message to avoid confusion.

Quoted 1 line

Thank you Shradha. I'll address this in the next patch version.

Regards,
Naman

maintainer
#4 lore raw

Re: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

In reply to Naman Jain
Quoted 69 lines · Naman Jain
Quoted 53 lines · On 7/28/2026 7:34 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The fix for dropped pending interrupts during CPU hot-unplug was missed in the sister Hyper-V root partition MSI domain. --

--- Patch [1]: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip --- commit b8b1c843c457dd145f0d360b44f4b1bf34bd8cf5
Author: Naman Jain <[email protected]>

PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback. On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. As the Hyper-V PCI/MSI chip does not provide that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages.

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2121

Quoted 8 lines
drivers/pci/controller/pci-hyperv.c +1 -0
index cfc8fa403dad6..89816a2bd7cd3 100644
@@ -2119,6 +2119,7 @@ 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;

[Severity: High]
This isn't a bug introduced by this patch, but does the sister Hyper-V root partition MSI domain in arch/x86/hyperv/irqdomain.c also need this fix?

Looking at hv_init_dev_msi_info(), it appears to be missing the exact same callback initialization for the root partition's top-level irq_chip:

arch/x86/hyperv/irqdomain.c:hv_init_dev_msi_info() {
	...
	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
		return false;

	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;

	info->ops->msi_prepare = pci_msi_prepare;

	return true;
}
Quoted 12 lines

If a CPU is hot-unplugged while a device MSI interrupt is pending in its local APIC IRR, could fixup_irqs() fail to resend the pending interrupt to the new target CPU because this callback is NULL?

This could potentially lead to the same lost interrupts and I/O stalls described in this commit message, just in the root partition MSI domain instead of the guest paravirtual MSI domain.

Quoted 3 lines
drivers/pci/controller/pci-hyperv.c +0 -0
  	if (IS_ENABLED(CONFIG_X86))
  		chip->flags |= IRQCHIP_MOVE_DEFERRED;
 
Quoted 4 lines

I am not planning to include this in this series, since this issue is not seen in root partition yet and I am not sure if it is applicable here. Second patch would anyways fix it going forward, but I am OK adding the change for this, if we need.

What's the downside of fixing the root partition irq domain?

We never really attempted to unplug any CPU from the root partition, so it is unsurprising that it has not been reported.

Wei

Quoted 4 lines

Regards,
Naman

maintainer
#12 lore raw

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

In reply to Naman Jain
Quoted 9 lines · 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. That only works when the outermost chip happens to install an irq_retrigger() callback, which is not guaranteed for every irqchip and could 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().

Quoted 8 lines

While at it, move the loop-local variables into the loop scope and use a scoped guard for desc->lock.

No functional change intended for chips which already provide an irq_retrigger() callback on the outermost domain.

I can pick this up as part of this series but this requires an ack from Thomas.

Wei

Quoted 54 lines
---
 arch/x86/kernel/irq.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)
arch/x86/kernel/irq.c +7 -16
index 30122f0b3af96..ef1bdd3c4659a 100644
@@ -466,11 +466,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
 /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
 void fixup_irqs(void)
 {
-	unsigned int vector;
-	struct irq_desc *desc;
-	struct irq_data *data;
-	struct irq_chip *chip;
-
 	irq_migrate_all_off_this_cpu();
 
 	/*
@@ -489,22 +484,18 @@ void fixup_irqs(void)
 	 * vector_lock because the cpu is already marked !online, so
 	 * 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])))
+	for (unsigned int vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
+		struct irq_desc *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);
-			data = irq_desc_get_irq_data(desc);
-			chip = irq_data_get_irq_chip(data);
-			if (chip->irq_retrigger) {
-				chip->irq_retrigger(data);
+			guard(raw_spinlock)(&desc->lock);
+			if (irq_chip_retrigger_hierarchy(&desc->irq_data))
 				__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
maintainer Acked-by on v1 3/3
#16 lore raw

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

In reply to Naman Jain

On Tue, Jul 28, 2026 at 01:51:17PM +0000, Naman Jain wrote:
[...]

Quoted 17 lines
drivers/iommu/amd/init.c +0 -1
index ea3377e61aa5c..0c362e86a09d9 100644
@@ -2468,7 +2468,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 -0
index 89816a2bd7cd3..cfc8fa403dad6 100644

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2122

Quoted 4 lines
drivers/pci/controller/pci-hyperv.c +0 -1
@@ -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;

I suppose you do this because the first patch is supposed to be backported.

Wei

author
#13 lore raw

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

In reply to Wei Liu
Quoted 16 lines · Wei Liu
Quoted 15 lines · 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. That only works when the outermost chip happens to install an irq_retrigger() callback, which is not guaranteed for every irqchip and could 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().

While at it, move the loop-local variables into the loop scope and use a scoped guard for desc->lock.

No functional change intended for chips which already provide an irq_retrigger() callback on the outermost domain.

Quoted 7 lines
Quoted 2 lines

I can pick this up as part of this series but this requires an ack from Thomas.

Wei

Hi Wei,
Patch 1 that you picked is same in v1, v2, so that is fine.
But there's v2 for this series, where the rest of the patches are being discussed.

https://lore.kernel.org/all/[email protected]/

Regards,
Naman

Quoted 55 lines
Quoted 55 lines
---
  arch/x86/kernel/irq.c | 23 +++++++----------------
  1 file changed, 7 insertions(+), 16 deletions(-)
arch/x86/kernel/irq.c +7 -16
index 30122f0b3af96..ef1bdd3c4659a 100644
@@ -466,11 +466,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
  /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
  void fixup_irqs(void)
  {
-	unsigned int vector;
-	struct irq_desc *desc;
-	struct irq_data *data;
-	struct irq_chip *chip;
-
  	irq_migrate_all_off_this_cpu();
 
  	/*
@@ -489,22 +484,18 @@ void fixup_irqs(void)
  	 * vector_lock because the cpu is already marked !online, so
  	 * 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])))
+	for (unsigned int vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
+		struct irq_desc *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);
-			data = irq_desc_get_irq_data(desc);
-			chip = irq_data_get_irq_chip(data);
-			if (chip->irq_retrigger) {
-				chip->irq_retrigger(data);
+			guard(raw_spinlock)(&desc->lock);
+			if (irq_chip_retrigger_hierarchy(&desc->irq_data))
  				__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
#17 lore raw

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

In reply to Wei Liu
Quoted 26 lines · Wei Liu

On Tue, Jul 28, 2026 at 01:51:17PM +0000, Naman Jain wrote:
[...]

Quoted 17 lines
drivers/iommu/amd/init.c +0 -1
index ea3377e61aa5c..0c362e86a09d9 100644
@@ -2468,7 +2468,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 -0
index 89816a2bd7cd3..cfc8fa403dad6 100644

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2122

Quoted 4 lines
drivers/pci/controller/pci-hyperv.c +0 -1
@@ -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;
Quoted 4 lines

I suppose you do this because the first patch is supposed to be backported.

Wei

Yes, exactly.

Regards,
Naman

author
#5 lore raw

Re: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

In reply to Wei Liu
Quoted 70 lines · Wei Liu
Quoted 69 lines · Naman Jain
Quoted 65 lines · On 7/28/2026 7:34 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The fix for dropped pending interrupts during CPU hot-unplug was missed in the sister Hyper-V root partition MSI domain. --

--- Patch [1]: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip --- commit b8b1c843c457dd145f0d360b44f4b1bf34bd8cf5
Author: Naman Jain <[email protected]>

PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback. On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. As the Hyper-V PCI/MSI chip does not provide that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages.

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2121

Quoted 8 lines
drivers/pci/controller/pci-hyperv.c +1 -0
index cfc8fa403dad6..89816a2bd7cd3 100644
@@ -2119,6 +2119,7 @@ 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;

[Severity: High]
This isn't a bug introduced by this patch, but does the sister Hyper-V root partition MSI domain in arch/x86/hyperv/irqdomain.c also need this fix?

Looking at hv_init_dev_msi_info(), it appears to be missing the exact same callback initialization for the root partition's top-level irq_chip:

arch/x86/hyperv/irqdomain.c:hv_init_dev_msi_info() {
	...
	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
		return false;

	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;

	info->ops->msi_prepare = pci_msi_prepare;

	return true;
}

If a CPU is hot-unplugged while a device MSI interrupt is pending in its local APIC IRR, could fixup_irqs() fail to resend the pending interrupt to the new target CPU because this callback is NULL?

This could potentially lead to the same lost interrupts and I/O stalls described in this commit message, just in the root partition MSI domain instead of the guest paravirtual MSI domain.

Quoted 3 lines
drivers/pci/controller/pci-hyperv.c +0 -0
   	if (IS_ENABLED(CONFIG_X86))
   		chip->flags |= IRQCHIP_MOVE_DEFERRED;
 
Quoted 6 lines
Quoted 4 lines

I am not planning to include this in this series, since this issue is not seen in root partition yet and I am not sure if it is applicable here. Second patch would anyways fix it going forward, but I am OK adding the change for this, if we need.

What's the downside of fixing the root partition irq domain?

No downside as such. It would be a latent bug, exposed only if we exercise hotplug in root partition, which seems like we don't. After patch 2 of this series, that would go away anyways. If you tell me, I can add a change similar to patch 1, which is backportable, but then I would need to remove it similarly in patch 3.

Regards,
Naman

Quoted 10 lines

We never really attempted to unplug any CPU from the root partition, so it is unsurprising that it has not been reported.

Wei

Quoted 4 lines

Regards,
Naman

maintainer
#6 lore raw

Re: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

Quoted 78 lines · Naman Jain
Quoted 75 lines · Wei Liu
Quoted 73 lines · Naman Jain
Quoted 53 lines · On 7/28/2026 7:34 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The fix for dropped pending interrupts during CPU hot-unplug was missed in the sister Hyper-V root partition MSI domain. --

--- Patch [1]: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip --- commit b8b1c843c457dd145f0d360b44f4b1bf34bd8cf5
Author: Naman Jain <[email protected]>

PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback. On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. As the Hyper-V PCI/MSI chip does not provide that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages.

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2121

Quoted 8 lines
drivers/pci/controller/pci-hyperv.c +1 -0
index cfc8fa403dad6..89816a2bd7cd3 100644
@@ -2119,6 +2119,7 @@ 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;

[Severity: High]
This isn't a bug introduced by this patch, but does the sister Hyper-V root partition MSI domain in arch/x86/hyperv/irqdomain.c also need this fix?

Looking at hv_init_dev_msi_info(), it appears to be missing the exact same callback initialization for the root partition's top-level irq_chip:

arch/x86/hyperv/irqdomain.c:hv_init_dev_msi_info() {
	...
	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
		return false;

	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;

	info->ops->msi_prepare = pci_msi_prepare;

	return true;
}
Quoted 12 lines

If a CPU is hot-unplugged while a device MSI interrupt is pending in its local APIC IRR, could fixup_irqs() fail to resend the pending interrupt to the new target CPU because this callback is NULL?

This could potentially lead to the same lost interrupts and I/O stalls described in this commit message, just in the root partition MSI domain instead of the guest paravirtual MSI domain.

Quoted 3 lines
drivers/pci/controller/pci-hyperv.c +0 -0
   	if (IS_ENABLED(CONFIG_X86))
   		chip->flags |= IRQCHIP_MOVE_DEFERRED;
 

I am not planning to include this in this series, since this issue is not seen in root partition yet and I am not sure if it is applicable here. Second patch would anyways fix it going forward, but I am OK adding the change for this, if we need.

Quoted 7 lines
Quoted 1 line

What's the downside of fixing the root partition irq domain?

No downside as such. It would be a latent bug, exposed only if we exercise hotplug in root partition, which seems like we don't. After patch 2 of this series, that would go away anyways. If you tell me, I can add a change similar to patch 1, which is backportable, but then I would need to remove it similarly in patch 3.

Yes, please fix that for the root partition, too. Being consistent across different use cases is going to save us some headache in the future.

Wei

author
#7 lore raw

Re: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

Quoted 87 lines · Wei Liu
Quoted 78 lines · Naman Jain
Quoted 75 lines · Wei Liu
Quoted 73 lines · Naman Jain
Quoted 53 lines · On 7/28/2026 7:34 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The fix for dropped pending interrupts during CPU hot-unplug was missed in the sister Hyper-V root partition MSI domain. --

--- Patch [1]: [PATCH 1/3] PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip --- commit b8b1c843c457dd145f0d360b44f4b1bf34bd8cf5
Author: Naman Jain <[email protected]>

PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip

The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback. On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to the outgoing CPU to a new target. As the Hyper-V PCI/MSI chip does not provide that callback, the pending interrupt is silently dropped, which can result in lost interrupts, stalls and "No irq handler for vector" messages.

Fixes 4daace0d8ce85 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")

drivers/pci/controller/pci-hyperv.c static bool hv_pcie_init_dev_msi_info(struct device *dev, struct irq_domain *dom · line 2121

Quoted 8 lines
drivers/pci/controller/pci-hyperv.c +1 -0
index cfc8fa403dad6..89816a2bd7cd3 100644
@@ -2119,6 +2119,7 @@ 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;

[Severity: High]
This isn't a bug introduced by this patch, but does the sister Hyper-V root partition MSI domain in arch/x86/hyperv/irqdomain.c also need this fix?

Looking at hv_init_dev_msi_info(), it appears to be missing the exact same callback initialization for the root partition's top-level irq_chip:

arch/x86/hyperv/irqdomain.c:hv_init_dev_msi_info() {
	...
	if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
		return false;

	chip->flags |= IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MOVE_DEFERRED;

	info->ops->msi_prepare = pci_msi_prepare;

	return true;
}
Quoted 12 lines

If a CPU is hot-unplugged while a device MSI interrupt is pending in its local APIC IRR, could fixup_irqs() fail to resend the pending interrupt to the new target CPU because this callback is NULL?

This could potentially lead to the same lost interrupts and I/O stalls described in this commit message, just in the root partition MSI domain instead of the guest paravirtual MSI domain.

Quoted 3 lines
drivers/pci/controller/pci-hyperv.c +0 -0
    	if (IS_ENABLED(CONFIG_X86))
    		chip->flags |= IRQCHIP_MOVE_DEFERRED;
 

I am not planning to include this in this series, since this issue is not seen in root partition yet and I am not sure if it is applicable here. Second patch would anyways fix it going forward, but I am OK adding the change for this, if we need.

Quoted 7 lines
Quoted 1 line

What's the downside of fixing the root partition irq domain?

No downside as such. It would be a latent bug, exposed only if we exercise hotplug in root partition, which seems like we don't. After patch 2 of this series, that would go away anyways. If you tell me, I can add a change similar to patch 1, which is backportable, but then I would need to remove it similarly in patch 3.

Quoted 5 lines

Yes, please fix that for the root partition, too. Being consistent across different use cases is going to save us some headache in the future.

Wei

Acked.

Regards,
Naman

maintainer Acked-by on the v1 series
#20 lore raw
In reply to Naman Jain
Quoted 13 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 vPCI MSI irqchip never installs one, 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 installs irq_chip_retrigger_hierarchy() on the Hyper-V PCI/MSI chip. Patch 2 then switches fixup_irqs() to call irq_chip_retrigger_hierarchy() directly, so the retrigger works for any stacked irqchip without a per-chip callback. Patch 3 drops the now-redundant irq_retrigger() initializations. This way, patch 2 and 3 do not need to be backported.

Quoted 3 lines

The series follows the original RFC:

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்