From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-08-27 03:03:13
First one is a real bug-fix for POWER8 and earlier CPUs, second I'm
not exactly sure how POWER9's ERAT behaves in this situation but it
seems to match what we do in other places.
Thanks,
Nick
Nicholas Piggin (2):
powerpc/64s/hash: do not use PPC_INVALIDATE_ERAT on CPUs before POWER9
powerpc/64s/radix: Explicitly flush ERAT with local LPID invalidation
arch/powerpc/kernel/mce_power.c | 7 +++++++
arch/powerpc/mm/hash_native_64.c | 4 ++--
arch/powerpc/mm/tlb-radix.c | 1 +
3 files changed, 10 insertions(+), 2 deletions(-)
--
2.18.0
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-08-27 03:03:15
PPC_INVALIDATE_ERAT is slbia IH=7 which is a new variant introduced
with POWER9, and the result is undefined on earlier CPUs.
Commits 7b9f71f974 ("powerpc/64s: POWER9 machine check handler") and
d4748276ae ("powerpc/64s: Improve local TLB flush for boot and MCE on
POWER9") caused POWER7/8 code to use this instruction. Remove it. An
ERAT flush can be made by invalidatig the SLB, but before POWER9 that
requires a flush and rebolt.
Fixes: 7b9f71f974 ("powerpc/64s: POWER9 machine check handler")
Fixes: d4748276ae ("powerpc/64s: Improve local TLB flush for boot and
MCE on POWER9")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/kernel/mce_power.c | 7 +++++++
arch/powerpc/mm/hash_native_64.c | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
@@ -89,6 +89,13 @@ static void flush_and_reload_slb(void)staticvoidflush_erat(void){+#ifdef CONFIG_PPC_BOOK3S_64+if(!early_cpu_has_feature(CPU_FTR_ARCH_300)){+flush_and_reload_slb();+return;+}+#endif+/* PPC_INVALIDATE_ERAT can only be used on ISA v3 and newer */asmvolatile(PPC_INVALIDATE_ERAT:::"memory");}
@@ -115,6 +115,8 @@ static void tlbiel_all_isa300(unsigned int num_sets, unsigned int is)tlbiel_hash_set_isa300(0,is,0,2,1);asmvolatile("ptesync":::"memory");++asmvolatile(PPC_INVALIDATE_ERAT"; isync":::"memory");}voidhash__tlbiel_all(unsignedintaction)
@@ -140,8 +142,6 @@ void hash__tlbiel_all(unsigned int action)tlbiel_all_isa206(POWER7_TLB_SETS,is);elseWARN(1,"%s called on pre-POWER7 CPU\n",__func__);--asmvolatile(PPC_INVALIDATE_ERAT"; isync":::"memory");}staticinlineunsignedlong___tlbie(unsignedlongvpn,intpsize,
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-08-27 03:03:18
Local radix TLB flush operations that operate on congruence classes
have explicit ERAT flushes for POWER9. The process scoped LPID flush
did not have a flush, so add it.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/mm/tlb-radix.c | 1 +
1 file changed, 1 insertion(+)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2018-08-27 08:16:17
On Mon, 2018-08-27 at 13:03 +1000, Nicholas Piggin wrote:
Local radix TLB flush operations that operate on congruence classes
have explicit ERAT flushes for POWER9. The process scoped LPID flush
did not have a flush, so add it.
Paul, is that an actual bug ? I think the ERAT is flushed on LPID
changes...
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-08-27 09:11:24
On Mon, 27 Aug 2018 18:16:05 +1000
Benjamin Herrenschmidt [off-list ref] wrote:
On Mon, 2018-08-27 at 13:03 +1000, Nicholas Piggin wrote:
quoted
Local radix TLB flush operations that operate on congruence classes
have explicit ERAT flushes for POWER9. The process scoped LPID flush
did not have a flush, so add it. =20
=20
Paul, is that an actual bug ? I think the ERAT is flushed on LPID
changes...
We also have a PPC_INVALIDATE_ERAT in tlbiel_lpid. I'd like to add some
comments for these things because I'm not entirely clear on them myself.
The P9 UM says, "Additionally, mtpidr and mtlpidr instructions perform
an implicit slbia with IH =3D x=E2=80=983=E2=80=99."
Although slbia IH=3D3 does not appear to invalidate LPID!=3D0 && PID=3D=3D0
entries (guest OS mappigs).
The UM also says that tlbiels will clear the involved ERATs, but this
might not match hardware?
Thanks,
Nick
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-08-27 09:17:59
On Mon, 27 Aug 2018 18:16:05 +1000
Benjamin Herrenschmidt [off-list ref] wrote:
On Mon, 2018-08-27 at 13:03 +1000, Nicholas Piggin wrote:
quoted
Local radix TLB flush operations that operate on congruence classes
have explicit ERAT flushes for POWER9. The process scoped LPID flush
did not have a flush, so add it.
Paul, is that an actual bug ? I think the ERAT is flushed on LPID
changes...
FWIW I'd like to add the following patch after these fixes. While I
have your attention...
[PATCH] powerpc/64s/radix: keep kernel ERAT over local process/guest
invalidates
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
arch/powerpc/include/asm/ppc-opcode.h | 10 +++++++++-
arch/powerpc/mm/tlb-radix.c | 6 +++---
2 files changed, 12 insertions(+), 4 deletions(-)
From: Michael Ellerman <hidden> Date: 2018-10-15 04:08:45
On Mon, 2018-08-27 at 03:03:01 UTC, Nicholas Piggin wrote:
PPC_INVALIDATE_ERAT is slbia IH=7 which is a new variant introduced
with POWER9, and the result is undefined on earlier CPUs.
Commits 7b9f71f974 ("powerpc/64s: POWER9 machine check handler") and
d4748276ae ("powerpc/64s: Improve local TLB flush for boot and MCE on
POWER9") caused POWER7/8 code to use this instruction. Remove it. An
ERAT flush can be made by invalidatig the SLB, but before POWER9 that
requires a flush and rebolt.
Fixes: 7b9f71f974 ("powerpc/64s: POWER9 machine check handler")
Fixes: d4748276ae ("powerpc/64s: Improve local TLB flush for boot and
MCE on POWER9")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>