Skip to contentSkip to conversation

nr_cpus cmdline parameter not working

PATCH Mark Salter 2 participants 3 messages Sep 28, 2011 – Oct 3, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

I noticed that nr_cpus=1 doesn't appear to have any effect on a pandaboard (and probably others from the looks of things). This changes seems to be needed, but I'm not really sure if this is the right thing or not.

arch/arm/mach-omap2/omap-smp.c +3 -0
index ce65e93..a1198ac 100644
@@ -117,6 +117,9 @@ void __init smp_init_cpus(void)
 		ncores = NR_CPUS;
 	}
 
+	if (ncores > nr_cpu_ids)
+		ncores = nr_cpu_ids;
+
 	for (i = 0; i < ncores; i++)
 		set_cpu_possible(i, true);
 

--Mark

#1 lore raw
Quoted 10 lines · Mark Salter

I noticed that nr_cpus=1 doesn't appear to have any effect on a pandaboard (and probably others from the looks of things). This changes seems to be needed, but I'm not really sure if this is the right thing or not.

arch/arm/mach-omap2/omap-smp.c +0 -0
index ce65e93..a1198ac 100644

arch/arm/mach-omap2/omap-smp.c void __init smp_init_cpus(void) · line 122

Quoted 6 lines
arch/arm/mach-omap2/omap-smp.c +3 -0
@@ -117,6 +117,9 @@ void __init smp_init_cpus(void)
 		ncores = NR_CPUS;
 	}
 
+	if (ncores > nr_cpu_ids)
+		ncores = nr_cpu_ids;
+

This potentially affects all SMP platforms, so the patch needs to be bigger than this.

Also, I think the test above should be modified to use nr_cpu_ids rather than NR_CPUS, to be inline with what x86 does:

        /* nr_cpu_ids could be reduced via nr_cpus= */
        if (possible > nr_cpu_ids) {
                printk(KERN_WARNING
                        "%d Processors exceeds NR_CPUS limit of %d\n",
                        possible, nr_cpu_ids);
                possible = nr_cpu_ids;
        }

(This is essentially the same check that we're doing.)

Could you have a look at this and cook up another patch covering the other SMP platforms please?

Thanks.

#2 lore raw
Quoted 32 lines · Russell King - ARM Linux
Quoted 10 lines · Mark Salter

I noticed that nr_cpus=1 doesn't appear to have any effect on a pandaboard (and probably others from the looks of things). This changes seems to be needed, but I'm not really sure if this is the right thing or not.

arch/arm/mach-omap2/omap-smp.c +0 -0
index ce65e93..a1198ac 100644

arch/arm/mach-omap2/omap-smp.c void __init smp_init_cpus(void) · line 122

Quoted 6 lines
arch/arm/mach-omap2/omap-smp.c +3 -0
@@ -117,6 +117,9 @@ void __init smp_init_cpus(void)
 		ncores = NR_CPUS;
 	}
 
+	if (ncores > nr_cpu_ids)
+		ncores = nr_cpu_ids;
+

This potentially affects all SMP platforms, so the patch needs to be bigger than this.

Also, I think the test above should be modified to use nr_cpu_ids rather than NR_CPUS, to be inline with what x86 does:

        /* nr_cpu_ids could be reduced via nr_cpus= */
        if (possible > nr_cpu_ids) {
                printk(KERN_WARNING
                        "%d Processors exceeds NR_CPUS limit of %d\n",
                        possible, nr_cpu_ids);
                possible = nr_cpu_ids;
        }
Quoted 4 lines

(This is essentially the same check that we're doing.)

Could you have a look at this and cook up another patch covering the other SMP platforms please?

Ok, I'll do that.