[Skiboot] [PATCH 03/18] fast-reboot: remove last man standing logic

Nicholas Piggin npiggin at gmail.com
Sun Nov 19 20:14:53 AEDT 2017


The "last man standing" logic (i.e., bouncing a sreset back to the
initiator CPU with one of the secondaries) is not necessary. It
complicates the process and increases potential for errors. The
initiator can simply branch to 0x100 directly.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/fast-reboot.c | 33 ++++++---------------------------
 1 file changed, 6 insertions(+), 27 deletions(-)

diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 62c7216b..7147dcd9 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -37,7 +37,6 @@
 /* Flag tested by the OPAL entry code */
 uint8_t reboot_in_progress;
 static volatile bool fast_boot_release;
-static struct cpu_thread *last_man_standing;
 static struct lock reset_lock = LOCK_UNLOCKED;
 
 static int set_special_wakeup(struct cpu_thread *cpu)
@@ -302,19 +301,10 @@ static void sreset_all_others(void)
 	}
 }
 
-static void sreset_cpu(struct cpu_thread *cpu)
-{
-	set_direct_ctl(cpu, P8_DIRECT_CTL_PRENAP);
-	set_direct_ctl(cpu, P8_DIRECT_CTL_SRESET);
-}
-
 static bool fast_reset_p8(void)
 {
 	struct cpu_thread *cpu;
 
-	/* Mark ourselves as last man standing in need of a reset */
-	last_man_standing = this_cpu();
-
 	if (!sreset_all_prepare())
 		return false;
 
@@ -355,8 +345,8 @@ void disable_fast_reboot(const char *reason)
 
 void fast_reboot(void)
 {
-	bool success;
 	static int fast_reboot_count = 0;
+	bool success;
 
 	if (proc_gen != proc_gen_p8) {
 		prlog(PR_DEBUG,
@@ -401,11 +391,12 @@ void fast_reboot(void)
 	/* Unlock, at this point we go away */
 	unlock(&reset_lock);
 
+	prlog(PR_DEBUG, "RESET: Releasing special wakeups...\n");
+
+	sreset_all_finish();
+
 	if (success) {
-		if (!next_cpu(first_cpu()))
-			/* Only 1 CPU, so fake reset ourselves */
-			asm volatile("ba 0x100 " : : : );
-		/* Don't return */
+		asm volatile("ba	0x100\n\t" : : : "memory");
 		for (;;)
 			;
 	}
@@ -505,14 +496,6 @@ void __noreturn fast_reboot_entry(void)
 	prlog(PR_DEBUG, "RESET: CPU 0x%04x reset in\n", this_cpu()->pir);
 	time_wait_ms(100);
 
-	lock(&reset_lock);
-	if (last_man_standing && next_cpu(first_cpu())) {
-		prlog(PR_DEBUG, "RESET: last man standing fixup...\n");
-		sreset_cpu(last_man_standing);
-	}
-	last_man_standing = NULL;
-	unlock(&reset_lock);
-
 	/* We reset our ICP first ! Otherwise we might get stray interrupts
 	 * when unsplitting
 	 */
@@ -582,10 +565,6 @@ void __noreturn fast_reboot_entry(void)
 		smt_medium();
 	}
 
-	prlog(PR_DEBUG, "RESET: Releasing special wakeups...\n");
-
-	sreset_all_finish();
-
 	prlog(PR_INFO, "RESET: All done, cleaning up...\n");
 
 	/* Clear release flag for next time */
-- 
2.15.0



More information about the Skiboot mailing list