Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4185005yba; Tue, 23 Apr 2019 17:03:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGYs/vSh6RWOhDOjIN4B13RmNlRJG7LkLy8JXarwz8PJLaNrgqAzQhpLKbKxCvfb8UQHo5 X-Received: by 2002:a65:424b:: with SMTP id d11mr9374450pgq.205.1556064216244; Tue, 23 Apr 2019 17:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556064216; cv=none; d=google.com; s=arc-20160816; b=pUlcbrrTqlKy0Z2H2hZtCq8kLAa0jtASnAQ/VbVLA17GSLMh92cWaaz/30CIY1RAKN EpCRaoUR9/iENzTa9rLtX477ebIlE6h3Dem7E7ymNUnJo4/MbPgAruSO6lEve7wujR7f 56043mdIDZDayAq5N9myCCf1M5p40VQmMLRcy0rG9jjBFNqhC/+uvxBfxAhw8SNZRuzR 2SFm/lVe5oxW2mymPTiw34lw99yun1ArEMuDA00qHJ3zlIojjjEdEkcyILUZkNT36hna RiczR1448MGSX+q8O1ZBcJS+iqQv6ZN13I/1XlUzHEinA+bKpAyH3/Qj4SbabAQN62ml 0b7A== 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=q4piQzt+FshizqbpSixiEgso5n2qK7Te+PXsYnICXzLpitc2jZETQ25eQMfr+MNYY7 ncIT1HFxABHzLpldsW5aZ20INEKmtQVkICbxJNv84Q8FXoMu0OvKhTPZ8Z2k31nBcezk 6FepUitzHvT8b0mEi1tdH8MQzGKSxDStTeyL5XBToQxnJopcaaHnklHBoWZU+6ZD00oX W8QU53cj4YB7Y817N9SXBNAVSx9+WpqNaZdPga6Zqz/6/A16dX15l1uBOcKzPPKNEVMi eORrhs67XzRc/JlLlqD17MAiPUqT1oQnmdTZaRZd2qEgD7UQ8ru89DK//ENksAnqusSl UNLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=h58Odmd8; 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 t8si15432933pgv.73.2019.04.23.17.03.19; Tue, 23 Apr 2019 17:03:36 -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=h58Odmd8; 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 S1728831AbfDXACZ (ORCPT + 99 others); Tue, 23 Apr 2019 20:02:25 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:53970 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726339AbfDXACY (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=R2/5jwhYTGQ1JCFD91I9OK6vJ4c5B03XruX+Wm8H9FA=; b=h58Odmd8t8oUq5asA9yKnYIEi8y9CYoAMl3f6ZiKhP9xqEexCV+OUO9M FpqC2X1Ad4vV1nNKsloC0yWGIe6zFbc072+T/aA4jpxoZZebChMxyluSQ L26yRTlMIX7xxvqY4rAjFQ76oyxzp8pjnvcw2m0Zi77DoVbkPx2NUTucp c7IS8RkFKO5oZxkLbGEH5vsMaG1/Z06k/AZ7f4BBTtBriniTIJZ4UP/PL O/YCSxG5Jdco/0EsoRYd+zIrT29wTK8jGlWDctzm6KAxGBLNmtbc9thXC CR+TBV/1fp1m9v/VMWjqP3bBJjeikHDt6ZRAsJ2Vito1d712JXXJjFazu g==; X-IronPort-AV: E=Sophos;i="5.60,387,1549900800"; d="scan'208";a="106649532" 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:23 +0800 IronPort-SDR: JMMEMpW4f7Rezcvekk3nqIoG2R3h+0vMWSWdfIhV10zDJI4vA3qlV4De6bVeTOILrcL0F787hs FbeTXSxU1FBYwt0Cmda5tH0clljNF+k7nmcAyCNo1k6L0DuVq8Wopsfmc+lCvKPjEoCMwKNl97 jnuYV3jTSqSuLCkPJ+jOTimxodj2jaI6pFdR1NjxaFYhlVKbAkw1GavWL7w22PapDJuMIRUd7z 5Lfuk55BIWs/WmZaGaUkVJp4czp5HPfLir+E3E6qw+B0/dH4gCiactzeRDm43bWxjyFFFP1qJ4 rTQLy2XRCC0gbt3Mbj2YR/tV 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: NOADQjAz6eLB2ulCCRn0+vCTxLNg3viC5jnh/ICSir8Y7r7k2imFel2bN3hhmoRp27+eU3dYJf dczho/LE9GN07SkGgbRHzTsVH8kpxmDjIc59M4xPaySkAJz0YlHVzrkM+bNB9ZrRyHPU+jmjOY 48qdQD3mtEx/LVDzKuxulu/oo9wUD1rI24jeT5GHLO4zUussvi67gVyUoIzqdIfQB7D1Ppmd2W UHd+PMB8bnry9ucwR4iUGlShBY87JUyTKqpTp1EtRzNQmrgDp17hFl1oQG0sd0iKfwEOW01eqC YHE= 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 2/3] RISC-V: Implement nosmp commandline option. Date: Tue, 23 Apr 2019 17:02:26 -0700 Message-Id: <20190424000227.3085-3-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 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