[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <877e1sg7il.fsf@nanos.tec.linutronix.de>
Date: Wed, 15 Jan 2020 14:43:14 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: chengkaitao <pilgrimtao@...il.com>
Cc: linux-kernel@...r.kernel.org, smuchun@...il.com,
Kaitao Cheng <pilgrimtao@...il.com>
Subject: Re: [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code
chengkaitao <pilgrimtao@...il.com> writes:
> From: Kaitao Cheng <pilgrimtao@...il.com>
>
> Cleanup extra if(test_and_clear_bit), and put the other one in front.
That simplifies the code but opens a race window:
CPU 0 CPU 1
irq_wait_for_interrupt()
has not yet reached schedule()
free_irq()
remove_action();
synchronize_irq();
#ifdef CONFIG_DEBUG_SHIRQ
action->handler() if (test_and_clear_bit())
---> bit is not set yet
--> SET thread running
#endif
kthread_stop() if (kthread_stop())
---> Leave with bit set and thread active count != 0
That's just the most obvious example...
Thanks,
tglx
Powered by blists - more mailing lists