Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp150530imj; Thu, 14 Feb 2019 17:26:01 -0800 (PST) X-Google-Smtp-Source: AHgI3IbMopYVFq4pRap63mqcyUvn87GtMG4WI0NKNv6pso366DWfWn0M9pTtLIHEimGb0gjPKIS0 X-Received: by 2002:a17:902:1486:: with SMTP id k6mr7554569pla.49.1550193961424; Thu, 14 Feb 2019 17:26:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550193961; cv=none; d=google.com; s=arc-20160816; b=FkBDaXGUexFHO2WO/lGj60WIk5Rj+hZaaOuJ5jf/6QDa6Q/4ViWIDXzfEQ8P14zOBb CHdGpJ6wx4ozqMblIleJyrfL0MQ6luyZvNi3ATvLlG5JRLRWEeJxzbmF+yakuO/orD4N Qs0jJOVB4Df0dL6MUFlr5V1AapFbs/GDnQAU/X3sm2BuikiouUCn8law1S+SUmOj7iFJ wra1SpTuQwVvuS1rDBpLjBZaGURp3dcezdLelD4Z5nhXs6V7bn5WWbj6ATgYi9uGfO4V ph5ccycGIfEu+/nExh/hgjuYQ2IJ8PJFxJPBHT4dN1LkaN7d3gwE096/9eUImPej8QON 0NIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=c8eFFfUcWOkwpwxkv+LdiUJ0G26zd02i0kfM9g+IrNg=; b=vuaZzAAcbsODmdBiDoAiL/CkdaJHJIHRb1vDcOigMBJx5inomvkWG/jbpAT74s/Xs8 316g7ToIxlERYEhIWdR5yGA4AsjoDV3lKat90NA+3YlHNt3AGEi5glEsvzFnaeGKbZxg 0FoesliDcbvOFax6GaJboRfQvFrfGk0D1gpoOJOvbbOWoGinb+TSombhs1ul79gBIf1n /6lOD2BiquloA1g9K2Iojik5M9F2FeHUC5Y285gXv48iZz4dmHdfF7OFwT10m9RVMoJa SvvLUAWd2ceORgTv6KmXv4Bp/uXQnvKXEnqUfcfVHKGpCBGdybsLgYhQK3r1mBO89nXb G8dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=KyNB7+OG; 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 m187si3957159pfm.51.2019.02.14.17.25.46; Thu, 14 Feb 2019 17:26:01 -0800 (PST) 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=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=KyNB7+OG; 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 S2438061AbfBNR7L (ORCPT + 99 others); Thu, 14 Feb 2019 12:59:11 -0500 Received: from a9-54.smtp-out.amazonses.com ([54.240.9.54]:35474 "EHLO a9-54.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727852AbfBNR7K (ORCPT ); Thu, 14 Feb 2019 12:59:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1550167149; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=eBf2c5u+rFMWbJXqlzWgo7tdnCY2i7jL5vluukLr+Gc=; b=KyNB7+OGNJVlLqLzr4dHHh/FQx/4gPm8T9umBwZSV2Z7vZjdTsKyy2ifGuwyEckt Vq9ylGERSB/aRgH/IM6X9sk0LOFC+8S3kcYDW98gbwslIfundqeAWdsUqrqEXD2Y7aD UvQf0PFQSvNcreG5K7CXPZ7pZVP1gRl2vBBCV+fM= Date: Thu, 14 Feb 2019 17:59:09 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Atish Patra cc: linux-riscv@lists.infradead.org, Albert Ou , Jason Cooper , Alan Kao , Dmitriy Cherkasov , Anup Patel , Daniel Lezcano , Johan Hovold , linux-kernel@vger.kernel.org, Palmer Dabbelt , Paul Walmsley , Andreas Schwab , Marc Zyngier , Thomas Gleixner , Guenter Roeck Subject: Re: [v5 PATCH 5/8] RISC-V: Compare cpuid with NR_CPUS before mapping. In-Reply-To: <1550089092-28783-6-git-send-email-atish.patra@wdc.com> Message-ID: <01000168ed298ba3-fea3ca2b-436b-4ce6-a0df-cebe727bf55c-000000@email.amazonses.com> References: <1550089092-28783-1-git-send-email-atish.patra@wdc.com> <1550089092-28783-6-git-send-email-atish.patra@wdc.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2019.02.14-54.240.9.54 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Feb 2019, Atish Patra wrote: > --- a/arch/riscv/kernel/smpboot.c > +++ b/arch/riscv/kernel/smpboot.c > @@ -66,6 +66,11 @@ void __init setup_smp(void) > found_boot_cpu = 1; > continue; > } > + if (cpuid >= NR_CPUS) { Use nr_cpu_ids instead? Its initialized to NR_CPUS but can be restricted if we can determine on boot how many processor we truly have.