Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4259508yba; Mon, 29 Apr 2019 16:51:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7s4rbLWM2DIJZkfQOauRy0208jLWsY6rSkuuGiiMbJTCTdJppZXDBhutUTFp3yhQpEklm X-Received: by 2002:a63:6b08:: with SMTP id g8mr62598645pgc.211.1556581907138; Mon, 29 Apr 2019 16:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556581907; cv=none; d=google.com; s=arc-20160816; b=I6lqUwYr1l0oY6fv0ZW2WA4WYk2vc/EeJmM6eBjOfCzX8LFZCGvatbbth8Uu/gT3RB 2hVq0htdbmIq32SUrMmupjjUUe9IYU3nNOvEQB6xCMH3ucHMVDP7bXdl9dEugRpGo4x2 G3rzskEuM+F/5yr/5j1I1lcyHcDEYhQhyIEdgzB/RD6UKXnqy5fGuwu6p+6cHZOtU9Rv kVlps9tlZTxuGrtky7Rvt0jvezfHFGmOI/WFL79AkGKRApYdaijSEDZZpMzjzG82KdAJ F9ww+jOsaWKkqGxOx/sOuukz2o8sPiWB8Xt9lXIxU3AsUcFLjLI3pf+0u2WDE7rQOAeU wX9Q== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=iki8lEciOli5KOvhEgs9JNfHNGA2ZFukuxTBdMWWHqg=; b=vbUjt14MWVrwc28paT3gpcaByXfuoggXgJmOA699p+QgA28II4t4wdDP6rtb2lMSc/ L4ldNI0Jq6ietVkK6hZl5ovek/TJIwqVbnD3Or0sZ9dGsiKDAdU3HrLHqscuSOV/pp2w V9+97nZ6G5RdBXC+/J1Hum5CDqTBtjU4nLjLmq+NHtJBVSbU9y6up2nKqIuqIhc00SUX 6l6fmkQlzVjSwxjxxFeX2ojK24BdJX74bEmvIX7wsZO9INR0lOvAcSrepMO9PImv3W1y Kp3uCVlj6ZFVLFwvdS8QriuiorfWKISW0gcBCJ8elJ1YQ5xKUYq+6iGsrWk9WhIaBgrp D45A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Z9RbQk9f; 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 p85si36109299pfi.27.2019.04.29.16.51.31; Mon, 29 Apr 2019 16:51:47 -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=pass header.i=@sifive.com header.s=google header.b=Z9RbQk9f; 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 S1729237AbfD2XuG (ORCPT + 99 others); Mon, 29 Apr 2019 19:50:06 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45615 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728844AbfD2XuF (ORCPT ); Mon, 29 Apr 2019 19:50:05 -0400 Received: by mail-pg1-f195.google.com with SMTP id i21so2479262pgi.12 for ; Mon, 29 Apr 2019 16:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=iki8lEciOli5KOvhEgs9JNfHNGA2ZFukuxTBdMWWHqg=; b=Z9RbQk9f9/Px7IbWu4Gh/AbhBLH1/XY5qaP4iXWOCmDcvgzOpHbN9FfhX4JvspNEQJ Jx0GSeCf+B9lSir3UxYBQb3OOsHCNQQnirb4zuBR4E4gdALFi+3nR4MgVBiXrfWOVWRt TDe5iG2xuVMaaKSKVgatTMI1v03YB+Fg67QBZG4j2mbu4mPcAmDikXOOadBmqymfhDlK zFBlEHDkoUYhem00EIGOEKMQkwl0AWonW82q5zT/+GffjfXhSFYl6U7RdqM+NCOvRcXH WPgMrKCEGu1aR7Q5aDIttO8ku2+lVuXIYbHbeEBNBIqTXNHVQQkJxi1KnTECOZuRivTp f5YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=iki8lEciOli5KOvhEgs9JNfHNGA2ZFukuxTBdMWWHqg=; b=NOfEPpx2d0q5GfUYS0QS5Sjv7vHb7L88qs/Z7hiBmixDWowdIOKVsYHb1Xt/mAiU0+ h0QaAyuHYz+7tmIEBQ/UT4qvlRP4NbWbtirrEJTa6DNjxV2Vwqh3gfFWQj3EXE77y4dC ratfYsyZHgXMRqGof7ew11veB4vYEKdUEBdRa2JTtgyRRy5LLULWZWwd5lqzOzO7JS6T I/CS8QTmSIvlzkSSpc/fLs6vf6xWMeR3LaonwaqG19uye/jKZCgcw9vx8nks4MfxGaDs YoasF69lhRIYnmPGgQhdhYa1uzVPdn3Gp+2rhQtRTJeMkufRA6QFUs6ghPnhXsuUYtXQ Uqcw== X-Gm-Message-State: APjAAAWLKsFPHVkfv7eYRPYxWCjucrPktNv8Ypj7E72yzqJ90YMfd3RX KdnhJ5qjlhH5jLWs4fmm0cjFUL1eI8uHAw== X-Received: by 2002:a63:6fcf:: with SMTP id k198mr61685712pgc.158.1556581804682; Mon, 29 Apr 2019 16:50:04 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id e13sm52032242pgb.37.2019.04.29.16.50.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 16:50:03 -0700 (PDT) Date: Mon, 29 Apr 2019 16:50:03 -0700 (PDT) X-Google-Original-Date: Mon, 29 Apr 2019 16:49:07 PDT (-0700) Subject: Re: [PATCH v3 2/3] RISC-V: Implement nosmp commandline option. In-Reply-To: <20190424000227.3085-3-atish.patra@wdc.com> CC: linux-kernel@vger.kernel.org, atish.patra@wdc.com, aou@eecs.berkeley.edu, schwab@suse.de, anup@brainfault.org, dmitriy@oss-tech.org, johan@kernel.org, linux-riscv@lists.infradead.org, Paul Walmsley , tglx@linutronix.de, Christoph Hellwig From: Palmer Dabbelt To: atish.patra@wdc.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Apr 2019 17:02:26 PDT (-0700), atish.patra@wdc.com 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); > + } > } > > 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++; > } Thanks. I've taken all three of these into for-next.