diff mbox

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

Message ID 1424231849-17973-13-git-send-email-benh@kernel.crashing.org
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt Feb. 18, 2015, 3:57 a.m. UTC
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@kernel.crashing.org>
---
 core/pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox

Patch

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 */