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

Message ID 20180511090659.13305-2-benh@kernel.crashing.org
State Accepted
Headers show
Series
  • [1/2] cpu: Use STOP1 on POWER9 for idle/sleep inside OPAL
Related show

Commit Message

Benjamin Herrenschmidt May 11, 2018, 9:06 a.m.
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@kernel.crashing.org>
---
 core/cpu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Patch

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)