[Skiboot] [PATCH 4/4] Run change_all_hile in parallel on all CPUs

Nicholas Piggin npiggin at gmail.com
Mon May 22 15:53:03 AEST 2017


Rather than send cpu_change_hile jobs out to CPUs one at-a-time,
queue them all asynchronously, then wait for all.
---
 core/cpu.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/core/cpu.c b/core/cpu.c
index c4a4d29e..ab9727aa 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -1038,19 +1038,31 @@ static void cpu_change_hile(void *hilep)
 static int64_t cpu_change_all_hile(bool hile)
 {
 	struct cpu_thread *cpu;
+	bool done;
 
 	prlog(PR_INFO, "CPU: Switching HILE on all CPUs to %d\n", hile);
 
 	for_each_available_cpu(cpu) {
 		if (cpu->current_hile == hile)
 			continue;
-		if (cpu == this_cpu()) {
-			cpu_change_hile(&hile);
+		if (cpu == this_cpu())
 			continue;
-		}
-		cpu_wait_job(cpu_queue_job(cpu, "cpu_change_hile",
-					   cpu_change_hile, &hile), true);
+		cpu_queue_job(cpu, "cpu_change_hile", cpu_change_hile, &hile);
 	}
+
+	if (this_cpu()->current_hile != hile)
+		cpu_change_hile(&hile);
+
+	smt_lowest();
+	do {
+		done = true;
+		for_each_available_cpu(cpu) {
+			if (cpu->current_hile != hile)
+				done = false;
+		}
+	} while (!done);
+	smt_medium();
+
 	return OPAL_SUCCESS;
 }
 
-- 
2.11.0



More information about the Skiboot mailing list