* [RFC][PATCH] powerpc: respect how command line nr_cpus is set
@ 2011-05-04 20:17 Kumar Gala
2011-05-05 2:25 ` Benjamin Herrenschmidt
2011-05-12 0:26 ` [RFC] " Milton Miller
0 siblings, 2 replies; 5+ messages in thread
From: Kumar Gala @ 2011-05-04 20:17 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
We should utilize nr_cpus as the max # of CPUs that we can have present
instead of NR_CPUS. This way we actually respect how nr_cpus is set on
the command line rather than ignoring it.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
I think this is what we should be doing, but would like someone else to take
a look.
- k
arch/powerpc/kernel/setup-common.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 21f30cb..fedf813 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -424,7 +424,7 @@ void __init smp_setup_cpu_maps(void)
DBG("smp_setup_cpu_maps()\n");
- while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
+ while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < nr_cpu_ids) {
const int *intserv;
int j, len;
@@ -443,7 +443,7 @@ void __init smp_setup_cpu_maps(void)
intserv = &cpu; /* assume logical == phys */
}
- for (j = 0; j < nthreads && cpu < NR_CPUS; j++) {
+ for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
DBG(" thread %d -> cpu %d (hard id %d)\n",
j, cpu, intserv[j]);
set_cpu_present(cpu, true);
@@ -483,12 +483,12 @@ void __init smp_setup_cpu_maps(void)
if (cpu_has_feature(CPU_FTR_SMT))
maxcpus *= nthreads;
- if (maxcpus > NR_CPUS) {
+ if (maxcpus > nr_cpu_ids) {
printk(KERN_WARNING
"Partition configured for %d cpus, "
"operating system maximum is %d.\n",
- maxcpus, NR_CPUS);
- maxcpus = NR_CPUS;
+ maxcpus, nr_cpu_ids);
+ maxcpus = nr_cpu_ids;
} else
printk(KERN_INFO "Partition configured for %d cpus.\n",
maxcpus);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFC][PATCH] powerpc: respect how command line nr_cpus is set
2011-05-04 20:17 [RFC][PATCH] powerpc: respect how command line nr_cpus is set Kumar Gala
@ 2011-05-05 2:25 ` Benjamin Herrenschmidt
2011-05-05 11:38 ` Kumar Gala
2011-05-12 0:26 ` [RFC] " Milton Miller
1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2011-05-05 2:25 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Wed, 2011-05-04 at 15:17 -0500, Kumar Gala wrote:
> We should utilize nr_cpus as the max # of CPUs that we can have present
> instead of NR_CPUS. This way we actually respect how nr_cpus is set on
> the command line rather than ignoring it.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
> I think this is what we should be doing, but would like someone else to take
> a look.
The main question I have is should max_cpus absolutely limit the number
of possible CPUs or should it limit the number that get automatically
onlined at boot, potentially letting us bring the rest online later on ?
Cheers,
Ben.
> - k
>
> arch/powerpc/kernel/setup-common.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 21f30cb..fedf813 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -424,7 +424,7 @@ void __init smp_setup_cpu_maps(void)
>
> DBG("smp_setup_cpu_maps()\n");
>
> - while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
> + while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < nr_cpu_ids) {
> const int *intserv;
> int j, len;
>
> @@ -443,7 +443,7 @@ void __init smp_setup_cpu_maps(void)
> intserv = &cpu; /* assume logical == phys */
> }
>
> - for (j = 0; j < nthreads && cpu < NR_CPUS; j++) {
> + for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
> DBG(" thread %d -> cpu %d (hard id %d)\n",
> j, cpu, intserv[j]);
> set_cpu_present(cpu, true);
> @@ -483,12 +483,12 @@ void __init smp_setup_cpu_maps(void)
> if (cpu_has_feature(CPU_FTR_SMT))
> maxcpus *= nthreads;
>
> - if (maxcpus > NR_CPUS) {
> + if (maxcpus > nr_cpu_ids) {
> printk(KERN_WARNING
> "Partition configured for %d cpus, "
> "operating system maximum is %d.\n",
> - maxcpus, NR_CPUS);
> - maxcpus = NR_CPUS;
> + maxcpus, nr_cpu_ids);
> + maxcpus = nr_cpu_ids;
> } else
> printk(KERN_INFO "Partition configured for %d cpus.\n",
> maxcpus);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC][PATCH] powerpc: respect how command line nr_cpus is set
2011-05-05 2:25 ` Benjamin Herrenschmidt
@ 2011-05-05 11:38 ` Kumar Gala
2011-05-05 22:29 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2011-05-05 11:38 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On May 4, 2011, at 9:25 PM, Benjamin Herrenschmidt wrote:
> On Wed, 2011-05-04 at 15:17 -0500, Kumar Gala wrote:
>> We should utilize nr_cpus as the max # of CPUs that we can have =
present
>> instead of NR_CPUS. This way we actually respect how nr_cpus is set =
on
>> the command line rather than ignoring it.
>>=20
>> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>> ---
>> I think this is what we should be doing, but would like someone else =
to take
>> a look.
>=20
> The main question I have is should max_cpus absolutely limit the =
number
> of possible CPUs or should it limit the number that get automatically
> onlined at boot, potentially letting us bring the rest online later on =
?
>=20
> Cheers,
> Ben.
=46rom Documentation/kernel-parameters.txt:
nr_cpus=3D [SMP] Maximum number of processors that an SMP =
kernel
could support. nr_cpus=3Dn : n >=3D 1 limits =
the kernel to
supporting 'n' processors. Later in runtime you =
can not
use hotplug cpu feature to put more cpu back to =
online.
just like you compile the kernel NR_CPUS=3Dn
Which makes me think we should have max_cpus be an absolute limit.
- k=
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC][PATCH] powerpc: respect how command line nr_cpus is set
2011-05-05 11:38 ` Kumar Gala
@ 2011-05-05 22:29 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2011-05-05 22:29 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
> From Documentation/kernel-parameters.txt:
>
> nr_cpus= [SMP] Maximum number of processors that an SMP kernel
> could support. nr_cpus=n : n >= 1 limits the kernel to
> supporting 'n' processors. Later in runtime you can not
> use hotplug cpu feature to put more cpu back to online.
> just like you compile the kernel NR_CPUS=n
>
> Which makes me think we should have max_cpus be an absolute limit.
Ok, looks like I've been confusing nr_cpus= vs. max_cpus= or something
like that.
I'll have a look at your patch later today.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] powerpc: respect how command line nr_cpus is set
2011-05-04 20:17 [RFC][PATCH] powerpc: respect how command line nr_cpus is set Kumar Gala
2011-05-05 2:25 ` Benjamin Herrenschmidt
@ 2011-05-12 0:26 ` Milton Miller
1 sibling, 0 replies; 5+ messages in thread
From: Milton Miller @ 2011-05-12 0:26 UTC (permalink / raw)
To: Kumar Gala, Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Wed, 04 May 2011 around 10:17:37 -0000, Kumar Gala wrote:
> We should utilize nr_cpus as the max # of CPUs that we can have present
> instead of NR_CPUS. This way we actually respect how nr_cpus is set on
> the command line rather than ignoring it.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
>
> ---
> I think this is what we should be doing, but would like someone else to take
> a look.
>
> - k
>
> arch/powerpc/kernel/setup-common.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
This looks very similar to my patch at
http://patchwork.ozlabs.org/patch/95080/ except I also updated the
comment. Also, the variable is nr_cpu_ids while the parameter
is nr_cpus=, the first instance in in the changelog is referring to
the variable while the second is the parameter.
Sorry I took me so long get that part of my series tested and posted.
milton
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-12 0:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 20:17 [RFC][PATCH] powerpc: respect how command line nr_cpus is set Kumar Gala
2011-05-05 2:25 ` Benjamin Herrenschmidt
2011-05-05 11:38 ` Kumar Gala
2011-05-05 22:29 ` Benjamin Herrenschmidt
2011-05-12 0:26 ` [RFC] " Milton Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).