• Avi Kivity's avatar
    KVM: Update shadow pte on write to guest pte · 0028425f
    Avi Kivity authored
    A typical demand page/copy on write pattern is:
    
    - page fault on vaddr
    - kvm propagates fault to guest
    - guest handles fault, updates pte
    - kvm traps write, clears shadow pte, resumes guest
    - guest returns to userspace, re-faults on same vaddr
    - kvm installs shadow pte, resumes guest
    - guest continues
    
    So, three vmexits for a single guest page fault.  But if instead of clearing
    the page table entry, we update to correspond to the value that the guest
    has just written, we eliminate the third vmexit.
    
    This patch does exactly that, reducing kbuild time by about 10%.
    Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
    0028425f
mmu.c 36.9 KB