Skip to contentSkip to conversation

powerpc/mm: Flush radix process translations when setting MMU type

PATCH Applied Alexey Kardashevskiy 5 participants 6 messages Feb 1, 2018 – Feb 14, 2018 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/mm: Flush radix process translations when setting MMU type

Radix guests do normally invalidate process-scoped translations when a new pid is allocated but migrated guests do not invalidate these so migrated guests crash sometime, especially easy to reproduce with migration happening within first 10 seconds after the guest boot start on the same machine.

This adds the "Invalidate process-scoped translations" flush to fix radix guests migration.

---
Changes:
v2:
* removed PPC_TLBIE_5() from the !(old&PATH_HR) case as it is pointless on hash

---

Not so sure that "process-scoped translations" only require flushing at pid allocation and migration.

---
 arch/powerpc/mm/pgtable_64.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/mm/pgtable_64.c +2 -0
index c9a623c..d75dd52 100644
@@ -471,6 +471,8 @@ void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
 	if (old & PATB_HR) {
 		asm volatile(PPC_TLBIE_5(%0,%1,2,0,1) : :
 			     "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
+		asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
+			     "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
 		trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 1);
 	} else {
 		asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :
Signature · 1 line
2.11.0
Tested-by on v2 1/1
#1 lore raw
Quoted 32 lines · Alexey Kardashevskiy

Radix guests do normally invalidate process-scoped translations when a new pid is allocated but migrated guests do not invalidate these so migrated guests crash sometime, especially easy to reproduce with migration happening within first 10 seconds after the guest boot start on the same machine.

This adds the "Invalidate process-scoped translations" flush to fix radix guests migration.

---
Changes:
v2:
* removed PPC_TLBIE_5() from the !(old&PATH_HR) case as it is pointless on hash

---

Not so sure that "process-scoped translations" only require flushing at pid allocation and migration.

---
 arch/powerpc/mm/pgtable_64.c | 2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/mm/pgtable_64.c +0 -0
index c9a623c..d75dd52 100644

arch/powerpc/mm/pgtable_64.c void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0, · line 478

Quoted 8 lines
arch/powerpc/mm/pgtable_64.c +2 -0
@@ -471,6 +471,8 @@ void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
 	if (old & PATB_HR) {
 		asm volatile(PPC_TLBIE_5(%0,%1,2,0,1) : :
 			     "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
+		asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
+			     "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
 		trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 1);
 	} else {
 		asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :

This patch fixes for me a VM migration crash on POWER9.

Thanks,
Laurent

#2 lore raw
Quoted 27 lines · Laurent Vivier
Quoted 26 lines · Alexey Kardashevskiy

Radix guests do normally invalidate process-scoped translations when a new pid is allocated but migrated guests do not invalidate these so migrated guests crash sometime, especially easy to reproduce with migration happening within first 10 seconds after the guest boot start on the same machine.

This adds the "Invalidate process-scoped translations" flush to fix radix guests migration.

---
Changes:
v2:
* removed PPC_TLBIE_5() from the !(old&PATH_HR) case as it is pointless on hash

---

Not so sure that "process-scoped translations" only require flushing at pid allocation and migration.

---
  arch/powerpc/mm/pgtable_64.c | 2 ++
  1 file changed, 2 insertions(+)
Quoted 15 lines
Quoted 6 lines
arch/powerpc/mm/pgtable_64.c +0 -0
index c9a623c..d75dd52 100644

arch/powerpc/mm/pgtable_64.c void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0, · line 478

Quoted 8 lines
arch/powerpc/mm/pgtable_64.c +2 -0
@@ -471,6 +471,8 @@ void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
  	if (old & PATB_HR) {
  		asm volatile(PPC_TLBIE_5(%0,%1,2,0,1) : :
  			     "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
+		asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
+			     "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
  		trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 1);
  	} else {
  		asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :

This patch fixes for me a VM migration crash on POWER9.

Same here.

Quoted 6 lines

Thanks,
Laurent

#3 lore raw
Quoted 48 lines · Daniel Henrique Barboza
Quoted 28 lines · Laurent Vivier
Quoted 27 lines · Alexey Kardashevskiy

Radix guests do normally invalidate process-scoped translations when a new pid is allocated but migrated guests do not invalidate these so migrated guests crash sometime, especially easy to reproduce with migration happening within first 10 seconds after the guest boot start on
the same machine.

This adds the "Invalidate process-scoped translations" flush to fix radix guests migration.

---
Changes:
v2:
* removed PPC_TLBIE_5() from the !(old&PATH_HR) case as it is pointless on hash

---

Not so sure that "process-scoped translations" only require flushing at pid allocation and migration.

---
  arch/powerpc/mm/pgtable_64.c | 2 ++

  1 file changed, 2 insertions(+)
Quoted 16 lines
Quoted 7 lines
arch/powerpc/mm/pgtable_64.c +0 -0
index c9a623c..d75dd52 100644
@@ -471,6 +471,8 @@ void mmu_partition_table_set_entry(unsigned int
 lpid, unsigned long dw0,
       if (old & PATB_HR) {
Quoted 8 lines

          asm volatile(PPC_TLBIE_5(%0,%1,2,0,1) : :
                   "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid)); +        asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
+                 "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid)); trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 1); } else {
          asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :

This patch fixes for me a VM migration crash on POWER9.

Quoted 6 lines

Same here.

Quoted 2 lines

Any hope to have this patch merged soon?

It fixes a real problem and migration of VM is not reliable without it.

Thanks,
Laurent

#4 lore raw
Quoted 14 lines · Laurent Vivier
Quoted 13 lines · Daniel Henrique Barboza
Quoted 12 lines · Laurent Vivier
Quoted 11 lines · Alexey Kardashevskiy

Radix guests do normally invalidate process-scoped translations when a new pid is allocated but migrated guests do not invalidate these so migrated guests crash sometime, especially easy to reproduce with migration happening within first 10 seconds after the guest boot start on
the same machine.

This adds the "Invalidate process-scoped translations" flush to fix radix guests migration.

...

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Any hope to have this patch merged soon?

It fixes a real problem and migration of VM is not reliable without it.

Sorry it got lost in the merge window / rc1 madness. It's in my fixes branch now and heading to Linus.

cheers

#5 lore raw
In reply to Alexey Kardashevskiy
Quoted 6 lines · Alexey Kardashevskiy

Radix guests do normally invalidate process-scoped translations when a new pid is allocated but migrated guests do not invalidate these so migrated guests crash sometime, especially easy to reproduce with migration happening within first 10 seconds after the guest boot start on the same machine.

Quoted 6 lines

This adds the "Invalidate process-scoped translations" flush to fix radix guests migration.

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/62e984ddfd6b056d399e24113f5e6a

cheers