Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1493646yba; Thu, 25 Apr 2019 00:16:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhX+hWs5ck+GipvLYxcPOEw8yFNdAEPquhiWPdG/5Vr9VvR+yXCkZFPt/Y1OW5Eznl9MdB X-Received: by 2002:a62:6444:: with SMTP id y65mr38713051pfb.56.1556176570302; Thu, 25 Apr 2019 00:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556176570; cv=none; d=google.com; s=arc-20160816; b=zRDs1DPKBigHptFrtNRV/q6fA4kQYKljiGnoOMxpbfPmu2cDK2Vx1063ZBNUFQgaBo W03sf7Idm7bNvomh4n64BLZKoc6gVN2JyOQ6/Laj2YFvr7ZHyoenUp12fhVWTNospRxM 3rZXBRQQYTrT86GX5FnHKx0Ydzr78jZKCSDrN2FcSnfHFbQITQP3GBkvt5fJdnFQNdl3 MhKO99gW6AnZaq5lvu99gJFIPRjQ8xyoj/beT0zhLJv3d5S/dEd4ge//yV2xcEp0UIvR ty1w0BNq/qXL+V9dZO6Uh0VsohPXIgTeHASePTwjBgG0ISG05MNKpE9dtKvLMWmPG9a0 hf1w== 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=5RJCDMmHkgqVU0qbaZLt4K11YmDcxWmic9eHJRBHeEc=; b=pg51snBP14OV2AU/W1mcYf6XUCUEqulmP2xUAALXgS2/uYADmmx4/hfXXkHyqS/cd+ Q2aJdD+DU0KbZrsqry9Lfy+6jEjaO9kHkdgRMb5zq+ustJRx5/2xFeQQU4fd6gwQZNXj 0AXE8Y3E0ua93xNyvjPcLbDKKHIlakvnCEdHg6AW2iRtCOt8Dh2SDYqdSeG3iXMjl4Y5 BInC91X5euDKcsKSrFiCK0brAmhCgX8UbllQa39IUkTYelPmmhYjQ/my8wg7mpsMTDER Dd/aFTEUnqNDWpE7TmBnEIfr8egi7R99vTEDqUi1HeX+gWuSulTFDJu7cmsv9I8tlIYD QWYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=aaFpN9yt; 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 f16si20469853pgj.149.2019.04.25.00.15.54; Thu, 25 Apr 2019 00:16:10 -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=aaFpN9yt; 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 S1732271AbfDXVsS (ORCPT + 99 others); Wed, 24 Apr 2019 17:48:18 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:15282 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732063AbfDXVsQ (ORCPT ); Wed, 24 Apr 2019 17:48:16 -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=1556142496; x=1587678496; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2fCFVaYWBA6mxTZYwLA4+2kqo2897IxJIIto5p08bMM=; b=aaFpN9yta2IA3hAcnAcT2pRPQox8ckV354X+S5s0jXVi+x7YEQbjZiRg mJkAbkji+pIBXgVUkxE81aGHhMF9qfYQ8Pn50XZOQBPLwDjzea8gqsIlG jFNwrnpOL2trXIM3Dn32/m/oA2mZdBOGQULBmU23ZV4YrhFKrtkJDHWH8 qZ7caN6q81+uZjBPjV2PiUEcSYpk92TQlJG/W5+/6921FsIo0jNl/OdJD SnVqQ6a+zXAViwdT9Eu4kqsd7qG6HMMejj98/p6p1Q9hSg4Wh+BPshVEj 7zJftVPWCE0P4dya1nYO3vMJEu8jns2tE54wAU/EItAcZbdhUPoVB17Ta Q==; X-IronPort-AV: E=Sophos;i="5.60,391,1549900800"; d="scan'208";a="106739590" 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; 25 Apr 2019 05:48:16 +0800 IronPort-SDR: 2qZtbfEo+heDcowHj5aAVFUPY28iz4NoCOB5tveK4QCUTwm+66gcA2QNkTIzHuC9uNesNb0YSE /jfH/VGvRTpAf1gSQlgaNybDtEncsHFbW9S1jnYeU/vA5yKc8ctODzDlefXiqqe1Ji9FtA9Yy2 z69SNx9zgZnaP7l9uJsiCSZBPcqEPEyI62W2FAWMfCGIZf+tG/NqpnFwAJT2ZbIW1Rv2Rv+6zk Mh/dF3L4QVc3CbnEviJBfvZhb/8mBgEX+G/SXhpxuwKh6nbjciceUVFxJjz788kiE9Ori8ZsPA fXgJ2fS02Wy6kLjiudTH2YQ5 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 24 Apr 2019 14:26:55 -0700 IronPort-SDR: 1YarVtGkK4lQ7rq37ypwtAajEaQ363xFfuvu4paXwIQHsqZg8cDFm7MI28OzpMvaLF89rTThKU 4u/I//deqUBS29OkAuke6diSTtNn9/FNOfEY7lGrtUwVW82L0Yr2iY/JAFWPGLGMvbrI8De3X2 MC9SMOSCDpBRKmphMsSRFOakcI/QcQo7YLPf/EFdbF7jAoGIjMvIdVubAoWigeODdjFc/VZR1J bfLbK8WWyccJVyLTiAVVJeI3Hc1Z2apQiTT7vnA+KkzlUypEhOPb8GfSCaaP8HVuheejwPhzXo pLU= 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; 24 Apr 2019 14:48:16 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Christoph Hellwig , Albert Ou , Andreas Schwab , Anup Patel , Johan Hovold , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley , Sudeep Holla , Damien Le Moal Subject: [PATCH 3/4] RISC-V: Support nr_cpus command line option. Date: Wed, 24 Apr 2019 14:48:00 -0700 Message-Id: <20190424214801.18880-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424214801.18880-1-atish.patra@wdc.com> References: <20190424214801.18880-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 Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/smpboot. | 0 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. b/arch/riscv/kernel/smpboot. new file mode 100644 index 000000000000..e69de29bb2d1 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