From: Thomas Gleixner <tglx@kernel.org>
To: Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: Radu Rendec <radu@rendec.net>,
Anup Patel <apatel@ventanamicro.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] genirq/msi: Fix the mapping race of wire to MSI interrupts
Date: Mon, 30 Nov 2026 11:11:16 +0100 [thread overview]
Message-ID: <87jylur5mj.ffs@fw13> (raw)
In-Reply-To: <CADGQE7FyCJHSnbQUomx6JBAtfCgKVK8y1DDDq+3c=Q2ZE1yXKA@mail.gmail.com>
On Mon, Nov 16 2026 at 08:49, Nickolai Zeldovich wrote:
> On Mon, Nov 9, 2026 at 10:21 AM Thomas Gleixner <tglx@kernel.org> wrote:
>> Something like the uncompiled below is less intrusive and avoids the
>> subtle breakage.
>
> Thank you, your version looks better than what I was proposing. I'm
> happy for you to take over this fix (your patch works and passes my
> testing against v7.4-rc3), if that's easier for you.
Nah. Just make it a proper patch and add "Suggested-by: tglx...".
> Also, in the same function, there are two other potential races. Let
> me know if these seem important enough to fix, and if it's useful for
> me to send a patch for them or if you want to take them over as well.
...
> One fix would be to do these checks and stores under desc->lock.
Correct. Below is a skeleton to start with.
Thanks,
tglx
---
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -911,11 +911,24 @@ int irq_populate_fwspec_info(struct irq_
}
#endif
+static int irq_validate_trigger(int virq. unsigned int type)
+{
+ if (type == IRQ_TYPE_NONE)
+ return virq;
+
+ /* Protect against concurrent modifications */
+ scoped_irqdesc_get_and_lock(irq, 0) {
+ struct irq_data *d = irq_desc_get_irq_data(scoped_irqdesc);
+
+ // Do the checks based on @d. Return virq on success
+ // 0 on fail.
+ }
+}
+
unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
{
unsigned int type = IRQ_TYPE_NONE;
struct irq_domain *domain;
- struct irq_data *irq_data;
irq_hw_number_t hwirq;
int virq;
@@ -944,32 +957,7 @@ unsigned int irq_create_fwspec_mapping(s
*/
virq = irq_find_mapping(domain, hwirq);
if (virq) {
- /*
- * If the trigger type is not specified or matches the
- * current trigger type then we are done so return the
- * interrupt number.
- */
- if (type == IRQ_TYPE_NONE || type == irq_get_trigger_type(virq))
- goto out;
-
- /*
- * If the trigger type has not been set yet, then set
- * it now and return the interrupt number.
- */
- if (irq_get_trigger_type(virq) == IRQ_TYPE_NONE) {
- irq_data = irq_get_irq_data(virq);
- if (!irq_data) {
- virq = 0;
- goto out;
- }
-
- irqd_set_trigger_type(irq_data, type);
- goto out;
- }
-
- pr_warn("type mismatch, failed to map hwirq-%lu for %s!\n",
- hwirq, of_node_full_name(to_of_node(fwspec->fwnode)));
- virq = 0;
+ virq = irq_validate_trigger(virq, type);
goto out;
}
prev parent reply other threads:[~2026-11-30 10:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 2:54 [PATCH v1] genirq/msi: Fix the mapping race of wire to MSI interrupts Nickolai Zeldovich
2026-11-09 15:21 ` Thomas Gleixner
2026-11-16 13:49 ` Nickolai Zeldovich
2026-11-30 10:11 ` Thomas Gleixner [this message]
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=87jylur5mj.ffs@fw13 \
--to=tglx@kernel.org \
--cc=apatel@ventanamicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nickolai@csail.mit.edu \
--cc=radu@rendec.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox