• Avi Kivity's avatar
    KVM: MMU: Reinstate pte prefetch on invlpg · 08e850c6
    Avi Kivity authored
    Commit fb341f57 removed the pte prefetch on guest invlpg, citing guest races.
    However, the SDM is adamant that prefetch is allowed:
    
      "The processor may create entries in paging-structure caches for
       translations required for prefetches and for accesses that are a
       result of speculative execution that would never actually occur
       in the executed code path."
    
    And, in fact, there was a race in the prefetch code: we picked up the pte
    without the mmu lock held, so an older invlpg could install the pte over
    a newer invlpg.
    
    Reinstate the prefetch logic, but this time note whether another invlpg has
    executed using a counter.  If a race occured, do not install the pte.
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
    Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
    08e850c6
mmu.c 80.7 KB