Skip to contentSkip to conversation

FAILED: patch "[PATCH] powerpc/powernv: Fix save/restore of SPRG3 on entry/exit from" failed to apply to 4.14-stable tree

PATCH In review [email protected] 2 participants 5 messages Jul 22, 2018 – Jul 23, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From b03897cf318dfc47de33a7ecbc7655584266f034 Mon Sep 17 00:00:00 2001

From: "Gautham R. Shenoy" <[email protected]>
Date: Wed, 18 Jul 2018 14:03:16 +0530
Subject: [PATCH] powerpc/powernv: Fix save/restore of SPRG3 on entry/exit from
stop (idle)

On 64-bit servers, SPRN_SPRG3 and its userspace read-only mirror SPRN_USPRG3 are used as userspace VDSO write and read registers respectively.

SPRN_SPRG3 is lost when we enter stop4 and above, and is currently not restored. As a result, any read from SPRN_USPRG3 returns zero on an exit from stop4 (Power9 only) and above.

Thus in this situation, on POWER9, any call from sched_getcpu() always returns zero, as on powerpc, we call __kernel_getcpu() which relies upon SPRN_USPRG3 to report the CPU and NUMA node information.

Fix this by restoring SPRN_SPRG3 on wake up from a deep stop state with the sprg_vdso value that is cached in PACA.

Fixes e1c1cfed5432 ("powerpc/powernv: Save/Restore additional SPRs for stop4 cpuidle")
Cc [email protected] # v4.14+
arch/powerpc/kernel/idle_book3s.S +2 -0
index e734f6e45abc..689306118b48 100644
@@ -144,7 +144,9 @@ power9_restore_additional_sprs:
 	mtspr	SPRN_MMCR1, r4
 
 	ld	r3, STOP_MMCR2(r13)
+	ld	r4, PACA_SPRG_VDSO(r13)
 	mtspr	SPRN_MMCR2, r3
