[Skiboot] [PATCH v3 09/29] fast-reboot: add more barriers around cpu state changes

Nicholas Piggin npiggin at gmail.com
Wed Nov 29 16:36:47 AEDT 2017


This is a bit of paranoia, but when a CPU changes state to signal it
has reached a particular point, all previous stores should be visible.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/cpu.c         | 3 +++
 core/fast-reboot.c | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/cpu.c b/core/cpu.c
index d07911031..2dba2f504 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -1126,7 +1126,10 @@ void cpu_bringup(void)
 
 void cpu_callin(struct cpu_thread *cpu)
 {
+	sync();
 	cpu->state = cpu_state_active;
+	sync();
+
 	cpu->job_has_no_return = false;
 
 	init_hid();
diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 8ef506bf4..a98b579ad 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -426,6 +426,7 @@ void fast_reboot(void)
 	lock(&reset_lock);
 
 	fast_boot_release = false;
+	sync();
 
 	success = fast_reset_p8();
 
@@ -576,8 +577,8 @@ void __noreturn fast_reboot_entry(void)
 	prlog(PR_INFO, "RESET: Releasing secondaries...\n");
 
 	/* Release everybody */
-	fast_boot_release = true;
 	sync();
+	fast_boot_release = true;
 
 	/* Wait for them to respond */
 	cpu_state_wait_all_others(cpu_state_active, 0);
@@ -597,7 +598,9 @@ void __noreturn fast_reboot_entry(void)
 	cleanup_cpu_state();
 
 	/* Set our state to active */
+	sync();
 	this_cpu()->state = cpu_state_active;
+	sync();
 
 	/* Let the CPU layer do some last minute global cleanups */
 	cpu_fast_reboot_complete();
-- 
2.15.0



More information about the Skiboot mailing list