Skip to content

Commit 8db5494

Browse files
Peter ZijlstraIngo Molnar
Peter Zijlstra
authored and
Ingo Molnar
committed
smp: Allocate smp_call_on_cpu() workqueue on stack too
The SMP IPI struct descriptor is allocated on the stack except for the workqueue and lockdep complains: INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 110 Comm: kworker/0:1 Not tainted 4.8.0-rc5+ #14 Hardware name: Dell Inc. Precision T3600/0PTTT9, BIOS A13 05/11/2014 Workqueue: events smp_call_on_cpu_callback ... Call Trace: dump_stack register_lock_class ? __lock_acquire __lock_acquire ? __lock_acquire lock_acquire ? process_one_work process_one_work ? process_one_work worker_thread ? process_one_work ? process_one_work kthread ? kthread_create_on_node ret_from_fork So allocate it on the stack too. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> [ Test and write commit message. ] Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20160911084323.jhtnpb4b37t5tlno@pd.tnic Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 27046a3 commit 8db5494

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/smp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -759,13 +759,14 @@ static void smp_call_on_cpu_callback(struct work_struct *work)
759759
int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, bool phys)
760760
{
761761
struct smp_call_on_cpu_struct sscs = {
762-
.work = __WORK_INITIALIZER(sscs.work, smp_call_on_cpu_callback),
763762
.done = COMPLETION_INITIALIZER_ONSTACK(sscs.done),
764763
.func = func,
765764
.data = par,
766765
.cpu = phys ? cpu : -1,
767766
};
768767

768+
INIT_WORK_ONSTACK(&sscs.work, smp_call_on_cpu_callback);
769+
769770
if (cpu >= nr_cpu_ids || !cpu_online(cpu))
770771
return -ENXIO;
771772

0 commit comments

Comments
 (0)