From: Avi Kivity Date: Mon, 30 Apr 2007 11:47:02 +0000 (+0300) Subject: KVM: Assume that writes smaller than 4 bytes are to non-pagetable pages X-Git-Tag: v2.6.23-rc1~520^2~77 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e925c5ba9380dad5fdf1d0a9d9199ac43be74c6a;p=linux-2.6 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 --- diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index e8e228118d..2277b7cd11 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) continue; pte_size = page->role.glevels == PT32_ROOT_LEVEL ? 4 : 8; misaligned = (offset ^ (offset + bytes - 1)) & ~(pte_size - 1); + misaligned |= bytes < 4; if (misaligned || flooded) { /* * Misaligned accesses are too much trouble to fix