Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5291170yba; Wed, 10 Apr 2019 16:06:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTlV8tDeehe+R0HjGV7La2A7wjOtpLHX7v5Y43Bs8iqLtZBDGQ8UOQoNaE/4X4abmb/CTI X-Received: by 2002:a62:4ec8:: with SMTP id c191mr45743381pfb.138.1554937603288; Wed, 10 Apr 2019 16:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554937603; cv=none; d=google.com; s=arc-20160816; b=Rj9lQ1q/DtanR+xMLrB89qrKDsFoLcxWXjs2GKzap49uNWsk++w8uoYbIy5xW/YBV8 LBmkFpOOSPicM94WgLdbTy5Th+/0UdJNzAK4DnTMQKBPl1QZomDbSjs9Lh47Z7ivtQs3 qkipYI8x3IKSygP1LsMMD2OFqOJYAyhkLZUGcVv1fCVzw0xX5tllMbCECGiBzfzqcuTf abr5WP6PXeb8gG7whJpO9RQJG6bdJH4nt4SncGSqdXT+Z7TzQl2xG24Wa5YGS6u296XP 5yr4KRhnsgfiPOCvz8lMWgudsFVD/DgQZV4w3CUhXTUJHKeUwZp37q7h/3Rdh8usBjph l6sg== 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=i51qWAetffVvkZbHQCG751URPnASN3FfNdAt5q0g8hE=; b=XjdgsL8x8YTcc1WVaACIvhOhEJw7b24DMdNOsrFB05CIrF5hwTj14xVsZ1PhFcKkYX oYR9+5jgMXzlA3lotRoulacR3qrpjZITzl0QaB+PAcj3JF9N2GVn//3Frvb/QsqZcua7 iDSTV3wcgqh8duVXf6etUF+RInwbFVSkeHDWGE7Es8MG1gcH1NwFeGOxO2uMKtzuglgj zFcCVehQLtDE2huDq7Mljws5FYpb72rnpNzz2grOmV+mV9I4/39oBvI44l5bQh6UJss+ 761HvGlLdUNV7KLpmZhmLd44vjcRf39MXrsEoFInMIsfTxrY0HKUm+LjLHkWYI7sbeqH Uorg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=n3pIRbkB; 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 d20si12852634pll.322.2019.04.10.16.06.26; Wed, 10 Apr 2019 16:06:43 -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=n3pIRbkB; 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 S1726812AbfDJXFL (ORCPT + 99 others); Wed, 10 Apr 2019 19:05:11 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:61699 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbfDJXFA (ORCPT ); Wed, 10 Apr 2019 19:05:00 -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=1554937502; x=1586473502; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R2/5jwhYTGQ1JCFD91I9OK6vJ4c5B03XruX+Wm8H9FA=; b=n3pIRbkBRUT388QDGfa817fRhG9/TKptbRJ86mWsc7CZstu0LGUQli1F st18N1suhuiCHf+5Gm7fVWUmp8QPz0elW9EfK7sbZe1NCA4HegLGgJIz6 XEa4QeSbVUDxvVqWEXF5Re5dHbnYRrbIMkhT/oId0neGdqU+O1cTa6vWt uGUmuiQw+M87XTW7kBExQmEF5rsVw2s77B7ETdpU7t7GMjV1i8YIyaJVr KvKRLRAxjRFeD/3Vqb2Cj2nkF29DSXY3J7P/cjjZ4HZX/cMydlwLqa41a 9qtBbrwGvMp+o0csTVm4JNhdLhg8ChT2uPf+EcGrGQYK3xmQmy+c91rXI A==; X-IronPort-AV: E=Sophos;i="5.60,335,1549900800"; d="scan'208";a="110531211" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 11 Apr 2019 07:05:00 +0800 IronPort-SDR: 6eV2AdQyyG8IRLTDJu1a2ddT1JPStKWShreC/vcKfMIq2911P5MVocfIwN3DNkKu0wKwp+S1wq fz7CqkMEkRyvVb+pOrtv69UTapC0mQji9mEhmYnlziQhua7Qgpu25q8F08el0vEaiP6IO4jjhJ oFsEprI/M+wGZ0GwQ7o2GmIlx+9YzZgjXPXisuGOGyjvnxQuAo+Iz88DxXNyqhYw3D7szmOUSL Ck7b3N4OAQPrwXHJLZ9sVR23YMxb+ZUhNTBBUdHhlW1N2R5Fcb611HkoELUvqubYnfJAwSW4G2 ISHFDkxlwp7M57W3p2ebnXqh Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 10 Apr 2019 15:41:53 -0700 IronPort-SDR: qSCZ+MB5u8VxvgmD1nPVzJjNR4LtGOvm1wKeEZBnQoylDPQFPADfO/14h5TDqLzxuODWbUL403 eFYFoZz1x1jMC8i7etI5f0X6+rkbZ5nHV01E/SEWlpM7R881ZFPiAKCH+Icn8KS3+yTlH6gPM4 i6Z2B6IrtwM22k/f82ZsNDhU98LAoAfJmLU9TdLCdRroZCAQk4MqUWhDF3A4GdYS8DvtdC0J0Q 68GTD5DS2u6r9iLhGWADLJCPB8tiTHmaKY/CfFxxZGl9e6ZH8qMJqYghtWAqKdvkuSxaGGaryR jVY= Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Apr 2019 16:04:59 -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 Subject: [PATCH v2 3/4] RISC-V: Implement nosmp commandline option. Date: Wed, 10 Apr 2019 16:04:42 -0700 Message-Id: <20190410230443.15729-4-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190410230443.15729-1-atish.patra@wdc.com> References: <20190410230443.15729-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 nosmp command line option sets max_cpus to zero. No secondary harts will boot if this is enabled. But present cpu mask will still point to all possible masks. Fix present cpu mask for nosmp usecase. Signed-off-by: Atish Patra --- arch/riscv/kernel/smpboot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index eb533b5c2c8c..a8ad200581aa 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -47,6 +47,17 @@ void __init smp_prepare_boot_cpu(void) void __init smp_prepare_cpus(unsigned int max_cpus) { + int cpuid; + + /* This covers non-smp usecase mandated by "nosmp" option */ + if (max_cpus == 0) + return; + + for_each_possible_cpu(cpuid) { + if (cpuid == smp_processor_id()) + continue; + set_cpu_present(cpuid, true); + } } void __init setup_smp(void) @@ -74,7 +85,6 @@ void __init setup_smp(void) cpuid_to_hartid_map(cpuid) = hart; set_cpu_possible(cpuid, true); - set_cpu_present(cpuid, true); cpuid++; } -- 2.21.0