diff mbox series

[10/18] fast-reboot: add more barriers around cpu state changes

Message ID 20171119091508.28372-11-npiggin@gmail.com
State Superseded
Headers show
Series move direct controls out of fast-reboot, | expand

Commit Message

Nicholas Piggin Nov. 19, 2017, 9:15 a.m. UTC
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@gmail.com>
---
 core/cpu.c         | 3 +++
 core/fast-reboot.c | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/core/cpu.c b/core/cpu.c
index 27e0d6cf..d0d1c070 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -1098,7 +1098,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 e20a80bd..722ff1d8 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -437,6 +437,7 @@  void fast_reboot(void)
 	lock(&reset_lock);
 
 	fast_boot_release = false;
+	sync();
 
 	success = fast_reset_p8();
 
@@ -587,8 +588,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);
@@ -603,7 +604,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();