aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@ozlabs.org>2018-03-21 18:48:54 -0400
committerPaul Mackerras <paulus@ozlabs.org>2018-03-22 22:42:51 -0400
commitcda4a14733138b8f15b0b69d97ec198dc41eccae (patch)
tree14034ebfb2e11d6482f1c79c4c40e9d2bac6aebc
parenta8b48a4dccea77e29462e59f1dbf0d5aa1ff167c (diff)
KVM: PPC: Book3S HV: Fix duplication of host SLB entries
Since commit 6964e6a4e489 ("KVM: PPC: Book3S HV: Do SLB load/unload with guest LPCR value loaded", 2018-01-11), we have been seeing occasional machine check interrupts on POWER8 systems when running KVM guests, due to SLB multihit errors. This turns out to be due to the guest exit code reloading the host SLB entries from the SLB shadow buffer when the SLB was not previously cleared in the guest entry path. This can happen because the path which skips from the guest entry code to the guest exit code without entering the guest now does the skip before the SLB is cleared and loaded with guest values, but the host values are loaded after the point in the guest exit path that we skip to. To fix this, we move the code that reloads the host SLB values up so that it occurs just before the point in the guest exit code (the label guest_bypass:) where we skip to from the guest entry path. Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru> Fixes: 6964e6a4e489 ("KVM: PPC: Book3S HV: Do SLB load/unload with guest LPCR value loaded") Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S35
1 files changed, 18 insertions, 17 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index d33264697a31..f86a20270e50 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1557,6 +1557,24 @@ mc_cont:
1557 ptesync 1557 ptesync
15583: stw r5,VCPU_SLB_MAX(r9) 15583: stw r5,VCPU_SLB_MAX(r9)
1559 1559
1560 /* load host SLB entries */
1561BEGIN_MMU_FTR_SECTION
1562 b 0f
1563END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX)
1564 ld r8,PACA_SLBSHADOWPTR(r13)
1565
1566 .rept SLB_NUM_BOLTED
1567 li r3, SLBSHADOW_SAVEAREA
1568 LDX_BE r5, r8, r3
1569 addi r3, r3, 8
1570 LDX_BE r6, r8, r3
1571 andis. r7,r5,SLB_ESID_V@h
1572 beq 1f
1573 slbmte r6,r5
15741: addi r8,r8,16
1575 .endr
15760:
1577
1560guest_bypass: 1578guest_bypass:
1561 stw r12, STACK_SLOT_TRAP(r1) 1579 stw r12, STACK_SLOT_TRAP(r1)
1562 mr r3, r12 1580 mr r3, r12
@@ -2018,23 +2036,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
2018 mtspr SPRN_LPCR,r8 2036 mtspr SPRN_LPCR,r8
2019 isync 2037 isync
202048: 203848:
2021 /* load host SLB entries */
2022BEGIN_MMU_FTR_SECTION
2023 b 0f
2024END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX)
2025 ld r8,PACA_SLBSHADOWPTR(r13)
2026
2027 .rept SLB_NUM_BOLTED
2028 li r3, SLBSHADOW_SAVEAREA
2029 LDX_BE r5, r8, r3
2030 addi r3, r3, 8
2031 LDX_BE r6, r8, r3
2032 andis. r7,r5,SLB_ESID_V@h
2033 beq 1f
2034 slbmte r6,r5
20351: addi r8,r8,16
2036 .endr
20370:
2038#ifdef CONFIG_KVM_BOOK3S_HV_EXIT_TIMING 2039#ifdef CONFIG_KVM_BOOK3S_HV_EXIT_TIMING
2039 /* Finish timing, if we have a vcpu */ 2040 /* Finish timing, if we have a vcpu */
2040 ld r4, HSTATE_KVM_VCPU(r13) 2041 ld r4, HSTATE_KVM_VCPU(r13)