From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, dmatlack@google.com
Subject: Re: [PATCH v2] KVM: x86: avoid memslot check in NX hugepage recovery if it cannot succeed
Date: Fri, 18 Nov 2022 17:21:02 +0000 [thread overview]
Message-ID: <Y3e+/r0MFzJxsX3m@google.com> (raw)
In-Reply-To: <20221118162447.3185950-1-pbonzini@redhat.com>
On Fri, Nov 18, 2022, Paolo Bonzini wrote:
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 43bbe4fde078..5d85f1a61793 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1603,6 +1603,8 @@ static int kvm_prepare_memory_region(struct kvm *kvm,
> struct kvm_memory_slot *new,
> enum kvm_mr_change change)
> {
> + int old_flags = old ? old->flags : 0;
> + int new_flags = new ? new->flags : 0;
> int r;
>
> /*
> @@ -1627,6 +1629,11 @@ static int kvm_prepare_memory_region(struct kvm *kvm,
> }
> }
>
> + if ((old_flags ^ new_flags) & KVM_MEM_LOG_DIRTY_PAGES) {
> + int change = (new_flags & KVM_MEM_LOG_DIRTY_PAGES) ? 1 : -1;
> + atomic_set(&kvm->nr_memslots_dirty_logging,
> + atomic_read(&kvm->nr_memslots_dirty_logging) + change);
Again, this needs to be done in the "commit" stage, and IMO should be x86-only.
https://lore.kernel.org/all/Y3bTu4%2FnUfpX+Enm@google.com
> + }
> r = kvm_arch_prepare_memory_region(kvm, old, new, change);
>
> /* Free the bitmap on failure if it was allocated above. */
> --
> 2.31.1
>
prev parent reply other threads:[~2022-11-18 17:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 16:24 [PATCH v2] KVM: x86: avoid memslot check in NX hugepage recovery if it cannot succeed Paolo Bonzini
2022-11-18 17:21 ` Sean Christopherson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y3e+/r0MFzJxsX3m@google.com \
--to=seanjc@google.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.