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

Nicholas Piggin npiggin at gmail.com
Sat Nov 25 01:08:18 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 70fb4eb9f..8f9823e28 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -424,6 +424,7 @@ void fast_reboot(void)
 	lock(&reset_lock);
 
 	fast_boot_release = false;
+	sync();
 
 	success = fast_reset_p8();
 
@@ -574,8 +575,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);
@@ -595,7 +596,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