diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2005-11-11 12:48:56 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-11-11 12:48:56 -0800 |
commit | 4d45cbacb8488ae3172065e4fca608079492231b (patch) | |
tree | db8c485e2837185487aecbd46d27205dbc9e7536 /arch | |
parent | 388f7ef720a982f49925e7b4e96f216f208f8c03 (diff) |
[SPARC64]: Restore 2.4.x /proc/cpuinfo behavior for "ncpus probed" field.
Noticed by Tom 'spot' Callaway.
Even on uniprocessor we always reported the number of physical
cpus in the system via /proc/cpuinfo. But when this got changed
to use num_possible_cpus() it always reads as "1" on uniprocessor.
This change was unintentional.
So scan the firmware device tree and count the number of cpu
nodes, and report that, as we always did.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc64/kernel/setup.c | 19 | ||||
-rw-r--r-- | arch/sparc64/kernel/smp.c | 1 |
2 files changed, 15 insertions, 5 deletions
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index bf1849dd9c4..48180531562 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c @@ -587,6 +587,8 @@ extern void mmu_info(struct seq_file *); unsigned int dcache_parity_tl1_occurred; unsigned int icache_parity_tl1_occurred; +static int ncpus_probed; + static int show_cpuinfo(struct seq_file *m, void *__unused) { seq_printf(m, @@ -595,8 +597,8 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) "promlib\t\t: Version 3 Revision %d\n" "prom\t\t: %d.%d.%d\n" "type\t\t: sun4u\n" - "ncpus probed\t: %ld\n" - "ncpus active\t: %ld\n" + "ncpus probed\t: %d\n" + "ncpus active\t: %d\n" "D$ parity tl1\t: %u\n" "I$ parity tl1\t: %u\n" #ifndef CONFIG_SMP @@ -610,8 +612,8 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) prom_prev >> 16, (prom_prev >> 8) & 0xff, prom_prev & 0xff, - (long)num_possible_cpus(), - (long)num_online_cpus(), + ncpus_probed, + num_online_cpus(), dcache_parity_tl1_occurred, icache_parity_tl1_occurred #ifndef CONFIG_SMP @@ -677,6 +679,15 @@ static int __init topology_init(void) int i, err; err = -ENOMEM; + + /* Count the number of physically present processors in + * the machine, even on uniprocessor, so that /proc/cpuinfo + * output is consistent with 2.4.x + */ + ncpus_probed = 0; + while (!cpu_find_by_instance(ncpus_probed, NULL, NULL)) + ncpus_probed++; + for (i = 0; i < NR_CPUS; i++) { if (cpu_possible(i)) { struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL); diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 797a65493fb..6efc03df51c 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -39,7 +39,6 @@ #include <asm/starfire.h> #include <asm/tlb.h> -extern int linux_num_cpus; extern void calibrate_delay(void); /* Please don't make this stuff initdata!!! --DaveM */ |