diff mbox series

[v2,13/22] powerpc/kvm/book3s: Use find_kvm_host_pte in page fault handler

Message ID 20200319035609.158654-14-aneesh.kumar@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Avoid IPI while updating page table entries. | expand

Commit Message

Aneesh Kumar K.V March 19, 2020, 3:56 a.m. UTC
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 6c372f5c61b6..fbabdcf24c86 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -605,19 +605,18 @@  int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
 		/* if the guest wants write access, see if that is OK */
 		if (!writing && hpte_is_writable(r)) {
 			pte_t *ptep, pte;
-			unsigned long flags;
 			/*
 			 * We need to protect against page table destruction
 			 * hugepage split and collapse.
 			 */
-			local_irq_save(flags);
-			ptep = find_current_mm_pte(mm->pgd, hva, NULL, NULL);
+			spin_lock(&kvm->mmu_lock);
+			ptep = find_kvm_host_pte(kvm, mmu_seq, hva, NULL);
 			if (ptep) {
 				pte = kvmppc_read_update_linux_pte(ptep, 1);
 				if (__pte_write(pte))
 					write_ok = 1;
 			}
-			local_irq_restore(flags);
+			spin_unlock(&kvm->mmu_lock);
 		}
 	}