KVM: MMU: Cache shadow page tables
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest33 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/33 | KVM: MMU: Implement simple reverse mappingdrivers/ drivers/ drivers/ +1 more | +142 | 0 replies | |
| 2/33 | KVM: MMU: Teach the page table walker to track guest page table gfnsdrivers/ | +5 | 0 replies | |
| 3/33 | KVM: MMU: Load the pae pdptrs on cr3 change like the processor doesdrivers/ drivers/ | +20 | 0 replies | |
| 4/33 | KVM: MMU: Fold fetch_guest() into init_walker()drivers/ | +47 | 0 replies | |
| 5/33 | KVM: MU: Special treatment for shadow pae root pagesdrivers/ drivers/ | +82 | 0 replies | |
| 6/33 | KVM: MMU: Use the guest pdptrs instead of mapping cr3 in pae modedrivers/ drivers/ | +20 | 0 replies | |
| 7/33 | KVM: MMU: Make the shadow page tables also special-case paedrivers/ | +7 | 0 replies | |
| 8/33 | KVM: MMU: Make kvm_mmu_alloc_page() return a kvm_mmu_page pointerdrivers/ drivers/ | +15 | 0 replies | |
| 9/33 | KVM: MMU: Shadow page table cachingdrivers/ drivers/ drivers/ | +280 | 0 replies | |
| 10/33 | KVM: MMU: Write protect guest pages when a shadow is created for themdrivers/ drivers/ | +55 | 0 replies | |
| 11/33 | KVM: MMU: Let the walker extract the target page gfn from the ptedrivers/ drivers/ | +31 | 0 replies | |
| 12/33 | KVM: MMU: Support emulated writes into RAMdrivers/ drivers/ drivers/ | +36 | 0 replies | |
| 13/33 | KVM: MMU: Zap shadow page table entries on writes to guest page tablesdrivers/ | +36 | 0 replies | |
| 14/33 | KVM: MMU: If emulating an instruction fails, try unprotecting the pagedrivers/ drivers/ drivers/ | +61 | 0 replies | |
| 15/33 | KVM: MMU: Implement child shadow unlinkingdrivers/ | +38 | 0 replies | |
| 16/33 | KVM: MMU: kvm_mmu_put_page() only removes one link to the pagedrivers/ | +4 | 0 replies | |
| 17/33 | KVM: MMU: oom handlingdrivers/ drivers/ drivers/ +2 more | +37 | 0 replies | |
| 18/33 | KVM: MMU: Remove invlpg interceptiondrivers/ drivers/ drivers/ +2 more | +0 | 0 replies | |
| 19/33 | KVM: MMU: Remove release_pt_page_64()drivers/ | +0 | 0 replies | |
| 20/33 | KVM: MMU: Handle misaligned accesses to write protected guest page tablesdrivers/ | +17 | 0 replies | |
| 21/33 | KVM: MMU: <ove is_empty_shadow_page() above kvm_mmu_free_page()drivers/ | +10 | 0 replies | |
| 22/33 | KVM: MMU: Ensure freed shadow pages are cleandrivers/ | +1 | 0 replies | |
| 23/33 | KVM: MMU: If an empty shadow page is not empty, report more infodrivers/ | +8 | 0 replies | |
| 24/33 | KVM: MMU: Page table write flood protectiondrivers/ drivers/ | +18 | 0 replies | |
| 25/33 | KVM: MMU: Never free a shadow page actively serving as a rootdrivers/ drivers/ | +19 | 0 replies | |
| 26/33 | KVM: MMU: Fix cmpxchg8b emulationdrivers/ drivers/ | +28 | 0 replies | |
| 27/33 | KVM: MMU: Treat user-mode faults as a hint that a page is no longer a page tabledrivers/ | +12 | 0 replies | |
| 28/33 | KVM: MMU: Free pages on kvm destructiondrivers/ | +7 | 0 replies | |
| 29/33 | KVM: MMU: Replace atomic allocations by preallocated objectsdrivers/ drivers/ drivers/ +1 more | +153 | 0 replies | |
| 30/33 | KVM: MMU: Detect oom conditions and propagate error to userspacedrivers/ drivers/ drivers/ +1 more | +50 | 0 replies | |
| 31/33 | KVM: MMU: Flush guest tlb when reducing permissions on a ptedrivers/ | +6 | 0 replies | |
| 32/33 | KVM: MMU: Destroy mmu while we still have a vcpu leftdrivers/ | +1 | 0 replies | |
| 33/33 | KVM: MMU: add audit code to check mappings, etc are correctdrivers/ drivers/ | +189 | 0 replies |
Reviews trailers per patch
None of the 33 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Ingo Molnar |
|---|---|
| Series | A-b |
| 1/33 | |
| 2/33 | |
| 3/33 | |
| 4/33 | |
| 5/33 | |
| 6/33 | |
| 7/33 | |
| 8/33 | |
| 9/33 | |
| 10/33 | |
| 11/33 | |
| 12/33 | |
| 13/33 | |
| 14/33 | |
| 15/33 | |
| 16/33 | |
| 17/33 | |
| 18/33 | |
| 19/33 | |
| 20/33 | |
| 21/33 | |
| 22/33 | |
| 23/33 | |
| 24/33 | |
| 25/33 | |
| 26/33 | |
| 27/33 | |
| 28/33 | |
| 29/33 | |
| 30/33 | |
| 31/33 | |
| 32/33 | |
| 33/33 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/33] KVM: MMU: Cache shadow page tables
The current kvm shadow page table implementation does not cache shadow page tables (except for global translations, used for kernel addresses) across context switches. This means that after a context switch, every memory access will trap into the host. After a while, the shadow page tables will be rebuild, and the guest can proceed at native speed until the next context switch.
The natural solution, then, is to cache shadow page tables across context switches. Unfortunately, this introduces a bucketload of problems:
- the guest does not notify the processor (and hence kvm) that it modifies a page table entry if it has reason to believe that the modification will be followed by a tlb flush. It becomes necessary to write-protect guest page tables so that we can use the page fault when the access occurs as a notification.
- write protecting the guest page tables means we need to keep track of which ptes map those guest page table. We need to add reverse mapping for all mapped writable guest pages.
- when the guest does access the write-protected page, we need to allow it to perform the write in some way. We do that either by emulating the write, or removing all shadow page tables for that page and allowing the write to proceed, depending on circumstances.
This patchset implements the ideas above. While a lot of tuning remains to be done (for example, a sane page replacement algorithm), a guest running with this patchset applied is much faster and more responsive than with 2.6.20-rc3. Some preliminary benchmarks are available in
http://article.gmane.org/gmane.comp.emulators.kvm.devel/661.
The patchset is bisectable compile-wise.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV