mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shanker Donthineni <sdonthineni@nvidia.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Marc Zyngier <maz@kernel.org>, Michael Walle <michael@walle.cc>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Hans de Goede <hdegoede@redhat.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] genirq: Use hlist for managing resend handlers
Date: Tue, 31 Jan 2023 11:06:21 -0600	[thread overview]
Message-ID: <0804e457-27ae-a046-a3f5-73497511c841@nvidia.com> (raw)
In-Reply-To: <182e3214-0f60-8b65-5981-23d2a2ea54b9@nvidia.com>



On 1/31/23 10:17, Shanker Donthineni wrote:
> 
> 
> On 1/31/23 02:59, Thomas Gleixner wrote:
>> On Sun, Jan 29 2023 at 18:57, Shanker Donthineni wrote:
>>> +/* hlist_head to handle software resend of interrupts: */
>>> +static HLIST_HEAD(irq_resend_list);
>>> +static DEFINE_RAW_SPINLOCK(irq_resend_lock);
>>>
>>>   /*
>>>    * Run software resends of IRQ's
>>> @@ -30,18 +31,16 @@ 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;
>>> +     struct hlist_node *n;
>>> +
>>> +     raw_spin_lock_irq(&irq_resend_lock);
>>> +     hlist_for_each_entry_safe(desc, n, &irq_resend_list, resend_node) {
>>> +             hlist_del_init(&desc->resend_node);
>>>                local_irq_disable();
>>>                desc->handle_irq(desc);
>>>                local_irq_enable();
>>>        }
>>> +     raw_spin_unlock_irq(&irq_resend_lock);
>> The lock ordering is broken here. irq_sw_resend() is invoked with
>> desc->lock held and takes irq_resend_lock.
>>
>> Lockdep clearly would have told you...
>>
>>          raw_spin_lock_irq(&irq_resend_lock);
>>          while (!hlist_empty(...)) {
>>                  desc = hlist_entry(irq_resend_list.first, ...);
>>                  hlist_del_init(&desc->resend_node);
>>                  raw_spin_unlock(&...);
>>                  desc->handle_irq();
>>                  raw_spin_lock(&...);
>>          }
> 
> Thanks for catching mistakes, I'll change it to this, please correct me if
> I'm doing another mistake.
> 
> static void resend_irqs(struct tasklet_struct *unused)
> {
>          struct irq_desc *desc;
> 
>          raw_spin_lock_irq(&irq_resend_lock);
>          while (hlist_empty(&irq_resend_list)) {

Sorry typo "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);
>                  raw_spin_lock(&irq_resend_lock);
>          }
>          raw_spin_unlock_irq(&irq_resend_lock);
> }
> 
> Thanks,
> Shanker

  reply	other threads:[~2023-01-31 17:06 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  0:57 [PATCH 0/5] Increase the number of IRQ descriptors for SPARSEIRQ Shanker Donthineni
2023-01-30  0:57 ` [PATCH 1/5] genirq: Use hlist for managing resend handlers Shanker Donthineni
2023-01-31  8:59   ` Thomas Gleixner
2023-01-31 16:17     ` Shanker Donthineni
2023-01-31 17:06       ` Shanker Donthineni [this message]
2023-01-30  0:57 ` [PATCH 2/5] genirq: Allocate IRQ descriptors at boot time for !SPARSEIRQ Shanker Donthineni
2023-01-31  9:16   ` Thomas Gleixner
2023-01-31 16:41     ` Shanker Donthineni
2023-02-07 10:28       ` Thomas Gleixner
2023-01-30  0:57 ` [PATCH 3/5] genirq: Introduce two helper functions Shanker Donthineni
2023-01-31  9:20   ` Thomas Gleixner
2023-01-31 16:42     ` Shanker Donthineni
2023-01-30  0:57 ` [PATCH 4/5] genirq: Use the common function irq_expand_nr_irqs() Shanker Donthineni
2023-01-31  9:35   ` Thomas Gleixner
2023-01-31 16:43     ` Shanker Donthineni
2023-02-07 10:29       ` Thomas Gleixner
2023-01-30  0:57 ` [PATCH 5/5] genirq: Use the maple tree for IRQ descriptors management Shanker Donthineni
2023-01-31  9:52   ` Thomas Gleixner
2023-01-31 16:45     ` Shanker Donthineni
2023-02-01  6:02   ` kernel test robot
2023-02-01 13:27     ` Thomas Gleixner
2023-02-06 14:24       ` Vlastimil Babka
2023-02-06 18:10         ` Thomas Gleixner
2023-02-07 10:30         ` Thomas Gleixner
2023-02-07 14:16           ` mm, slab/slub: Ensure kmem_cache_alloc_bulk() is available early Thomas Gleixner
2023-02-07 14:45             ` Vlastimil Babka
2023-02-07 14:47               ` Vlastimil Babka
2023-02-07 18:20                 ` Thomas Gleixner
2023-02-08  9:15                   ` Vlastimil Babka
2023-02-08 20:46                     ` Thomas Gleixner
2023-02-09 20:28                       ` Matthew Wilcox
2023-02-09 23:19                         ` Thomas Gleixner
2023-02-08 13:20             ` Hyeonggon Yoo

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=0804e457-27ae-a046-a3f5-73497511c841@nvidia.com \
    --to=sdonthineni@nvidia.com \
    --cc=bigeasy@linutronix.de \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=michael@walle.cc \
    --cc=tglx@linutronix.de \
    --cc=wsa+renesas@sang-engineering.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

Powered by JetHome