From: Atish Patra <atish.patra@wdc.com> To: linux-kernel@vger.kernel.org Cc: Atish Patra <atish.patra@wdc.com>, Albert Ou <aou@eecs.berkeley.edu>, Andreas Schwab <schwab@suse.de>, Anup Patel <anup@brainfault.org>, Dmitriy Cherkasov <dmitriy@oss-tech.org>, Johan Hovold <johan@kernel.org>, linux-riscv@lists.infradead.org, Palmer Dabbelt <palmer@sifive.com>, Paul Walmsley <paul.walmsley@sifive.com>, Thomas Gleixner <tglx@linutronix.de>, Christoph Hellwig <hch@infradead.org> Subject: [PATCH v3 3/3] RISC-V: Support nr_cpus command line option. Date: Tue, 23 Apr 2019 17:02:27 -0700 [thread overview] Message-ID: <20190424000227.3085-4-atish.patra@wdc.com> (raw) In-Reply-To: <20190424000227.3085-1-atish.patra@wdc.com> If nr_cpus command line option is set, maximum possible cpu should be set to that value. Signed-off-by: Atish Patra <atish.patra@wdc.com> --- arch/riscv/kernel/smpboot.c | 10 +++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/kernel/smpboot. diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index a8ad200581aa..7a0b62252524 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -84,11 +84,19 @@ void __init setup_smp(void) } cpuid_to_hartid_map(cpuid) = hart; - set_cpu_possible(cpuid, true); cpuid++; } BUG_ON(!found_boot_cpu); + + if (cpuid > nr_cpu_ids) + pr_warn("Total number of cpus [%d] is greater than nr_cpus option value [%d]\n", + cpuid, nr_cpu_ids); + + for (cpuid = 1; cpuid < nr_cpu_ids; cpuid++) { + if (cpuid_to_hartid_map(cpuid) != INVALID_HARTID) + set_cpu_possible(cpuid, true); + } } int __cpu_up(unsigned int cpu, struct task_struct *tidle) -- 2.21.0
WARNING: multiple messages have this Message-ID (diff)
From: Atish Patra <atish.patra@wdc.com> To: linux-kernel@vger.kernel.org Cc: Albert Ou <aou@eecs.berkeley.edu>, Dmitriy Cherkasov <dmitriy@oss-tech.org>, Anup Patel <anup@brainfault.org>, Palmer Dabbelt <palmer@sifive.com>, Johan Hovold <johan@kernel.org>, Christoph Hellwig <hch@infradead.org>, Atish Patra <atish.patra@wdc.com>, Paul Walmsley <paul.walmsley@sifive.com>, Andreas Schwab <schwab@suse.de>, linux-riscv@lists.infradead.org, Thomas Gleixner <tglx@linutronix.de> Subject: [PATCH v3 3/3] RISC-V: Support nr_cpus command line option. Date: Tue, 23 Apr 2019 17:02:27 -0700 [thread overview] Message-ID: <20190424000227.3085-4-atish.patra@wdc.com> (raw) In-Reply-To: <20190424000227.3085-1-atish.patra@wdc.com> If nr_cpus command line option is set, maximum possible cpu should be set to that value. Signed-off-by: Atish Patra <atish.patra@wdc.com> --- arch/riscv/kernel/smpboot.c | 10 +++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/kernel/smpboot. diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index a8ad200581aa..7a0b62252524 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -84,11 +84,19 @@ void __init setup_smp(void) } cpuid_to_hartid_map(cpuid) = hart; - set_cpu_possible(cpuid, true); cpuid++; } BUG_ON(!found_boot_cpu); + + if (cpuid > nr_cpu_ids) + pr_warn("Total number of cpus [%d] is greater than nr_cpus option value [%d]\n", + cpuid, nr_cpu_ids); + + for (cpuid = 1; cpuid < nr_cpu_ids; cpuid++) { + if (cpuid_to_hartid_map(cpuid) != INVALID_HARTID) + set_cpu_possible(cpuid, true); + } } int __cpu_up(unsigned int cpu, struct task_struct *tidle) -- 2.21.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2019-04-24 0:02 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-24 0:02 [PATCH v3 0/3] Miscellaneous kernel command line fixes Atish Patra 2019-04-24 0:02 ` Atish Patra 2019-04-24 0:02 ` [PATCH v3 1/3] RISC-V: Add RISC-V specific arch_match_cpu_phys_id Atish Patra 2019-04-24 0:02 ` Atish Patra 2019-04-24 6:21 ` Christoph Hellwig 2019-04-24 6:21 ` Christoph Hellwig 2019-04-30 0:36 ` Palmer Dabbelt 2019-04-30 0:36 ` Palmer Dabbelt 2019-04-24 9:07 ` Sudeep Holla 2019-04-24 9:07 ` Sudeep Holla 2019-04-24 16:50 ` Atish Patra 2019-04-24 16:50 ` Atish Patra 2019-04-24 0:02 ` [PATCH v3 2/3] RISC-V: Implement nosmp commandline option Atish Patra 2019-04-24 0:02 ` Atish Patra 2019-04-24 6:21 ` Christoph Hellwig 2019-04-24 6:21 ` Christoph Hellwig 2019-04-29 23:50 ` Palmer Dabbelt 2019-04-29 23:50 ` Palmer Dabbelt 2019-04-24 0:02 ` Atish Patra [this message] 2019-04-24 0:02 ` [PATCH v3 3/3] RISC-V: Support nr_cpus command line option Atish Patra 2019-04-24 6:22 ` Christoph Hellwig 2019-04-24 6:22 ` Christoph Hellwig
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190424000227.3085-4-atish.patra@wdc.com \ --to=atish.patra@wdc.com \ --cc=anup@brainfault.org \ --cc=aou@eecs.berkeley.edu \ --cc=dmitriy@oss-tech.org \ --cc=hch@infradead.org \ --cc=johan@kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@sifive.com \ --cc=paul.walmsley@sifive.com \ --cc=schwab@suse.de \ --cc=tglx@linutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.