Skip to contentSkip to conversation

kexec, ppc64: Wait for online/possible CPUs only.

PATCH In review Matt Evans 2 participants 2 messages Jun 8, 2010

Subsystems (3)
lore
Share & tools
lore

Matt Evans

author
#0 lore raw

PATCH 1/1 kexec, ppc64: Wait for online/possible CPUs only.

kexec_perpare_cpus_wait() iterates i through NR_CPUS to check paca[i].kexec_state of each to make sure they have quiesced. However now we have dynamic PACA allocation, paca[NR_CPUS] is not necessarily valid and we overrun the array; spurious "cpu is not possible, ignoring" errors result. This patch iterates for_each_online_cpu so stays within the bounds of paca[] -- and every CPU is now 'possible'.

---
 arch/powerpc/kernel/machine_kexec_64.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +1 -17
index 26f9900..ed31a29 100644
@@ -182,28 +182,12 @@ static void kexec_prepare_cpus_wait(int wait_state)
 
 	my_cpu = get_cpu();
 	/* Make sure each CPU has atleast made it to the state we need */
-	for (i=0; i < NR_CPUS; i++) {
+	for_each_online_cpu(i) {
 		if (i == my_cpu)
 			continue;
 
 		while (paca[i].kexec_state < wait_state) {
 			barrier();
-			if (!cpu_possible(i)) {
-				printk("kexec: cpu %d hw_cpu_id %d is not"
-						" possible, ignoring\n",
-						i, paca[i].hw_cpu_id);
-				break;
-			}
-			if (!cpu_online(i)) {
-				/* Fixme: this can be spinning in
-				 * pSeries_secondary_wait with a paca
-				 * waiting for it to go online.
-				 */
-				printk("kexec: cpu %d hw_cpu_id %d is not"
-						" online, ignoring\n",
-						i, paca[i].hw_cpu_id);
-				break;
-			}
 			if (i != notified) {
 				printk( "kexec: waiting for cpu %d (physical"
 						" %d) to enter %i state\n",
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 8 lines · Matt Evans

kexec_perpare_cpus_wait() iterates i through NR_CPUS to check paca[i].kexec_state of each to make sure they have quiesced. However now we have dynamic PACA allocation, paca[NR_CPUS] is not necessarily valid and we overrun the array; spurious "cpu is not possible, ignoring" errors result. This patch iterates for_each_online_cpu so stays within the bounds of paca[] -- and every CPU is now 'possible'.

Looks good ..

arch/powerpc/kernel/machine_kexec_64.c static void kexec_prepare_cpus_wait(int wait_state) · line 206

Quoted 10 lines
arch/powerpc/kernel/machine_kexec_64.c +0 -10
-			if (!cpu_online(i)) {
-				/* Fixme: this can be spinning in
-				 * pSeries_secondary_wait with a paca
-				 * waiting for it to go online.
-				 */
-				printk("kexec: cpu %d hw_cpu_id %d is not"
-						" online, ignoring\n",
-						i, paca[i].hw_cpu_id);
-				break;
-			}

I don't see how the state in the Fixme could ever happen, but maybe Milton can seeing I think he wrote it?

cheers