[Skiboot] [PATCH 13/13] pci: Don't hang if we have only one CPU

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Feb 18 14:57:29 AEDT 2015


The job dispatch code would spin forever trying to find a target
CPU on a machine with only one available

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 core/pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/core/pci.c b/core/pci.c
index 11bea09..5d97d4b 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1399,6 +1399,13 @@ static void pci_do_jobs(void (*fn)(void *))
 			cpu = next_available_cpu(cpu);
 			if (!cpu)
 				cpu = first_available_cpu();
+
+			/* No CPU to run on, just run synchro */
+			if (cpu == this_cpu()) {
+				fn(phbs[i]);
+				jobs[i] = NULL;
+				goto next_phb;
+			}
 		}
 
 		jobs[i] = __cpu_queue_job(cpu, fn, phbs[i], false);
@@ -1408,6 +1415,8 @@ static void pci_do_jobs(void (*fn)(void *))
 		cpu = next_available_cpu(cpu);
 		if (!cpu)
 			cpu = first_available_cpu();
+	next_phb:
+		;
 	}
 
 	/* Wait until all tasks are done */
-- 
2.1.0



More information about the Skiboot mailing list