diff options
| author | Marcelo Tosatti <mtosatti@redhat.com> | 2010-12-22 06:01:57 -0500 |
|---|---|---|
| committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:31:13 -0500 |
| commit | e49146dce8c3dc6f4485c1904b6587855f393e71 (patch) | |
| tree | 1a7db0516cee7ff2810445e16d21dadd960237af | |
| parent | 16d8f72f70a85ce333788204a69318827130ca75 (diff) | |
KVM: MMU: only write protect mappings at pagetable level
If a pagetable contains a writeable large spte, all of its sptes will be
write protected, including non-leaf ones, leading to endless pagefaults.
Do not write protect pages above PT_PAGE_TABLE_LEVEL, as the spte fault
paths assume non-leaf sptes are writable.
Tested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
| -rw-r--r-- | arch/x86/kvm/mmu.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b77a5ba398be..a2127f82e786 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
| @@ -3445,6 +3445,9 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot) | |||
| 3445 | if (!test_bit(slot, sp->slot_bitmap)) | 3445 | if (!test_bit(slot, sp->slot_bitmap)) |
| 3446 | continue; | 3446 | continue; |
| 3447 | 3447 | ||
| 3448 | if (sp->role.level != PT_PAGE_TABLE_LEVEL) | ||
| 3449 | continue; | ||
| 3450 | |||
| 3448 | pt = sp->spt; | 3451 | pt = sp->spt; |
| 3449 | for (i = 0; i < PT64_ENT_PER_PAGE; ++i) | 3452 | for (i = 0; i < PT64_ENT_PER_PAGE; ++i) |
| 3450 | /* avoid RMW */ | 3453 | /* avoid RMW */ |
