aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/mmu.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-04-30 07:47:02 -0400
committerAvi Kivity <avi@qumranet.com>2007-07-16 05:05:38 -0400
commite925c5ba9380dad5fdf1d0a9d9199ac43be74c6a (patch)
tree9de2c9a4530170d77609af5236d8eaf546fd1ec9 /drivers/kvm/mmu.c
parentc86813393f8b8f9f738ab57d9837858ed850df4b (diff)
KVM: Assume that writes smaller than 4 bytes are to non-pagetable pages
This allows us to remove write protection earlier than otherwise. Should some mad OS choose to use byte writes to update pagetables, it will suffer a performance hit, but still work correctly. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r--drivers/kvm/mmu.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index e8e228118de9..2277b7cd118c 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -1169,6 +1169,7 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
1169 continue; 1169 continue;
1170 pte_size = page->role.glevels == PT32_ROOT_LEVEL ? 4 : 8; 1170 pte_size = page->role.glevels == PT32_ROOT_LEVEL ? 4 : 8;
1171 misaligned = (offset ^ (offset + bytes - 1)) & ~(pte_size - 1); 1171 misaligned = (offset ^ (offset + bytes - 1)) & ~(pte_size - 1);
1172 misaligned |= bytes < 4;
1172 if (misaligned || flooded) { 1173 if (misaligned || flooded) {
1173 /* 1174 /*
1174 * Misaligned accesses are too much trouble to fix 1175 * Misaligned accesses are too much trouble to fix