KVM: x86/mmu: Add auto-prefetch to the TDP MMU
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 6 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | KVM: x86/mmu: Rework gfn_to_memslot_dirty_bitmap() into auto-prefetch helperarch/ | +12 | 0 replies | |
| 2/4 | KVM: x86/mmu: Differentiate between manual and automatic prefetchingarch/ arch/ | +19 | 0 replies | |
| 3/4 | KVM: x86/mmu: Add automatic prefaulting/prefetching for TDP MMU faultsarch/ | +60 | 6 replies | |
| 4/4 | KVM: x86/mmu: Use the generic auto-prefaulting to do prefetch for direct MMUsarch/ arch/ | +9 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/4] KVM: x86/mmu: Add auto-prefetch to the TDP MMU
Add auto-prefetch to the TDP MMU, where "auto-prefetch" means the existing prefetch in the shadow MMU where KVM grabs the surrounding ~8 SPTEs on a page fault, when possible.
Rather than implement yet another custom solution, reuse the core functionality from KVM_PRE_FAULT_MEMORY. Doing so has several benefits, and a few drawbacks. The big benefits are code reuse, reduced maintainence burden improved test coverage (auto-prefetching exposed a variety of pre-existing issues in the pre-fault code), and support for any backing store (the shadow MMU's approach only works for fast-GUP, i.e. only for refcounted struct page memory).
The big drawback is that using the pre-fault code is "heavier" than the custom prefetching code in the shadow MMU. In a nutshell, this approach can't achieve the same performance uplift at least not without additional tweaking (which may or may not be acceptable; I genuinely haven't thought at all about how we could close the gap, mainly because it's not clear that we *need* to close the gap).
There are a few subjective decisions in here. The main one I want to call out is that I chose to treat async #PF prefetching as manual/explicit prefetching, versus automatic prefetching. Manual prefetching will do more invasive operations like punch through dirty logging and wait for I/O, whereas automatic prefetching avoids spurious dirty logging and tries to avoid waiting on "major" faults. This series preserves the existing behavior, but I spent enough time waffling on whether or not that was the right choice that I wanted to call it out here.
Sean Christopherson (4):
KVM: x86/mmu: Rework gfn_to_memslot_dirty_bitmap() into auto-prefetch
helper
KVM: x86/mmu: Differentiate between manual and automatic prefetching
KVM: x86/mmu: Add automatic prefaulting/prefetching for TDP MMU faults
KVM: x86/mmu: Use the generic auto-prefaulting to do prefetch for
direct MMUs
arch/x86/kvm/mmu/mmu.c | 156 +++++++++++++++++++------------- arch/x86/kvm/mmu/mmu_internal.h | 1 + arch/x86/kvm/mmu/paging_tmpl.h | 2 +- 3 files changed, 97 insertions(+), 62 deletions(-)
base-commit: 7e60162b16f9da0d2fa83da5c1723b6853a0ac1d
Signature · 1 line
2.56.0.313.g2479322e68-goog