• Avi Kivity's avatar
    [PATCH] KVM: MMU: Shadow page table caching · cea0f0e7
    Avi Kivity authored
    Define a hashtable for caching shadow page tables. Look up the cache on
    context switch (cr3 change) or during page faults.
    
    The key to the cache is a combination of
    - the guest page table frame number
    - the number of paging levels in the guest
       * we can cache real mode, 32-bit mode, pae, and long mode page
         tables simultaneously.  this is useful for smp bootup.
    - the guest page table table
       * some kernels use a page as both a page table and a page directory.  this
         allows multiple shadow pages to exist for that page, one per level
    - the "quadrant"
       * 32-bit mode page tables span 4MB, whereas a shadow page table spans
         2MB.  similarly, a 32-bit page directory spans 4GB, while a shadow
         page directory spans 1GB.  the quadrant allows caching up to 4 shadow page
         tables for one guest page in one level.
    - a "metaphysical" bit
       * for real mode, and for pse pages, there is no guest page table, so set
         the bit to avoid write protecting the page.
    Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
    Acked-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    cea0f0e7
paging_tmpl.h 11.7 KB