Home Home > GIT Browse
diff options
authorMichal Suchanek <msuchanek@suse.de>2018-10-31 12:36:54 +0100
committerMichal Suchanek <msuchanek@suse.de>2018-10-31 23:28:38 +0100
commit38d872bec664559bc4c3af310f6255166c3a98d6 (patch)
parente55ab8d0e85c64e238403af95974f7cea2b15d39 (diff)
KVM: PPC: Book 3S HV: Do ptesync in radix guest exit path
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.arch/KVM-PPC-Book-3S-HV-Do-ptesync-in-radix-guest-exit-pa.patch b/patches.arch/KVM-PPC-Book-3S-HV-Do-ptesync-in-radix-guest-exit-pa.patch
new file mode 100644
index 0000000000..96bd8c0f47
--- /dev/null
+++ b/patches.arch/KVM-PPC-Book-3S-HV-Do-ptesync-in-radix-guest-exit-pa.patch
@@ -0,0 +1,55 @@
+From df158189dbcc2e0ee29dc4b917d45ee5bf25a35e Mon Sep 17 00:00:00 2001
+From: Paul Mackerras <paulus@ozlabs.org>
+Date: Thu, 17 May 2018 14:47:59 +1000
+Subject: [PATCH] KVM: PPC: Book 3S HV: Do ptesync in radix guest exit path
+References: bsc#1061840
+Patch-mainline: v4.17-rc7
+Git-commit: df158189dbcc2e0ee29dc4b917d45ee5bf25a35e
+A radix guest can execute tlbie instructions to invalidate TLB entries.
+After a tlbie or a group of tlbies, it must then do the architected
+sequence eieio; tlbsync; ptesync to ensure that the TLB invalidation
+has been processed by all CPUs in the system before it can rely on
+no CPU using any translation that it just invalidated.
+In fact it is the ptesync which does the actual synchronization in
+this sequence, and hardware has a requirement that the ptesync must
+be executed on the same CPU thread as the tlbies which it is expected
+to order. Thus, if a vCPU gets moved from one physical CPU to
+another after it has done some tlbies but before it can get to do the
+ptesync, the ptesync will not have the desired effect when it is
+executed on the second physical CPU.
+To fix this, we do a ptesync in the exit path for radix guests. If
+there are any pending tlbies, this will wait for them to complete.
+If there aren't, then ptesync will just do the same as sync.
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+ arch/powerpc/kvm/book3s_hv_rmhandlers.S | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+index 25c32e421b57..07ca1b2a7966 100644
+--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
++++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+@@ -1908,6 +1908,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
+ cmpwi cr2, r0, 0
+ beq cr2, 4f
++ /*
++ * Radix: do eieio; tlbsync; ptesync sequence in case we
++ * interrupted the guest between a tlbie and a ptesync.
++ */
++ eieio
++ tlbsync
++ ptesync
+ /* Radix: Handle the case where the guest used an illegal PID */
+ LOAD_REG_ADDR(r4, mmu_base_pid)
+ lwz r3, VCPU_GUEST_PID(r9)
diff --git a/series.conf b/series.conf
index 2deb14097d..ce9f5110e9 100644
--- a/series.conf
+++ b/series.conf
@@ -15767,6 +15767,7 @@
+ patches.arch/KVM-PPC-Book-3S-HV-Do-ptesync-in-radix-guest-exit-pa.patch