All of lore.kernel.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@sifive.com>
To: 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 <paul.walmsley@sifive.com>,
	tglx@linutronix.de, Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v3 2/3] RISC-V: Implement nosmp commandline option.
Date: Mon, 29 Apr 2019 16:50:03 -0700 (PDT)	[thread overview]
Message-ID: <mhng-56c3b718-eda9-4f5b-8124-7dee869fde1d@palmer-si-x1e> (raw)
In-Reply-To: <20190424000227.3085-3-atish.patra@wdc.com>

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 <atish.patra@wdc.com>
> ---
>  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.

WARNING: multiple messages have this Message-ID (diff)
From: Palmer Dabbelt <palmer@sifive.com>
To: atish.patra@wdc.com
Cc: aou@eecs.berkeley.edu, dmitriy@oss-tech.org, anup@brainfault.org,
	Paul Walmsley <paul.walmsley@sifive.com>,
	linux-kernel@vger.kernel.org, johan@kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	atish.patra@wdc.com, schwab@suse.de,
	linux-riscv@lists.infradead.org, tglx@linutronix.de
Subject: Re: [PATCH v3 2/3] RISC-V: Implement nosmp commandline option.
Date: Mon, 29 Apr 2019 16:50:03 -0700 (PDT)	[thread overview]
Message-ID: <mhng-56c3b718-eda9-4f5b-8124-7dee869fde1d@palmer-si-x1e> (raw)
In-Reply-To: <20190424000227.3085-3-atish.patra@wdc.com>

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 <atish.patra@wdc.com>
> ---
>  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.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2019-04-29 23:50 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 [this message]
2019-04-29 23:50     ` Palmer Dabbelt
2019-04-24  0:02 ` [PATCH v3 3/3] RISC-V: Support nr_cpus command line option Atish Patra
2019-04-24  0:02   ` 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=mhng-56c3b718-eda9-4f5b-8124-7dee869fde1d@palmer-si-x1e \
    --to=palmer@sifive.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@wdc.com \
    --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=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: link
Be 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.