Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code | Date | Wed, 15 Jan 2020 14:43:14 +0100 |
| |
chengkaitao <pilgrimtao@gmail.com> writes: > From: Kaitao Cheng <pilgrimtao@gmail.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
| |