[Skiboot] [PATCH v3 07/29] fast-reboot: make spin loops consistent and SMT friendly
Nicholas Piggin
npiggin at gmail.com
Wed Nov 29 16:36:45 AEDT 2017
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
core/fast-reboot.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 58ee78446..3686f02d7 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -520,11 +520,14 @@ void __noreturn fast_reboot_entry(void)
*/
if (this_cpu() != boot_cpu) {
this_cpu()->state = cpu_state_present;
- while (!fast_boot_release) {
+ sync();
+ if (!fast_boot_release) {
smt_lowest();
- sync();
+ while (!fast_boot_release)
+ barrier();
+ smt_medium();
}
- smt_medium();
+ sync();
cleanup_cpu_state();
__secondary_cpu_entry();
}
@@ -539,11 +542,12 @@ void __noreturn fast_reboot_entry(void)
continue;
/* XXX Add a callin timeout ? */
- while (cpu->state != cpu_state_present) {
+ if (cpu->state != cpu_state_present) {
smt_lowest();
- sync();
+ while (cpu->state != cpu_state_present)
+ barrier();
+ smt_medium();
}
- smt_medium();
}
prlog(PR_INFO, "RESET: Releasing secondaries...\n");
@@ -558,16 +562,18 @@ void __noreturn fast_reboot_entry(void)
continue;
/* XXX Add a callin timeout ? */
- while (cpu->state == cpu_state_present) {
+ if (cpu->state == cpu_state_present) {
smt_lowest();
- sync();
+ while (cpu->state == cpu_state_present)
+ barrier();
+ smt_medium();
}
- smt_medium();
}
prlog(PR_DEBUG, "RESET: Releasing special wakeups...\n");
sreset_all_finish();
+ sync();
prlog(PR_INFO, "RESET: All done, cleaning up...\n");
--
2.15.0
More information about the Skiboot
mailing list