From: Sean Christopherson <seanjc@google.com>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: David Hildenbrand <david.hildenbrand@arm.com>,
pbonzini@redhat.com, kvm@vger.kernel.org, maz@kernel.org,
oupton@kernel.org, joey.gouly@arm.com, seiden@linux.ibm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
fuad.tabba@linux.dev, mark.rutland@arm.com
Subject: Re: [RFC PATCH 1/3] KVM: guest_memfd: Use memslot id to keep track of associated memslots
Date: Mon, 6 Jul 2026 14:46:03 -0700 [thread overview]
Message-ID: <akwiG_tDu5Eyyc0-@google.com> (raw)
In-Reply-To: <akuxjY-VRrmcybjZ@raptor>
On Mon, Jul 06, 2026, Alexandru Elisei wrote:
> On Mon, Jul 06, 2026 at 09:14:59AM +0200, David Hildenbrand wrote:
> > > diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> > > index db57c5766ab6..43ef8e908aaf 100644
> > > --- a/virt/kvm/guest_memfd.c
> > > +++ b/virt/kvm/guest_memfd.c
> > > @@ -25,6 +25,7 @@ struct gmem_file {
> > > struct kvm *kvm;
> > > struct xarray bindings;
> > > struct list_head entry;
> > > + bool found_memslot; /* Used for balancing invalidations when punching a hole */
> >
> > Probabably best to document what it means, not only what it is used for (and
> > maybe document above the member if you end up with more text).
>
> Sure, this is how I changed it:
>
> diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> index 210bdd76f0aa..3cee64047bce 100644
> --- a/virt/kvm/guest_memfd.c
> +++ b/virt/kvm/guest_memfd.c
> @@ -25,7 +25,13 @@ struct gmem_file {
> struct kvm *kvm;
> struct xarray bindings;
> struct list_head entry;
> - bool found_memslot; /* Used for balancing invalidations when punching a hole */
> + /*
> + * Keeps track of whether memory has been unmapped during secondary MMU
> + * invalidation, to keep the invalidate start and end calls balanced.
> + *
> + * Accessed while holding the inode->i_mapping lock in exclusive mode.
> + */
> + bool memslot_invalidated;
> };
>
> Hopefully the new name is better.
Why add a boolean? It's not _needed_ to balance updates, or rather it shouldn't
be needed. filemap_invalidate_lock() prevents modifying bindings while an
invalidation is in-progress. It might be a performation optimization, but if so,
it's a premature one and belongs in a separate patch.
next prev parent reply other threads:[~2026-07-06 21:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 14:29 [RFC PATCH 0/3] KVM: Dirty page logging for guest_memfd-only memslots Alexandru Elisei
2026-07-02 14:29 ` [RFC PATCH 1/3] KVM: guest_memfd: Use memslot id to keep track of associated memslots Alexandru Elisei
2026-07-06 7:14 ` David Hildenbrand
2026-07-06 13:45 ` Alexandru Elisei
2026-07-06 21:46 ` Sean Christopherson [this message]
2026-07-06 21:43 ` Sean Christopherson
2026-07-02 14:29 ` [RFC PATCH 2/3] KVM: Implement dirty page logging for guest_memfd-only memslots Alexandru Elisei
2026-07-07 1:29 ` Sean Christopherson
2026-07-02 14:29 ` [RFC PATCH 3/3] KVM: arm64: Allow " Alexandru Elisei
2026-07-07 0:56 ` [RFC PATCH 0/3] KVM: Dirty " Sean Christopherson
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=akwiG_tDu5Eyyc0-@google.com \
--to=seanjc@google.com \
--cc=alexandru.elisei@arm.com \
--cc=david.hildenbrand@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox