All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Naman Jain" <namjain@linux.microsoft.com>
Cc: linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v6 2/4] x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs()
Date: Wed, 23 Sep 2026 04:41:55 +0000	[thread overview]
Message-ID: <20260923044156.0DBAF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923043023.3150498-3-namjain@linux.microsoft.com>

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 <namjain@linux.microsoft.com>

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.

> diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> index 30122f0b3af96..acdc1145cce6d 100644
> --- a/arch/x86/kernel/irq.c
> +++ b/arch/x86/kernel/irq.c
> @@ -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);

[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.

> +			if (ret)
>  				__this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED);
> -			}
> -			raw_spin_unlock(&desc->lock);
>  		}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923043023.3150498-1-namjain@linux.microsoft.com?part=2

  reply	other threads:[~2026-09-23  4:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  4:30 [PATCH v6 0/4] x86/irq: Fix lost interrupts on CPU hot-unplug Naman Jain
2026-09-23  4:30 ` [PATCH v6 1/4] x86/hyperv: Set irq_retrigger for root partition PCI/MSI irqchip Naman Jain
2026-09-23  4:37   ` sashiko-bot
2026-09-23  4:30 ` [PATCH v6 2/4] x86/irq: Use irq_chip_retrigger_hierarchy() in fixup_irqs() Naman Jain
2026-09-23  4:41   ` sashiko-bot [this message]
2026-09-23  4:30 ` [PATCH v6 3/4] x86/irq: Use irq_chip_retrigger_hierarchy() in msi_set_affinity() Naman Jain
2026-09-23  4:42   ` sashiko-bot
2026-09-23 14:30   ` Michael Kelley
2026-09-23  4:30 ` [PATCH v6 4/4] x86/irq, iommu/amd, x86/hyperv, PCI: Drop redundant irq_retrigger inits Naman Jain
2026-09-23  4:43   ` sashiko-bot
2026-09-23 14:33   ` Michael Kelley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923044156.0DBAF1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=namjain@linux.microsoft.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.