public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Shanker Donthineni <sdonthineni@nvidia.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Michael Walle <michael@walle.cc>,
	linux-kernel@vger.kernel.org, Vikram Sethi <vsethi@nvidia.com>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>
Subject: Re: [PATCH v2 1/3] genirq: Use hlist for managing resend handlers
Date: Mon, 10 Apr 2023 11:05:36 +0100	[thread overview]
Message-ID: <87fs9859xr.wl-maz@kernel.org> (raw)
In-Reply-To: <76bc7b50-d47f-e5a7-6aa6-54a7b1492ea3@nvidia.com>

On Sun, 09 Apr 2023 13:00:27 +0100,
Shanker Donthineni <sdonthineni@nvidia.com> wrote:
> 
> >> @@ -30,18 +31,17 @@ static DECLARE_BITMAP(irqs_resend, IRQ_BITMAP_BITS);
> >>   static void resend_irqs(struct tasklet_struct *unused)
> >>   {
> >>        struct irq_desc *desc;
> >> -     int irq;
> >> -
> >> -     while (!bitmap_empty(irqs_resend, nr_irqs)) {
> >> -             irq = find_first_bit(irqs_resend, nr_irqs);
> >> -             clear_bit(irq, irqs_resend);
> >> -             desc = irq_to_desc(irq);
> >> -             if (!desc)
> >> -                     continue;
> >> -             local_irq_disable();
> >> +
> >> +     raw_spin_lock_irq(&irq_resend_lock);
> >> +     while (!hlist_empty(&irq_resend_list)) {
> >> +             desc = hlist_entry(irq_resend_list.first, struct irq_desc,
> >> +                                resend_node);
> >> +             hlist_del_init(&desc->resend_node);
> >> +             raw_spin_unlock(&irq_resend_lock);
> >>                desc->handle_irq(desc);
> >> -             local_irq_enable();
> >> +             raw_spin_lock(&irq_resend_lock);
> > 
> > What makes it safe to drop the local_irq_*able()?
> > 
> > tasklet_action_common() explicitly enables interrupts when calling the
> > callback, so unless there is some other interrupt disabling that I
> > can't immediately spot, the handler may run in the wrong context.
> > 
> 
> Unless I am overlooking something, interrupts are disabled within the while
> loop unless desc->handle_irq() is enabling it. The existing code disables
> and enables interrupts for each handler invocation, whereas the modified
> code does it only once for all outstanding handlers.

Ah, you use raw_spinlock_irq() outside of the loop. I somehow glanced
over that, apologies for the noise. Unless we expect a really long
list of interrupts to be resent, your current code should be OK.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2023-04-10 10:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08 17:15 [PATCH v2 0/3] Increase the number of IRQ descriptors for SPARSEIRQ Shanker Donthineni
2023-04-08 17:15 ` [PATCH v2 1/3] genirq: Use hlist for managing resend handlers Shanker Donthineni
     [not found]   ` <863559mne0.wl-maz@kernel.org>
2023-04-09 12:00     ` Shanker Donthineni
2023-04-10 10:05       ` Marc Zyngier [this message]
2023-04-10 11:52         ` Shanker Donthineni
2023-04-08 17:15 ` [PATCH v2 2/3] genirq: Encapsulate sparse bitmap handling Shanker Donthineni
2023-04-08 17:15 ` [PATCH v2 3/3] genirq: Use the maple tree for IRQ descriptors management Shanker Donthineni

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=87fs9859xr.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=sdonthineni@nvidia.com \
    --cc=tglx@linutronix.de \
    --cc=vsethi@nvidia.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