aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2015-03-30 01:11:04 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-04-16 21:23:40 -0400
commit7d6e7f7ffaba4e013c7a0589140431799bc17985 (patch)
treee562ffe3cd9799537221f9277e36787412ef2f40 /arch
parent691e95fd7396905a38d98919e9c150dbc3ea21a3 (diff)
powerpc/mm/thp: Return pte address if we find trans_splitting.
For THP that is marked trans splitting, we return the pte. This require the callers to handle the pmd_trans_splitting scenario, if they care. All the current callers are either looking at pfn or write_ok, hence we don't need to update them. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h12
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c9
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c2
-rw-r--r--arch/powerpc/mm/hugetlbpage.c9
4 files changed, 10 insertions, 22 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index 23b724c746e9..ce5610aa124c 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -281,11 +281,9 @@ static inline int hpte_cache_flags_ok(unsigned long ptel, unsigned long io_type)
281 281
282/* 282/*
283 * If it's present and writable, atomically set dirty and referenced bits and 283 * If it's present and writable, atomically set dirty and referenced bits and
284 * return the PTE, otherwise return 0. If we find a transparent hugepage 284 * return the PTE, otherwise return 0.
285 * and if it is marked splitting we return 0;
286 */ 285 */
287static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing, 286static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing)
288 unsigned int hugepage)
289{ 287{
290 pte_t old_pte, new_pte = __pte(0); 288 pte_t old_pte, new_pte = __pte(0);
291 289
@@ -301,12 +299,6 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing,
301 cpu_relax(); 299 cpu_relax();
302 continue; 300 continue;
303 } 301 }
304#ifdef CONFIG_TRANSPARENT_HUGEPAGE
305 /* If hugepage and is trans splitting return None */
306 if (unlikely(hugepage &&
307 pmd_trans_splitting(pte_pmd(old_pte))))
308 return __pte(0);
309#endif
310 /* If pte is not present return None */ 302 /* If pte is not present return None */
311 if (unlikely(!(pte_val(old_pte) & _PAGE_PRESENT))) 303 if (unlikely(!(pte_val(old_pte) & _PAGE_PRESENT)))
312 return __pte(0); 304 return __pte(0);
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 26df3864d85a..0fe9c92e78ed 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -537,20 +537,17 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
537 } 537 }
538 /* if the guest wants write access, see if that is OK */ 538 /* if the guest wants write access, see if that is OK */
539 if (!writing && hpte_is_writable(r)) { 539 if (!writing && hpte_is_writable(r)) {
540 unsigned int hugepage_shift;
541 pte_t *ptep, pte; 540 pte_t *ptep, pte;
542 unsigned long flags; 541 unsigned long flags;
543
544 /* 542 /*
545 * We need to protect against page table destruction 543 * We need to protect against page table destruction
546 * while looking up and updating the pte. 544 * hugepage split and collapse.
547 */ 545 */
548 local_irq_save(flags); 546 local_irq_save(flags);
549 ptep = find_linux_pte_or_hugepte(current->mm->pgd, 547 ptep = find_linux_pte_or_hugepte(current->mm->pgd,
550 hva, &hugepage_shift); 548 hva, NULL);
551 if (ptep) { 549 if (ptep) {
552 pte = kvmppc_read_update_linux_pte(ptep, 1, 550 pte = kvmppc_read_update_linux_pte(ptep, 1);
553 hugepage_shift);
554 if (pte_write(pte)) 551 if (pte_write(pte))
555 write_ok = 1; 552 write_ok = 1;
556 } 553 }
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index f559b25de173..d839f08cb903 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -219,7 +219,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
219 local_irq_restore(flags); 219 local_irq_restore(flags);
220 return H_PARAMETER; 220 return H_PARAMETER;
221 } 221 }
222 pte = kvmppc_read_update_linux_pte(ptep, writing, hpage_shift); 222 pte = kvmppc_read_update_linux_pte(ptep, writing);
223 if (pte_present(pte) && !pte_protnone(pte)) { 223 if (pte_present(pte) && !pte_protnone(pte)) {
224 if (writing && !pte_write(pte)) 224 if (writing && !pte_write(pte))
225 /* make the actual HPTE be read-only */ 225 /* make the actual HPTE be read-only */
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index a9dbb27ca887..0ce968b00b7c 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -1014,12 +1014,11 @@ pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
1014 * A hugepage collapse is captured by pmd_none, because 1014 * A hugepage collapse is captured by pmd_none, because
1015 * it mark the pmd none and do a hpte invalidate. 1015 * it mark the pmd none and do a hpte invalidate.
1016 * 1016 *
1017 * A hugepage split is captured by pmd_trans_splitting 1017 * We don't worry about pmd_trans_splitting here, The
1018 * because we mark the pmd trans splitting and do a 1018 * caller if it needs to handle the splitting case
1019 * hpte invalidate 1019 * should check for that.
1020 *
1021 */ 1020 */
1022 if (pmd_none(pmd) || pmd_trans_splitting(pmd)) 1021 if (pmd_none(pmd))
1023 return NULL; 1022 return NULL;
1024 1023
1025 if (pmd_huge(pmd) || pmd_large(pmd)) { 1024 if (pmd_huge(pmd) || pmd_large(pmd)) {