From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934764AbcIVN7T (ORCPT ); Thu, 22 Sep 2016 09:59:19 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56568 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933098AbcIVN7N (ORCPT ); Thu, 22 Sep 2016 09:59:13 -0400 Date: Thu, 22 Sep 2016 06:58:28 -0700 From: tip-bot for Peter Zijlstra Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, bp@suse.de Reply-To: tglx@linutronix.de, bp@suse.de, torvalds@linux-foundation.org, peterz@infradead.org, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com In-Reply-To: <20160911084323.jhtnpb4b37t5tlno@pd.tnic> References: <20160911084323.jhtnpb4b37t5tlno@pd.tnic> To: linux-tip-commits@vger.kernel.org Subject: [tip:core/smp] smp: Allocate smp_call_on_cpu() workqueue on stack too Git-Commit-ID: 8db549491c4a3ce9e1d509b75f78516e497f48ec X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8db549491c4a3ce9e1d509b75f78516e497f48ec Gitweb: http://git.kernel.org/tip/8db549491c4a3ce9e1d509b75f78516e497f48ec Author: Peter Zijlstra AuthorDate: Sun, 11 Sep 2016 10:36:26 +0200 Committer: Ingo Molnar CommitDate: Thu, 22 Sep 2016 14:49:10 +0200 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) [ Test and write commit message. ] Signed-off-by: Borislav Petkov Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20160911084323.jhtnpb4b37t5tlno@pd.tnic Signed-off-by: Ingo Molnar --- kernel/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/smp.c b/kernel/smp.c index f4f6137..bba3b20 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -759,13 +759,14 @@ static void smp_call_on_cpu_callback(struct work_struct *work) int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, bool phys) { struct smp_call_on_cpu_struct sscs = { - .work = __WORK_INITIALIZER(sscs.work, smp_call_on_cpu_callback), .done = COMPLETION_INITIALIZER_ONSTACK(sscs.done), .func = func, .data = par, .cpu = phys ? cpu : -1, }; + INIT_WORK_ONSTACK(&sscs.work, smp_call_on_cpu_callback); + if (cpu >= nr_cpu_ids || !cpu_online(cpu)) return -ENXIO;