Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4187509yba; Tue, 23 Apr 2019 17:06:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCmzDtYr8CZ5TqmoLFTrWYjSjp2WSkeCeQvmxs+AQ8A/mKzyvD2tmO4nFgVkVB8q0L40oz X-Received: by 2002:a63:f809:: with SMTP id n9mr26939194pgh.201.1556064364882; Tue, 23 Apr 2019 17:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556064364; cv=none; d=google.com; s=arc-20160816; b=J3cSgwXa2OR5vNMPOAPACSN0HOYoVYh3xGPZNzJ/D2ShpqOyF/86WVFHuB90cjOEFb Eicn7zY0k2rjgFSbpFMchU8lRKG+/jkCfCsZpB+D4cSbqPbzpFr3OZVHm5i07Es4Wfkk N8jQghN69MxBCLxWDHa5RLnh2+OQfiiDCmoom7ofQsM7WJ6LOG4A4YMsGgF3LcnJA/Fy Z9dSbDG09yPLgcIiwHyz+TkW4izwY1PLinvlBFsEBeOYKMMkVktRyl68EEK0JPeL+l8w IvsUq1cOMPwS8UYVJMc2fobS4qgkXQJiOG0ZXifN0I2KiqhPCeaKOvMJRudUubItocMf 1vmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr:dkim-signature; bh=TZFCYRL4VlA8KIjpZobXqP2Wz1hWP7TSdD24JIP5Cng=; b=l765ydFPz5DJb7j4/lNGb52nmGpqL4cq+9b8vjhEGbZ5PVyqUbSPBDHOciIm4pMjpj xdNuW8juKX1JOB56JXpX++b81V6Zm4hsFnqXFIj0OPU2J9Ha9hlVfqo85s4DLYxczjYA NdiU7M+kRDO0vuLoiWo02bpcUwsalR0LSt8D3lU58SGwKFTF+kCXtCnqoU3dH2JveE0T zMtjmPoECuoog6lUuI8zJbCFc7rzrKaWbNFhtEMNBlYsdX+F7Nj9gVyFmW8w7GK17ehu t9jJ3dhObb8qWXg5idBLn4aW90u7dFfqrxoTvDN6zqT77W61AelvSpDugkALWx84nlLL jftg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=qoYes3MD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si17453587plr.253.2019.04.23.17.05.49; Tue, 23 Apr 2019 17:06:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=qoYes3MD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728933AbfDXACf (ORCPT + 99 others); Tue, 23 Apr 2019 20:02:35 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:53963 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfDXACY (ORCPT ); Tue, 23 Apr 2019 20:02:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1556064144; x=1587600144; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K0mjdmCfdkrn3w/zT4aJMYOdZrUml3L58iZRwDuQ/Lw=; b=qoYes3MDCcBL86j+090gF/Dukiu7wvAH3tvcq4jYAtbYUoFSRMM5pv76 MJah2xrkFREb+lKMwiikZjsOrsMt4EAH1JENNLtPPenlRhAzCYjr83M/X DoTIFyxVcgdvHpeyChD9dCqNVYbzGJKgdLsLMm2P2JcmolZJ4u0igFUI0 eHZNkaw9T74hL4N+dox7BJb2ENy0Ys+iCGf4/+twpXxPggq/UDbHKF8oe SLQrO5uz2G5yPdW7RW1Di15eyg/6ADlzgMjTi67+IdpgnvdOQI1sdouBG uWjb4Zczej7zHRoMXN1xVdGygtoaxfxbaGreXLd6j9s2+HCIU6bEuhTu7 Q==; X-IronPort-AV: E=Sophos;i="5.60,387,1549900800"; d="scan'208";a="106649535" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Apr 2019 08:02:24 +0800 IronPort-SDR: 4aZ5Fwwe9CEy90fFpkWNfR/gq/Y7iQUdOnzKK1vVw90UUkcsfby2aE0PxOCBQy+IMAz8WLdECA LNVUDskRSCXwmhT2wUY7YZr9O04wGIEXwrz3qoWa2SUP1b0V/hCoyJd6jkkSwAQAtjKeaOLEO+ 5M/ESp7th6SxHn/TJ6Eid09Fe6IBcUvkJx88aPWLH31SnUSBxe3Bs3NXMSxx4i0dzbfIvkVOm+ oaNqeoXO2h/BK3A+m3GflMlnIZFNvXihjTXXqK8he7dGf3uLuhaN1C5pPIou9cvlTDYOcBExYW P2BO56xgr4vq4W8AOV8uZV0p Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 23 Apr 2019 16:41:04 -0700 IronPort-SDR: vLxFqYKRUEO2Hyzjha/t/tSa7wtu+8Bjtkknn7qkd7Pfg7hK26rXSp/pUuMj332f7QCLldAZCL bMZ+M8zqf/osPxKB2CaFEk+UaU5/QIBrQet2r8+IxGXh4f4xRcfJ1EOfwo+Vn1u7/tYcnKK/PH OQ9fU/MA3ldp175wqdWGT3ZxJFPMrCo+1loyho64iijURyU37AcvZnG3DzK3LBuswcgQnPfvp2 cY6d17rnQqtblP0Od3oiZRatNJynbfa9EG/sIg3MzedQxPgvtiFmOJA3rb2JpTD9yg0wylIJ2P yd0= Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 23 Apr 2019 17:02:23 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Albert Ou , Andreas Schwab , Anup Patel , Dmitriy Cherkasov , Johan Hovold , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Christoph Hellwig Subject: [PATCH v3 3/3] RISC-V: Support nr_cpus command line option. Date: Tue, 23 Apr 2019 17:02:27 -0700 Message-Id: <20190424000227.3085-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424000227.3085-1-atish.patra@wdc.com> References: <20190424000227.3085-1-atish.patra@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If nr_cpus command line option is set, maximum possible cpu should be set to that value. Signed-off-by: Atish Patra --- arch/riscv/kernel/smpboot.c | 10 +++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/kernel/smpboot. diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index a8ad200581aa..7a0b62252524 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -84,11 +84,19 @@ void __init setup_smp(void) } cpuid_to_hartid_map(cpuid) = hart; - set_cpu_possible(cpuid, true); cpuid++; } BUG_ON(!found_boot_cpu); + + if (cpuid > nr_cpu_ids) + pr_warn("Total number of cpus [%d] is greater than nr_cpus option value [%d]\n", + cpuid, nr_cpu_ids); + + for (cpuid = 1; cpuid < nr_cpu_ids; cpuid++) { + if (cpuid_to_hartid_map(cpuid) != INVALID_HARTID) + set_cpu_possible(cpuid, true); + } } int __cpu_up(unsigned int cpu, struct task_struct *tidle) -- 2.21.0