+	mtspr	SPRN_SPRG3, r4
 	blr
 
 /*
#1 lore raw

PATCH 1/1 powerpc/powernv : Save/Restore SPRG3 on entry/exit from stop.

From: "Gautham R. Shenoy" <[email protected]>

[ Upstream commit b03897cf318dfc47de33a7ecbc7655584266f034 ]

On 64-bit servers, SPRN_SPRG3 and its userspace read-only mirror SPRN_USPRG3 are used as userspace VDSO write and read registers respectively.

SPRN_SPRG3 is lost when we enter stop4 and above, and is currently not restored. As a result, any read from SPRN_USPRG3 returns zero on an exit from stop4 and above.

Thus in this situation, on POWER9, any call from sched_getcpu() always returns zero, as on powerpc, we call __kernel_getcpu() which relies upon SPRN_USPRG3 to report the CPU and NUMA node information.

Fix this by restoring SPRN_SPRG3 on wake up from a deep stop state with the sprg_vdso value that is cached in PACA.

Fixes e1c1cfed5432 ("powerpc/powernv: Save/Restore additional SPRs

for stop4 cpuidle")

---
 arch/powerpc/kernel/idle_book3s.S | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/kernel/idle_book3s.S +2 -0
index 1125c9b..8959057 100644
@@ -140,6 +140,8 @@ power9_restore_additional_sprs:
 	ld	r4, STOP_MMCR2(r13)
 	mtspr	SPRN_MMCR1, r3
 	mtspr	SPRN_MMCR2, r4
+	ld	r4, PACA_SPRG_VDSO(r13)
+	mtspr	SPRN_SPRG3, r4
 	blr
 
 /*
Signature · 1 line
1.9.4
author maintainer
#2 lore raw

Re: [PATCH] powerpc/powernv : Save/Restore SPRG3 on entry/exit from stop.

Quoted 22 lines · Gautham R. Shenoy

From: "Gautham R. Shenoy" <[email protected]>

[ Upstream commit b03897cf318dfc47de33a7ecbc7655584266f034 ]

On 64-bit servers, SPRN_SPRG3 and its userspace read-only mirror SPRN_USPRG3 are used as userspace VDSO write and read registers respectively.

SPRN_SPRG3 is lost when we enter stop4 and above, and is currently not restored. As a result, any read from SPRN_USPRG3 returns zero on an exit from stop4 and above.

Thus in this situation, on POWER9, any call from sched_getcpu() always returns zero, as on powerpc, we call __kernel_getcpu() which relies upon SPRN_USPRG3 to report the CPU and NUMA node information.

Fix this by restoring SPRN_SPRG3 on wake up from a deep stop state with the sprg_vdso value that is cached in PACA.

Fixes e1c1cfed5432 ("powerpc/powernv: Save/Restore additional SPRs

for stop4 cpuidle")

Quoted 8 lines
---
 arch/powerpc/kernel/idle_book3s.S | 2 ++
 1 file changed, 2 insertions(+)

What stable tree(s) do you want this applied to?

thanks,

greg k-h

author maintainer
#3 lore raw

Re: [PATCH] powerpc/powernv : Save/Restore SPRG3 on entry/exit from stop.

Quoted 32 lines · Greg KH
Quoted 22 lines · Gautham R. Shenoy

From: "Gautham R. Shenoy" <[email protected]>

[ Upstream commit b03897cf318dfc47de33a7ecbc7655584266f034 ]

On 64-bit servers, SPRN_SPRG3 and its userspace read-only mirror SPRN_USPRG3 are used as userspace VDSO write and read registers respectively.

SPRN_SPRG3 is lost when we enter stop4 and above, and is currently not restored. As a result, any read from SPRN_USPRG3 returns zero on an exit from stop4 and above.

Thus in this situation, on POWER9, any call from sched_getcpu() always returns zero, as on powerpc, we call __kernel_getcpu() which relies upon SPRN_USPRG3 to report the CPU and NUMA node information.

Fix this by restoring SPRN_SPRG3 on wake up from a deep stop state with the sprg_vdso value that is cached in PACA.

Fixes e1c1cfed5432 ("powerpc/powernv: Save/Restore additional SPRs

for stop4 cpuidle")

Quoted 8 lines
---
 arch/powerpc/kernel/idle_book3s.S | 2 ++
 1 file changed, 2 insertions(+)
Quoted 1 line

What stable tree(s) do you want this applied to?

I've now guessed that it is 4.14.y. If that's not the case, please let me know.

greg k-h

#4 lore raw

Re: [PATCH] powerpc/powernv : Save/Restore SPRG3 on entry/exit from stop.

Hello Greg,

Quoted 33 lines · Greg KH
Quoted 32 lines · Greg KH
Quoted 30 lines · Gautham R. Shenoy

From: "Gautham R. Shenoy" <[email protected]>

[ Upstream commit b03897cf318dfc47de33a7ecbc7655584266f034 ]

On 64-bit servers, SPRN_SPRG3 and its userspace read-only mirror SPRN_USPRG3 are used as userspace VDSO write and read registers respectively.

SPRN_SPRG3 is lost when we enter stop4 and above, and is currently not restored. As a result, any read from SPRN_USPRG3 returns zero on an exit from stop4 and above.

Thus in this situation, on POWER9, any call from sched_getcpu() always returns zero, as on powerpc, we call __kernel_getcpu() which relies upon SPRN_USPRG3 to report the CPU and NUMA node information.

Fix this by restoring SPRN_SPRG3 on wake up from a deep stop state with the sprg_vdso value that is cached in PACA.

Fixes e1c1cfed5432 ("powerpc/powernv: Save/Restore additional SPRs

for stop4 cpuidle")

---
 arch/powerpc/kernel/idle_book3s.S | 2 ++
 1 file changed, 2 insertions(+)
Quoted 4 lines
Quoted 1 line

What stable tree(s) do you want this applied to?

I've now guessed that it is 4.14.y. If that's not the case, please let me know.

Yes, this backport is for 4.14.y. The upstream commit cleanly applies on 4.15.18 and 4.16.18.

Quoted 3 lines

greg k-h

--
Thanks and Regards
gautham.