Skip to contentSkip to conversation

powerpc: Linux cannot run with 0 cores

PATCH In review Anton Blanchard 2 participants 2 messages Jun 18, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Linux cannot run with 0 cores

If we configure with CONFIG_SMP=n or set NR_CPUS less than the number of SMT threads we will set the max cores property to 0 in the ibm,client-architecture-support structure. On new versions of firmware that understand this property it obliges and terminates our partition.

Use DIV_ROUND_UP so we handle not only the CONFIG_SMP=n case but also the case where NR_CPUS isn't a multiple of the number of SMT threads.

---

arch/powerpc/kernel/prom_init.c +1 -1
Index: linux-2.6/arch/powerpc/kernel/prom_init.c
===================================================================
@@ -872,7 +872,7 @@ static void __init prom_send_capabilitie
 				    "ibm_architecture_vec structure inconsistent: 0x%x !\n",
 				    *cores);
 		} else {
-			*cores = NR_CPUS / prom_count_smt_threads();
+			*cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads());
 			prom_printf("Max number of cores passed to firmware: 0x%x\n",
 				    (unsigned long)*cores);
 		}
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Anton Blanchard

If we configure with CONFIG_SMP=n or set NR_CPUS less than the number of SMT threads we will set the max cores property to 0 in the ibm,client-architecture-support structure. On new versions of firmware that understand this property it obliges and terminates our partition.

Use DIV_ROUND_UP so we handle not only the CONFIG_SMP=n case but also the case where NR_CPUS isn't a multiple of the number of SMT threads.

Thank you, Anton!!!

(Will test as soon as the system that hit this becomes available.)

Quoted 16 lines

---

Index: linux-2.6/arch/powerpc/kernel/prom_init.c
===================================================================

arch/powerpc/kernel/prom_init.c +1 -1
@@ -872,7 +872,7 @@ static void __init prom_send_capabilitie
 				    "ibm_architecture_vec structure inconsistent: 0x%x !\n",
 				    *cores);
 		} else {
-			*cores = NR_CPUS / prom_count_smt_threads();
+			*cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads());
 			prom_printf("Max number of cores passed to firmware: 0x%x\n",
 				    (unsigned long)*cores);
 		}