[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1540f1d0-4fda-aaf4-acda-f5aaa6952a00@colorfullife.com>
Date: Fri, 23 Dec 2022 11:54:29 +0100
From: Manfred Spraul <manfred@...orfullife.com>
To: "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Cc: "1vier1@....de" <1vier1@....de>,
"tglx@...utronix.de" <tglx@...utronix.de>
Subject: Re: [PATCH 3/3] kernel/irq/manage.c: disable_irq() might sleep.
Hi Alexander,
On 12/20/22 07:58, Sverdlin, Alexander wrote:
> Hi Manfred!
>
> On Fri, 2022-12-16 at 16:04 +0100, Manfred Spraul wrote:
>> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
>> index 5b7cf28df290..8ce75495e04f 100644
>> --- a/kernel/irq/manage.c
>> +++ b/kernel/irq/manage.c
>> @@ -723,10 +723,13 @@ EXPORT_SYMBOL(disable_irq_nosync);
>> * to complete before returning. If you use this function while
>> * holding a resource the IRQ handler may need you will
>> deadlock.
>> *
>> - * This function may be called - with care - from IRQ context.
>> + * Can only be called from preemptible code as it might sleep
>> when
>> + * an interrupt thread is associated to @irq.
>> + *
>> */
>> void disable_irq(unsigned int irq)
>> {
>> + might_sleep();
> I'm not sure about this, latest wait_event() inside synchronize_irq()
> has it already.
>
>> if (!__disable_irq_nosync(irq))
>> synchronize_irq(irq);
>> }
That is the whole point: might_sleep() should be always called. We are
clarifying an API definition. Everyone who uses disable_irq() from
non-sleeping context should get a warning, 100% of the time.
Not just within synchronize_irq() if there is an active threaded irq
handler.
--
Manfred
Powered by blists - more mailing lists