]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
KVM: MMU: Document large pages
authorAvi Kivity <avi@redhat.com>
Thu, 27 May 2010 13:44:12 +0000 (16:44 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:39:23 +0000 (10:39 +0300)
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Documentation/kvm/mmu.txt

index 1e7ecdd15bba475812eb93a39f24814e30358501..8cb42b957c73433fb88a1f858c90c5e9ccbf0c88 100644 (file)
@@ -317,6 +317,29 @@ on fault type:
 
 (user write faults generate a #PF)
 
+Large pages
+===========
+
+The mmu supports all combinations of large and small guest and host pages.
+Supported page sizes include 4k, 2M, 4M, and 1G.  4M pages are treated as
+two separate 2M pages, on both guest and host, since the mmu always uses PAE
+paging.
+
+To instantiate a large spte, four constraints must be satisfied:
+
+- the spte must point to a large host page
+- the guest pte must be a large pte of at least equivalent size (if tdp is
+  enabled, there is no guest pte and this condition is satisified)
+- if the spte will be writeable, the large page frame may not overlap any
+  write-protected pages
+- the guest page must be wholly contained by a single memory slot
+
+To check the last two conditions, the mmu maintains a ->write_count set of
+arrays for each memory slot and large page size.  Every write protected page
+causes its write_count to be incremented, thus preventing instantiation of
+a large spte.  The frames at the end of an unaligned memory slot have
+artificically inflated ->write_counts so they can never be instantiated.
+
 Further reading
 ===============