lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1fd8b9cd-b525-315b-6b4a-23f5f8732676@nvidia.com>
Date:   Mon, 10 Apr 2023 06:52:32 -0500
From:   Shanker Donthineni <sdonthineni@...dia.com>
To:     Marc Zyngier <maz@...nel.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Michael Walle <michael@...le.cc>, linux-kernel@...r.kernel.org,
        Vikram Sethi <vsethi@...dia.com>,
        "Liam R . Howlett" <Liam.Howlett@...cle.com>
Subject: Re: [PATCH v2 1/3] genirq: Use hlist for managing resend handlers



On 4/10/23 05:05, Marc Zyngier wrote:
> External email: Use caution opening links or attachments
> 
> 
> On Sun, 09 Apr 2023 13:00:27 +0100,
> Shanker Donthineni <sdonthineni@...dia.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, I'll post v3 patches to address the other review comments.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