lkml.org 
[lkml]   [2020]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RESEND v2] irq: Refactor irq_wait_for_interrupt info to simplify the code
Date
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

\
 
 \ /
  Last update: 2020-01-15 14:44    [W:1.026 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site