[Skiboot] [PATCH 07/13] cpu: Don't hold lock while waiting

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Feb 18 14:57:23 AEDT 2015


Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 core/cpu.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/core/cpu.c b/core/cpu.c
index cd29957..bfede54 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -638,10 +638,11 @@ static int64_t opal_reinit_cpus(uint64_t flags)
 	int64_t rc = OPAL_SUCCESS;
 	int i;
 
-	lock(&reinit_lock);
-
 	prerror("OPAL: Trying a CPU re-init with flags: 0x%llx\n", flags);
 
+ again:
+	lock(&reinit_lock);
+
 	for (cpu = first_cpu(); cpu; cpu = next_cpu(cpu)) {
 		if (cpu == this_cpu())
 			continue;
@@ -651,8 +652,11 @@ static int64_t opal_reinit_cpus(uint64_t flags)
 			 * where we are still, wait a bit and try again
 			 */
 			for (i = 0; (i < 1000) &&
-				     (cpu->state == cpu_state_os); i++)
+				     (cpu->state == cpu_state_os); i++) {
+				unlock(&reinit_lock);
 				time_wait_ms(1);
+				goto again;
+			}
 			if (cpu->state == cpu_state_os) {
 				prerror("OPAL: CPU 0x%x not in OPAL !\n", cpu->pir);
 				rc = OPAL_WRONG_STATE;
-- 
2.1.0



More information about the Skiboot mailing list