Commit e925c5ba authored by Avi Kivity's avatar Avi Kivity

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: default avatarAvi Kivity <avi@qumranet.com>
parent c8681339
...@@ -1169,6 +1169,7 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) ...@@ -1169,6 +1169,7 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes)
continue; continue;
pte_size = page->role.glevels == PT32_ROOT_LEVEL ? 4 : 8; pte_size = page->role.glevels == PT32_ROOT_LEVEL ? 4 : 8;
misaligned = (offset ^ (offset + bytes - 1)) & ~(pte_size - 1); misaligned = (offset ^ (offset + bytes - 1)) & ~(pte_size - 1);
misaligned |= bytes < 4;
if (misaligned || flooded) { if (misaligned || flooded) {
/* /*
* Misaligned accesses are too much trouble to fix * Misaligned accesses are too much trouble to fix
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment