Skip to content

RFC: out of sync shadow

Marcelo Tosatti kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 28 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13x86/mm: get_user_pages_fast_atomicarch/x86/mm/gup.c include/asm-x86/uaccess.h+43 -283 replies
2/13KVM: MMU: switch to get_user_pages_fastarch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h arch/x86/kvm/vmx.c +2 more+27 -435 replies
3/13KVM: MMU: gfn_to_page_atomicinclude/linux/kvm_host.h virt/kvm/kvm_main.c+25 -00 replies
4/13KVM: MMU: switch prefetch_page to gfn_to_page_atomicarch/x86/kvm/paging_tmpl.h+21 -150 replies
5/13KVM: MMU: do not write-protect large mappingsarch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h+11 -52 replies
6/13KVM: MMU: global page keepingarch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h include/asm-x86/kvm_host.h+28 -51 reply
7/13KVM: MMU: mode specific sync_pagearch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h include/asm-x86/kvm_host.h+132 -03 replies
8/13KVM: MMU: record guest root level on struct guest_walkerarch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h+9 -50 replies
9/13KVM: MMU: out of sync shadow corearch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h arch/x86/kvm/x86.c +1 more+263 -265 replies
10/13KVM: MMU: sync roots on mmu reloadarch/x86/kvm/mmu.c arch/x86/kvm/x86.c include/asm-x86/kvm_host.h+50 -00 replies
11/13KVM: MMU: sync global pages on cr0/cr4 writesarch/x86/kvm/mmu.c arch/x86/kvm/x86.c include/asm-x86/kvm_host.h+17 -00 replies
12/13KVM: x86: trap invlpgarch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h arch/x86/kvm/svm.c +2 more+68 -11 reply
13/13KVM: MMU: ignore multiroot when unsyncing global pagesarch/x86/kvm/mmu.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [patch 00/13] RFC: out of sync shadow

Keep shadow pages temporarily out of sync, allowing more efficient guest PTE updates in comparison to trap-emulate + unprotect heuristics. Stolen from Xen :)

This version only allows leaf pagetables to go out of sync, for simplicity, but can be enhanced.

VMX "bypass_guest_pf" feature on prefetch_page breaks it (since new PTE writes need no TLB flush, I assume). Not sure if its worthwhile to convert notrap_nonpresent -> trap_nonpresent on unshadow or just go for unconditional nonpaging_prefetch_page.

* Kernel builds on 4-way 64-bit guest improve 10% (+ 3.7% for get_user_pages_fast).

* lmbench's "lat_proc fork" microbenchmark latency is 40% lower (a shadow worst scenario test).

* The RHEL3 highpte kscand hangs go from 5+ seconds to < 1 second.

* Windows 2003 Server, 32-bit PAE, DDK build (build -cPzM 3):

Windows 2003 Checked 64 Bit Build Environment, 256M RAM 1-vcpu:
vanilla + gup_fast: oos
0:04:37.375 0:03:28.047 (- 25%)

2-vcpus:
vanilla + gup_fast oos
0:02:32.000 0:01:56.031 (- 23%)

Windows 2003 Checked Build Environment, 1GB RAM
2-vcpus:
vanilla + fast_gup oos
0:02:26.078 0:01:50.110 (- 24%)

4-vcpus:
vanilla + fast_gup oos
0:01:59.266 0:01:29.625 (- 25%)

And I think other optimizations are possible now, for example the guest can be responsible for remote TLB flushing on kvm_mmu_pte_write().

Please review.