From: Petr Mladek Date: Thu, 2 Apr 2020 04:02:28 +0000 (-0700) Subject: kthread: mark timer used by delayed kthread works as IRQ safe X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=98c985d7da8dfc8a9aa0ee8a560852dd97b1cf7d;p=linux.git 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 Reported-by: Grygorii Strashko Signed-off-by: Petr Mladek Signed-off-by: Andrew Morton Tested-by: Grygorii Strashko Acked-by: Tejun Heo Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20200217120709.1974-1-pmladek@suse.com Signed-off-by: Linus Torvalds --- diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 0f9da966934e2..8bbcaad7ef0f4 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -165,7 +165,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, do { \ kthread_init_work(&(dwork)->work, (fn)); \ timer_setup(&(dwork)->timer, \ - kthread_delayed_work_timer_fn, 0); \ + kthread_delayed_work_timer_fn, \ + TIMER_IRQSAFE); \ } while (0) int kthread_worker_fn(void *worker_ptr);