powerpc: respect how command line nr_cpus is set
RFC PATCH 1/1 powerpc: respect how command line nr_cpus is set
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.
---
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(-)
arch/powerpc/kernel/setup-common.c +5 -5
@@ -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);
Signature · 1 line
1.7.3.4
Quoted 8 lines · Kumar Gala
We should utilize
nr_cpusas the max # of CPUs that we can have present instead ofNR_CPUS. This way we actually respect hownr_cpusis set on the command line rather than ignoring it.Signed-off-by Kumar Gala <[email protected]>---
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.
Quoted 43 lines
- k
arch/powerpc/kernel/setup-common.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)arch/powerpc/kernel/setup-common.c +5
-5@@ -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);
Quoted 2 lines · Benjamin Herrenschmidt
Quoted 1 line · Kumar Gala
We should utilize
nr_cpusas the max # of CPUs that we can have =
present
Quoted 1 line
Quoted 1 line
instead of
NR_CPUS. This way we actually respect hownr_cpusis set =
on
Quoted 5 lines
Quoted 5 lines
the command line rather than ignoring it.
=20Signed-off-by Kumar Gala <[email protected]>---
I think this is what we should be doing, but would like someone else =
to take
Quoted 3 lines
Quoted 1 line
a look.
=20
The main question I have is shouldmax_cpusabsolutely limit the =
number
Quoted 2 lines
of possible CPUs or should it limit the number that get automatically onlined at boot, potentially letting us bring the rest online later on =
?
Quoted 3 lines
=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=
Quoted 10 lines
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=nWhich makes me think we should have
max_cpusbe 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.
Quoted 6 lines · Kumar Gala
We should utilize
nr_cpusas the max # of CPUs that we can have present instead ofNR_CPUS. This way we actually respect hownr_cpusis set on the command line rather than ignoring it.Signed-off-by Kumar Gala <[email protected]>
Quoted 9 lines
---
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