From patchwork Mon Nov 23 11:59:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Yushchenko X-Patchwork-Id: 7680751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 381F49F54F for ; Mon, 23 Nov 2015 12:01:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4D3F206B6 for ; Mon, 23 Nov 2015 12:01:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D77D8205D1 for ; Mon, 23 Nov 2015 12:01:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0pmP-0004Cs-Rw; Mon, 23 Nov 2015 11:59:33 +0000 Received: from mail.dev.rtsoft.ru ([213.79.90.226] helo=dev.rtsoft.ru) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a0pmM-0003Sl-FC for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2015 11:59:31 +0000 Received: from hugenb.home (fw-int.dev.rtsoft.ru [192.168.1.70]) by dev.rtsoft.ru (Postfix) with ESMTP id 254924301C; Mon, 23 Nov 2015 14:59:08 +0300 (MSK) From: nyushchenko@dev.rtsoft.ru To: Russell King , Will Deacon , Ard Biesheuvel , Rob Herring , Ian Campbell , Pavel Machek , Mason , Paul Kocialkowski , Masahiro Yamada Subject: [RFC/PATCH] arm: do not skip SMP init calls on SMP_ON_UP case Date: Mon, 23 Nov 2015 14:59:06 +0300 Message-Id: <1448279946-19975-1-git-send-email-nyushchenko@dev.rtsoft.ru> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151123_035930_728834_0F93B791 X-CRM114-Status: GOOD ( 12.45 ) X-Spam-Score: -2.5 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kuznetsovg@dev.rtsoft.ru, nyushchenko@dev.rtsoft.ru, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nikita Yushchenko While running an imx6s boasrd, I got following message in boot log: [ 0.032414] CPU1: failed to boot: -38 This looked strange: imx6s is singe-core and kernel perfectly knows that. However, for some reason it tries to initialize CPU 1? I found this to be caused by - CONFIG_SMP_ON_UP successfully detects that system is single core, - this causes is_smp() to return false, - this causes setup_arch() to skip smp_init_cpus() call, - this skips board-specific code that sets cpu_possible mask. By looking at the code, I don't understand why several initialization routines are called only in is_smp() case - while other kernel CONFIG_SMP code does not check is_smp() every time and uses what should have been initialized by skipped routines. Thus I propose making these init calls regardless of is_smp() check. Calls are already conditional on CONFIG_SMP. This will make init and usage sides consistent. Signed-off-by: Nikita Yushchenko --- arch/arm/kernel/setup.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 20edd34..8a14fce 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -980,16 +980,14 @@ void __init setup_arch(char **cmdline_p) psci_dt_init(); xen_early_init(); #ifdef CONFIG_SMP - if (is_smp()) { - if (!mdesc->smp_init || !mdesc->smp_init()) { - if (psci_smp_available()) - smp_set_ops(&psci_smp_ops); - else if (mdesc->smp) - smp_set_ops(mdesc->smp); - } - smp_init_cpus(); - smp_build_mpidr_hash(); + if (!mdesc->smp_init || !mdesc->smp_init()) { + if (psci_smp_available()) + smp_set_ops(&psci_smp_ops); + else if (mdesc->smp) + smp_set_ops(mdesc->smp); } + smp_init_cpus(); + smp_build_mpidr_hash(); #endif if (!is_smp())