]> git.karo-electronics.de Git - linux-beck.git/commit
KVM: MMU: Reinstate pte prefetch on invlpg
authorAvi Kivity <avi@redhat.com>
Mon, 15 Mar 2010 11:59:57 +0000 (13:59 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 17 May 2010 09:15:43 +0000 (12:15 +0300)
commit08e850c6536db302050c0287649e68e3bbdfe2c7
tree9eb7e554b53ea9eb1cb408f81234f404a43a54ab
parentfbc5d139bb92e6822e4c000f97631a072d8babf9
KVM: MMU: Reinstate pte prefetch on invlpg

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: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.c
arch/x86/kvm/paging_tmpl.h