History

kthread: mark timer used by delayed kthread works as IRQ safe

The timer used by delayed kthread works are IRQ safe because the used kthread_delayed_work_timer_fn() is IRQ safe. It is properly marked when initialized by KTHREAD_DELAYED_WORK_INIT(). But TIMER_IRQSAFE flag is missing when initialized by kthread_init_delayed_work(). The missing flag might trigger invalid warning from del_timer_sync() when kthread_mod_delayed_work() is called with interrupts disabled. This patch is result of a discussion about using the API, see https://lkml.kernel.org/r/cfa886ad-e3b7-c0d2-3ff8-58d94170eab5@ti.com

Petr Mladek committed 6 years ago

Commit 98c985d1 parent 4054ab61 file · +2 −1Browse files

Unified · Split

include/linux/kthread.h+2−1
@@ -165,7 +165,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, · 164 unmodified lines
165 do { \165 do { \
166 kthread_init_work(&(dwork)->work, (fn)); \166 kthread_init_work(&(dwork)->work, (fn)); \
167 timer_setup(&(dwork)->timer, \167 timer_setup(&(dwork)->timer, \
168 kthread_delayed_work_timer_fn, 0); \168 kthread_delayed_work_timer_fn, \
169 TIMER_IRQSAFE); \
169 } while (0)170 } while (0)
170 171
171int kthread_worker_fn(void *worker_ptr);172int kthread_worker_fn(void *worker_ptr);