Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5553239yba; Thu, 11 Apr 2019 00:03:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwn1j1S15G3Rmsk04ynonPRNU1b224bZlm3GAADfMvt0pL2lqbB/Jrs7C0VYEMLej//4tJt X-Received: by 2002:a63:be02:: with SMTP id l2mr43031404pgf.48.1554966232683; Thu, 11 Apr 2019 00:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554966232; cv=none; d=google.com; s=arc-20160816; b=FVybSIIg7t+1ycHIqF5DkRKhwWqF0NUmBmQvdXgmIZMbb/cQLE3GSEE7JMYO4qAW4v RbK8Zy711W8VjeeeFTGfOI3zV3jFBpgElVv/FGKldLAwLAEShSocw+sksvZVVli5y1fi 7NssByzzQleS96JNz6140YC6Hm28GAfRo6E9Bb2W1pAcNM/AMI2u5MhaPSFyKlBc+BTb yZMnMyBGO1cJfVzWU9KHLmBXaxeTk0ZNkh86e9qUCMGooQFSCUrT9vmMqZY+/+2RoznQ j9OnI+Szqu8NEI6Mlgxbs/aNZ7xjep1CuC1B0OFOhQkUa+f5ZPi8SwZIe/GwQyJb+gbM fvjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VYbJzQw7T4sWfqY2fgQDJDOLaKA52Nv1WM6QY9eEvX0=; b=BR1Q/IxHielWOEE2iSFddOBJNTzktoxAicmC9Tx22Kqyaj6qM6EH+hlJEaOhP+AQhl V6Ti5J40BTnGA6Uz7fsw+yJLcBL64lQ5AhrbYcG68HecO2rxzyHwxEHQ1Hd4vT+5Yy9Y T0dIVVNOQ9An9N5CXZcNJNozNuqUFlMB8qPTZMfsilDRDOTY/Wb24x27AgeMTe8xdf69 LklTVT2LKeTnOwzTYu7AUN185C3fTJBjkmHIumfRb6v3/ajD3lM4KMV01dIb3fFDTNVm rGn260B1MCIVxBKaCZfK8DejVPpcXY1A2b6wL0Pjp5+I/jwmi+K5uwIP+5w1nCWHYkj1 tykw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Al80tNCh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si23713347plo.217.2019.04.11.00.03.35; Thu, 11 Apr 2019 00:03:52 -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=@infradead.org header.s=bombadil.20170209 header.b=Al80tNCh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726713AbfDKHBU (ORCPT + 99 others); Thu, 11 Apr 2019 03:01:20 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55152 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725783AbfDKHBU (ORCPT ); Thu, 11 Apr 2019 03:01:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VYbJzQw7T4sWfqY2fgQDJDOLaKA52Nv1WM6QY9eEvX0=; b=Al80tNChYpBL+sHza1FeO9mA5 J8VbYbZ0w+SzT8Q31/MVLqMePl6SnN+JUOiHFYbrzmA0PHSQksv3wad6XS0ygFnsi+5ojji2ClngA xdmIDhkdhoiMqLlKRSV40rCLcq2Sa0KjVxHU+xrw1PxcDmEvta2RiqjVSZMxjHwv0LtPnSa6raZkv Y/82xHAgaLdNvU4+/3NmkMtsTcWL4WfZc5W3dqjoEOGaeaRDAeHIhw1kbJ0O0czN1jIkadUMp3w0D 1NyV7fVJK4mAMn4qpRf3cD43ceYB6AjLOwWWo89+AKcAVie9x7Rh4InxYA5UCJEJQBE95E/QQDzpi KsdT4fucg==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hETi4-0003iG-2Y; Thu, 11 Apr 2019 07:01:20 +0000 Date: Thu, 11 Apr 2019 00:01:19 -0700 From: Christoph Hellwig To: Atish Patra Cc: linux-kernel@vger.kernel.org, Albert Ou , Andreas Schwab , Anup Patel , Dmitriy Cherkasov , Johan Hovold , linux-riscv@lists.infradead.org, Palmer Dabbelt , Paul Walmsley Subject: Re: [PATCH v2 3/4] RISC-V: Implement nosmp commandline option. Message-ID: <20190411070119.GD29422@infradead.org> References: <20190410230443.15729-1-atish.patra@wdc.com> <20190410230443.15729-4-atish.patra@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190410230443.15729-4-atish.patra@wdc.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 10, 2019 at 04:04:42PM -0700, Atish Patra wrote: > 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); > + } Most other architectures seem to use init_cpu_present() here. Otherwise this looks fine to me.