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
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -165,7 +165,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, · 164 unmodified lines | ||
| 165 | 165 | do { \ |
| 166 | 166 | kthread_init_work(&(dwork)->work, (fn)); \ |
| 167 | 167 | timer_setup(&(dwork)->timer, \ |
| 168 | − kthread_delayed_work_timer_fn, 0); \ | |
| 168 | + kthread_delayed_work_timer_fn, \ | |
| 169 | + TIMER_IRQSAFE); \ | |
| 169 | 170 | } while (0) |
| 170 | 171 | |
| 171 | 172 | int kthread_worker_fn(void *worker_ptr); |