[Skiboot] [PATCH 2/2] cpu: Cleanup clearing of doorbells on P9

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri May 11 19:06:59 AEST 2018


We currently do a rather pointless msgclr prior to setting
in_sleep/in_idle (with no ordering guarantee which isn't great).

We also do the final msgsync/msgclr after setting in_sleep/in_idle
back to false which while probably ok, isn't that great, we should
do msgsync first thing when waking up.

Finally, do p9_dbell_receive() before skip_sleep.

So take out the first msgclr, swap the final p9_dbell_receive() and
add a sync() for good measure and match what p8 does.

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

diff --git a/core/cpu.c b/core/cpu.c
index a603e11f..2ea329ed 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -375,8 +375,6 @@ static void cpu_idle_p9(enum cpu_wake_cause wake_on)
 		return;
 	}
 
-	msgclr(); /* flush pending messages */
-
 	/* Synchronize with wakers */
 	if (wake_on == cpu_wake_on_job) {
 		/* Mark ourselves in idle so other CPUs know to send an IPI */
@@ -420,11 +418,14 @@ static void cpu_idle_p9(enum cpu_wake_cause wake_on)
 		enter_p9_pm_lite_state(psscr);
 	}
 
-skip_sleep:
+	/* Clear doorbell */
+	p9_dbell_receive();
+
+ skip_sleep:
 	/* Restore */
+	sync();
 	cpu->in_idle = false;
 	cpu->in_sleep = false;
-	p9_dbell_receive();
 }
 
 static void cpu_idle_pm(enum cpu_wake_cause wake_on)
-- 
2.17.0



More information about the Skiboot mailing list