summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Yznaga <anthony.yznaga@oracle.com>2020-06-02 13:07:28 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-04 14:42:25 -0400
commit5688fed649f15a232e75148afb0a28864046f44c (patch)
tree5e704fc2aaea975a137a6f15237b7334b68f64d7
parent7ec28e264f2e52089c14c6f8eba1ce7b6501e59b (diff)
downloadlinux-5688fed649f15a232e75148afb0a28864046f44c.tar.bz2
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 <anthony.yznaga@oracle.com> Message-Id: <1591128450-11977-2-git-send-email-anthony.yznaga@oracle.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9e41b5135340..e11e0494f833 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10142,11 +10142,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
static void kvm_mmu_slot_apply_flags(struct kvm *kvm,
struct kvm_memory_slot *new)
{
- /* Still write protect RO slot */
- if (new->flags & KVM_MEM_READONLY) {
- kvm_mmu_slot_remove_write_access(kvm, new, PG_LEVEL_4K);
+ /* Nothing to do for RO slots */
+ if (new->flags & KVM_MEM_READONLY)
return;
- }
/*
* Call kvm_x86_ops dirty logging hooks when they are valid.