Skip to content

Commit 5688fed

Browse files
Anthony Yznagabonzini
authored andcommitted
KVM: x86: remove unnecessary rmap walk of read-only memslots
There's no write access to remove. An existing memslot cannot be updated to set or clear KVM_MEM_READONLY, and any mappings established in a newly created or moved read-only memslot will already be read-only. Signed-off-by: Anthony Yznaga <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 7ec28e2 commit 5688fed

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10142,11 +10142,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
1014210142
static void kvm_mmu_slot_apply_flags(struct kvm *kvm,
1014310143
struct kvm_memory_slot *new)
1014410144
{
10145-
/* Still write protect RO slot */
10146-
if (new->flags & KVM_MEM_READONLY) {
10147-
kvm_mmu_slot_remove_write_access(kvm, new, PG_LEVEL_4K);
10145+
/* Nothing to do for RO slots */
10146+
if (new->flags & KVM_MEM_READONLY)
1014810147
return;
10149-
}
1015010148

1015110149
/*
1015210150
* Call kvm_x86_ops dirty logging hooks when they are valid.

0 commit comments

Comments
 (0)