Skip to contentSkip to conversation

assorted radix fixes and improvemets for page fault and invalidation

PATCH Applied Nicholas Piggin 2 participants 3 messages May 9, 2018 – May 25, 2018 PowerPC

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

v2 cover assorted radix fixes and improvemets for page fault and invalidation

Here's various patches for radix, a few small bugfixes, tracepoint enablement or partition scope tlbie, and some page fault optimisation.

This was tested with the patch to qemu that enables THP for partition scope page tables and things seem to work as expected.

Changes since v1:
- Feedback from Paul
- Improved changelog in the page table umap patch (patch 4).
- Changed and commented patch 4 to not expect ptes to be unmapped in the page fault path, because they should already be invalidated. Only unmap and free page tables. This has checks and warnings and some recovery code in case ptes are encountered. This is expensive compared to the page table unmap, but in my measurements this path is pretty rare so I leave it in unconditionally for now to help flush out bugs. We can rip it out or put it under a CONFIG easily it's just a few lines.

- Fixed PWC flushing with recursive page table freeing (previous code would free child page tables before the parent was cleared ad PWC flushed, so the MMU may still have been able to reference them).

- That fix to patch 4 required patch 5 as well, so those are squashed together. The nature of the code made it pointless to put patch 5 first.

- Survived some basic stress testing overnight.

Thanks,
Nick

Nicholas Piggin (9):
KVM: PPC: Book3S HV: radix use correct tlbie sequence in
kvmppc_radix_tlbie_page
KVM: PPC: Book3S HV: radix clear pte when unmapping
KVM: PPC: Book3S HV: use a helper to unmap ptes in the radix fault
path
KVM: PPC: Book3S HV: recursively unmap all page table entries when
unmapping
powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM
KVM: PPC: Book3S HV: radix use the Linux translation flush functions
for partition scope
KVM: PPC: Book3S HV: radix handle process scoped LPID flush in C, with
relocation on
KVM: PPC: Book3S HV: radix refine IO region partition scope attributes
KVM: PPC: Book3S HV: radix do not clear partition pte when RC or write
bits do not match

 .../include/asm/book3s/64/tlbflush-radix.h    |   7 +
 arch/powerpc/kvm/book3s_64_mmu_radix.c        | 349 +++++++++++-------
 arch/powerpc/kvm/book3s_hv.c                  |  26 ++
 arch/powerpc/kvm/book3s_hv_rmhandlers.S       |  13 +-
 arch/powerpc/mm/tlb-radix.c                   | 207 +++++++++++
 5 files changed, 467 insertions(+), 135 deletions(-)
Signature · 1 line
2.17.0
author reviewer
#1 lore raw

PATCH v2 5/9 powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM

Implement a local TLB flush for invalidating an LPID with variants for process or partition scope. And a global TLB flush for invalidating a partition scoped page of an LPID.

These will be used by KVM in subsequent patches.

---
 .../include/asm/book3s/64/tlbflush-radix.h    |   7 +
 arch/powerpc/mm/tlb-radix.c                   | 207 ++++++++++++++++++
 2 files changed, 214 insertions(+)
arch/powerpc/include/asm/book3s/64/tlbflush-radix.h +7 -0
index 19b45ba6caf9..ef5c3f2994c9 100644
@@ -51,4 +51,11 @@ extern void radix__flush_tlb_all(void);
 extern void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,
 					unsigned long address);
 
+extern void radix__flush_tlb_lpid_page(unsigned int lpid,
+					unsigned long addr,
+					unsigned long page_size);
+extern void radix__flush_pwc_lpid(unsigned int lpid);
+extern void radix__local_flush_tlb_lpid(unsigned int lpid);
+extern void radix__local_flush_tlb_lpid_guest(unsigned int lpid);
+
 #endif
arch/powerpc/mm/tlb-radix.c +207 -0

243 lines not on this page · raw message

Signature · 1 line
2.17.0
#2 lore raw

Re: [v2, 5/9] powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM

Quoted 7 lines · Nicholas Piggin

Implement a local TLB flush for invalidating an LPID with variants for process or partition scope. And a global TLB flush for invalidating a partition scoped page of an LPID.

These will be used by KVM in subsequent patches.

Applied to powerpc topic/ppc-kvm, thanks.

https://git.kernel.org/powerpc/c/0078778a86b14f85bf50e96d9ddeb3

cheers