From: Thomas Gleixner <tglx@linutronix.de>
To: Vincent Whitchurch <vincent.whitchurch@axis.com>
Cc: linux-kernel@vger.kernel.org, kernel@axis.com,
Vincent Whitchurch <vincent.whitchurch@axis.com>
Subject: Re: [PATCH v2] genirq: Fix nested thread vs synchronize_hardirq() deadlock
Date: Fri, 30 Jun 2023 11:07:08 +0200 [thread overview]
Message-ID: <87leg1z5c3.ffs@tglx> (raw)
In-Reply-To: <20230613-genirq-nested-v2-1-fd5114b1e90c@axis.com>
On Tue, Jun 20 2023 at 13:16, Vincent Whitchurch wrote:
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -476,7 +476,7 @@ void handle_nested_irq(unsigned int irq)
> }
>
> kstat_incr_irqs_this_cpu(desc);
> - irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
> + atomic_inc(&desc->threads_active);
> raw_spin_unlock_irq(&desc->lock);
>
> action_ret = IRQ_NONE;
> @@ -487,7 +487,8 @@ void handle_nested_irq(unsigned int irq)
> note_interrupt(desc, action_ret);
>
> raw_spin_lock_irq(&desc->lock);
> - irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
> + if (atomic_dec_and_test(&desc->threads_active))
> + wake_up(&desc->wait_for_threads);
This breaks on RT. The wakeup cannot be inside the raw spin-locked
region.
Also this is open coding wake_threads_waitq().
> +static void __synchronize_irq(struct irq_desc *desc)
> +{
> + __synchronize_hardirq(desc, true);
> + /*
> + * We made sure that no hardirq handler is
> + * running. Now verify that no threaded handlers are
> + * active.
> + */
> + wait_event(desc->wait_for_threads,
> + !atomic_read(&desc->threads_active));
Splitting this out is fine. Not reformatting it not so much.
Thanks,
tglx
next prev parent reply other threads:[~2023-06-30 9:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-20 11:16 [PATCH v2] genirq: Fix nested thread vs synchronize_hardirq() deadlock Vincent Whitchurch
2023-06-30 9:07 ` Thomas Gleixner [this message]
2023-07-03 9:28 ` Vincent Whitchurch
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=87leg1z5c3.ffs@tglx \
--to=tglx@linutronix.de \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vincent.whitchurch@axis.com \
/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