POWER9 PMU stops after idle workaround
Nicholas Piggin
reviewerPATCH 1/1 POWER9 PMU stops after idle workaround
POWER9 DD2 PMU can stop after a state-loss idle in some conditions.
A solution is to set then clear MMCRA[60] after wake from state-loss idle.
--- arch/powerpc/kernel/idle_book3s.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/kernel/idle_book3s.S +7 -1
@@ -460,11 +460,17 @@ pnv_restore_hyp_resource_arch300: /* * Workaround for POWER9, if we lost resources, the ERAT * might have been mixed up and needs flushing. We also need - * to reload MMCR0 (see comment above). + * to reload MMCR0 (see comment above). We also need to set + * then clear bit 60 in MMCRA to ensure the PMU starts running. */ blt cr3,1f PPC_INVALIDATE_ERAT ld r1,PACAR1(r13) + mfspr r4,SPRN_MMCRA + ori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4 + xori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4 ld r4,_MMCR0(r1) mtspr SPRN_MMCR0,r4 1:
Signature · 1 line
2.11.0
Quoted 4 lines · Nicholas Piggin
POWER9 DD2 PMU can stop after a state-loss idle in some conditions.
A solution is to set then clear MMCRA[60] after wake from state-loss idle.
Quoted 29 lines
Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/kernel/idle_book3s.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)arch/powerpc/kernel/idle_book3s.S +7
-1@@ -460,11 +460,17 @@ pnv_restore_hyp_resource_arch300: /* * Workaround for POWER9, if we lost resources, the ERAT * might have been mixed up and needs flushing. We also need - * to reload MMCR0 (see comment above). + * to reload MMCR0 (see comment above). We also need to set + * then clear bit 60 in MMCRA to ensure the PMU starts running. */ blt cr3,1f PPC_INVALIDATE_ERAT ld r1,PACAR1(r13) + mfspr r4,SPRN_MMCRA + ori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4 + xori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4 ld r4,_MMCR0(r1) mtspr SPRN_MMCR0,r4 1:
Quoted 6 lines · Nicholas Piggin
POWER9 DD2 PMU can stop after a state-loss idle in some conditions.
A solution is to set then clear MMCRA[60] after wake from state-loss idle.
Signed-off-by Nicholas Piggin <[email protected]>
Quoted 14 lines
--- arch/powerpc/kernel/idle_book3s.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)arch/powerpc/kernel/idle_book3s.S +1
-1@@ -460,11 +460,17 @@ pnv_restore_hyp_resource_arch300: /* * Workaround for POWER9, if we lost resources, the ERAT * might have been mixed up and needs flushing. We also need - * to reload MMCR0 (see comment above). + * to reload MMCR0 (see comment above). We also need to set
arch/powerpc/kernel/idle_book3s.S pnv_restore_hyp_resource_arch300: · line 473
Quoted 10 lines
arch/powerpc/kernel/idle_book3s.S +6
-0+ * then clear bit 60 in MMCRA to ensure the PMU starts running. */ blt cr3,1f PPC_INVALIDATE_ERAT ld r1,PACAR1(r13) + mfspr r4,SPRN_MMCRA + ori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4 + xori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4
Timing is ok to resolve the issue? Does back-to-back bit flip of MMCRA[60] gets the job done for all cases? Just asking since this issue in itself is a corner case ;)
--Vaidy
Hi Nick,
Quoted 4 lines
POWER9 DD2 PMU can stop after a state-loss idle in some conditions.
A solution is to set then clear MMCRA[60] after wake from state-loss idle.
Looks good.
Anton
Quoted 28 lines
Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/kernel/idle_book3s.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/arch/powerpc/kernel/idle_book3s.Sindex516ebef905c0..e6252c5a57a4100644 ---a/arch/powerpc/kernel/idle_book3s.S
+++b/arch/powerpc/kernel/idle_book3s.Sarch/powerpc/kernel/idle_book3s.S +2
-1@@ -460,11 +460,17 @@ pnv_restore_hyp_resource_arch300: /* * Workaround for POWER9, if we lost resources, the ERAT * might have been mixed up and needs flushing. We also need - * to reload MMCR0 (see comment above). + * to reload MMCR0 (see comment above). We also need to set + * then clear bit 60 in MMCRA to ensure the PMU startsrunning. */
arch/powerpc/kernel/idle_book3s.S +5
-0blt cr3,1f PPC_INVALIDATE_ERAT ld r1,PACAR1(r13) + mfspr r4,SPRN_MMCRA + ori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4 + xori r4,r4,(1 << (63-60)) + mtspr SPRN_MMCRA,r4 ld r4,_MMCR0(r1) mtspr SPRN_MMCR0,r4 1:
Michael Ellerman
AppliedQuoted 9 lines · Nicholas Piggin
POWER9 DD2 PMU can stop after a state-loss idle in some conditions.
A solution is to set then clear MMCRA[60] after wake from state-loss idle.
Signed-off-by Nicholas Piggin <[email protected]>Reviewed-by Vaidyanathan Srinivasan <[email protected]>Acked-by Anton Blanchard <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/bdd21ddb919d28f9c62cdc6286cac9
cheers
Quoted 11 lines · On Thu, 3 Aug 2017 20:19:38 +1000 (AEST) Michael Ellerman…
Quoted 9 lines · Nicholas Piggin
POWER9 DD2 PMU can stop after a state-loss idle in some conditions.
A solution is to set then clear MMCRA[60] after wake from state-loss idle.
Signed-off-by Nicholas Piggin <[email protected]>Reviewed-by Vaidyanathan Srinivasan <[email protected]>Acked-by Anton Blanchard <[email protected]>
Quoted 5 lines
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/bdd21ddb919d28f9c62cdc6286cac9
cheers
Not there anymore. I see this only in the merge branch.
Thanks
Michal
Yeah I messed up the subject when comitting, from memory, so I had to rebase and force push.
I think this is it:
cheers
Quoted 26 lines · Michal Suchánek
Quoted 4 lines · On Thu, 3 Aug 2017 20:19:38 +1000 (AEST) Michael Ellerman…
Quoted 3 lines · Nicholas Piggin
POWER9 DD2 PMU can stop after a state-loss idle in some conditions.
A solution is to set then clear MMCRA[60] after wake from
state-loss
Quoted 7 lines
Quoted 6 lines
idle.
Signed-off-by Nicholas Piggin <[email protected]>Reviewed-by Vaidyanathan Srinivasan <[email protected]>Acked-by Anton Blanchard <[email protected]>Quoted 5 lines
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/bdd21ddb919d28f9c62cdc6286cac9
cheers
Not there anymore. I see this only in the merge branch.
Thanks
Michal
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.