Skip to contentSkip to conversation

smp_call_function() deadlock during boot

PATCH William Lee Irwin III 1 participant 1 message Jun 22, 2002

lore
Share & tools
lore
#0 lore raw

smp_call_function() gets called before cpu_online_map is initialized. In order to tolerate this behavior the following appears to be necessary. This method of resolving the issue has a precedent in smp_IPI_allbutself().

Cheers,
Bill

===== arch/i386/kernel/smp.c 1.17 vs edited =====

arch/i386/kernel/smp.c +4 -4
@@ -567,9 +567,9 @@
  */
 {
 	struct call_data_struct data;
-	int cpus = num_online_cpus()-1;
+	int cpus = num_online_cpus();
 
-	if (!cpus)
+	if (cpus <= 1)
 		return 0;
 
 	data.func = func;
@@ -586,11 +586,11 @@
 	send_IPI_allbutself(CALL_FUNCTION_VECTOR);
 
 	/* Wait for response */
-	while (atomic_read(&data.started) != cpus)
+	while (atomic_read(&data.started) != cpus - 1)
 		barrier();
 
 	if (wait)
-		while (atomic_read(&data.finished) != cpus)
+		while (atomic_read(&data.finished) != cpus - 1)
 			barrier();
 	spin_unlock(&call_lock);