diff options
author | Avi Kivity <avi@qumranet.com> | 2007-03-23 03:55:25 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:27 -0400 |
commit | d28c6cfbbc5e2d4fccfe6d733995ed5971ca87f6 (patch) | |
tree | 0da31407f97a92c81d189b18608e54ad2064ebad /drivers/kvm/kvm.h | |
parent | 916ce2360fadc71d924e02403b31280112a31280 (diff) |
KVM: MMU: Fix hugepage pdes mapping same physical address with different access
The kvm mmu keeps a shadow page for hugepage pdes; if several such pdes map
the same physical address, they share the same shadow page. This is a fairly
common case (kernel mappings on i386 nonpae Linux, for example).
However, if the two pdes map the same memory but with different permissions, kvm
will happily use the cached shadow page. If the access through the more
permissive pde will occur after the access to the strict pde, an endless pagefault
loop will be generated and the guest will make no progress.
Fix by making the access permissions part of the cache lookup key.
The fix allows Xen pae to boot on kvm and run guest domains.
Thanks to Jeremy Fitzhardinge for reporting the bug and testing the fix.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm.h')
-rw-r--r-- | drivers/kvm/kvm.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 7361c45d70c9..f5e343cb06b0 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -109,6 +109,7 @@ struct kvm_pte_chain { | |||
109 | * bits 4:7 - page table level for this shadow (1-4) | 109 | * bits 4:7 - page table level for this shadow (1-4) |
110 | * bits 8:9 - page table quadrant for 2-level guests | 110 | * bits 8:9 - page table quadrant for 2-level guests |
111 | * bit 16 - "metaphysical" - gfn is not a real page (huge page/real mode) | 111 | * bit 16 - "metaphysical" - gfn is not a real page (huge page/real mode) |
112 | * bits 17:18 - "access" - the user and writable bits of a huge page pde | ||
112 | */ | 113 | */ |
113 | union kvm_mmu_page_role { | 114 | union kvm_mmu_page_role { |
114 | unsigned word; | 115 | unsigned word; |
@@ -118,6 +119,7 @@ union kvm_mmu_page_role { | |||
118 | unsigned quadrant : 2; | 119 | unsigned quadrant : 2; |
119 | unsigned pad_for_nice_hex_output : 6; | 120 | unsigned pad_for_nice_hex_output : 6; |
120 | unsigned metaphysical : 1; | 121 | unsigned metaphysical : 1; |
122 | unsigned hugepage_access : 2; | ||
121 | }; | 123 | }; |
122 | }; | 124 | }; |
123 | 125 | ||