Commit ad01423a authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner

kthread: Do not use TIMER_IRQSAFE

The TIMER_IRQSAFE usage was introduced in commit 22597dc3 ("kthread:
initial support for delayed kthread work") which modelled the delayed
kthread code after workqueue's code. The workqueue code requires the flag
TIMER_IRQSAFE for synchronisation purpose. This is not true for kthread's
delay timer since all operations occur under a lock.

Remove TIMER_IRQSAFE from the timer initialisation and use timer_setup()
for initialisation purpose which is the official function.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lkml.kernel.org/r/20190212162554.19779-2-bigeasy@linutronix.de
parent fe99a4f4
...@@ -164,9 +164,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, ...@@ -164,9 +164,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker,
#define kthread_init_delayed_work(dwork, fn) \ #define kthread_init_delayed_work(dwork, fn) \
do { \ do { \
kthread_init_work(&(dwork)->work, (fn)); \ kthread_init_work(&(dwork)->work, (fn)); \
__init_timer(&(dwork)->timer, \ timer_setup(&(dwork)->timer, \
kthread_delayed_work_timer_fn, \ kthread_delayed_work_timer_fn, 0); \
TIMER_IRQSAFE); \
} while (0) } while (0)
int kthread_worker_fn(void *worker_ptr); int kthread_worker_fn(void *worker_ptr);
......
...@@ -835,6 +835,7 @@ void kthread_delayed_work_timer_fn(struct timer_list *t) ...@@ -835,6 +835,7 @@ void kthread_delayed_work_timer_fn(struct timer_list *t)
struct kthread_delayed_work *dwork = from_timer(dwork, t, timer); struct kthread_delayed_work *dwork = from_timer(dwork, t, timer);
struct kthread_work *work = &dwork->work; struct kthread_work *work = &dwork->work;
struct kthread_worker *worker = work->worker; struct kthread_worker *worker = work->worker;
unsigned long flags;
/* /*
* This might happen when a pending work is reinitialized. * This might happen when a pending work is reinitialized.
...@@ -843,7 +844,7 @@ void kthread_delayed_work_timer_fn(struct timer_list *t) ...@@ -843,7 +844,7 @@ void kthread_delayed_work_timer_fn(struct timer_list *t)
if (WARN_ON_ONCE(!worker)) if (WARN_ON_ONCE(!worker))
return; return;
raw_spin_lock(&worker->lock); raw_spin_lock_irqsave(&worker->lock, flags);
/* Work must not be used with >1 worker, see kthread_queue_work(). */ /* Work must not be used with >1 worker, see kthread_queue_work(). */
WARN_ON_ONCE(work->worker != worker); WARN_ON_ONCE(work->worker != worker);
...@@ -852,7 +853,7 @@ void kthread_delayed_work_timer_fn(struct timer_list *t) ...@@ -852,7 +853,7 @@ void kthread_delayed_work_timer_fn(struct timer_list *t)
list_del_init(&work->node); list_del_init(&work->node);
kthread_insert_work(worker, work, &worker->work_list); kthread_insert_work(worker, work, &worker->work_list);
raw_spin_unlock(&worker->lock); raw_spin_unlock_irqrestore(&worker->lock, flags);
} }
EXPORT_SYMBOL(kthread_delayed_work_timer_fn); EXPORT_SYMBOL(kthread_delayed_work_timer_fn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment