aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/virtual
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2013-06-19 05:09:25 -0400
committerGleb Natapov <gleb@redhat.com>2013-06-27 07:20:48 -0400
commit5a9b3830d462971bf05329148873f8996d1c88fc (patch)
tree3a754cebaa688ebf72fe4a0d0aa014afdd546e91 /Documentation/virtual
parentf6f8adeef542a18b1cb26a0b772c9781a10bb477 (diff)
KVM: MMU: document fast invalidate all mmio sptes
Document it to Documentation/virtual/kvm/mmu.txt Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'Documentation/virtual')
-rw-r--r--Documentation/virtual/kvm/mmu.txt26
1 files changed, 26 insertions, 0 deletions
diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt
index 89c8a4caf51e..290894176142 100644
--- a/Documentation/virtual/kvm/mmu.txt
+++ b/Documentation/virtual/kvm/mmu.txt
@@ -279,6 +279,8 @@ Handling a page fault is performed as follows:
279 - if the RSV bit of the error code is set, the page fault is caused by guest 279 - if the RSV bit of the error code is set, the page fault is caused by guest
280 accessing MMIO and cached MMIO information is available. 280 accessing MMIO and cached MMIO information is available.
281 - walk shadow page table 281 - walk shadow page table
282 - check for valid generation number in the spte (see "Fast invalidation of
283 MMIO sptes" below)
282 - cache the information to vcpu->arch.mmio_gva, vcpu->arch.access and 284 - cache the information to vcpu->arch.mmio_gva, vcpu->arch.access and
283 vcpu->arch.mmio_gfn, and call the emulator 285 vcpu->arch.mmio_gfn, and call the emulator
284 - If both P bit and R/W bit of error code are set, this could possibly 286 - If both P bit and R/W bit of error code are set, this could possibly
@@ -400,6 +402,30 @@ KVM then walks through all pages and zaps obsolete pages. While the zap
400operation needs to take the MMU lock, the lock can be released periodically 402operation needs to take the MMU lock, the lock can be released periodically
401so that the VCPUs can make progress. 403so that the VCPUs can make progress.
402 404
405Fast invalidation of MMIO sptes
406===============================
407
408As mentioned in "Reaction to events" above, kvm will cache MMIO
409information in leaf sptes. When a new memslot is added or an existing
410memslot is changed, this information may become stale and needs to be
411invalidated. This also needs to hold the MMU lock while walking all
412shadow pages, and is made more scalable with a similar technique.
413
414MMIO sptes have a few spare bits, which are used to store a
415generation number. The global generation number is stored in
416kvm_memslots(kvm)->generation, and increased whenever guest memory info
417changes. This generation number is distinct from the one described in
418the previous section.
419
420When KVM finds an MMIO spte, it checks the generation number of the spte.
421If the generation number of the spte does not equal the global generation
422number, it will ignore the cached MMIO information and handle the page
423fault through the slow path.
424
425Since only 19 bits are used to store generation-number on mmio spte, all
426pages are zapped when there is an overflow.
427
428
403Further reading 429Further reading
404=============== 430===============
405 431