From: Sean Christopherson <seanjc@google.com>
To: Michael Roth <michael.roth@amd.com>
Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
thomas.lendacky@amd.com, pbonzini@redhat.com, vbabka@suse.cz,
ashish.kalra@amd.com, liam.merwick@oracle.com, david@redhat.com,
vannapurve@google.com, ackerleytng@google.com, aik@amd.com,
ira.weiny@intel.com, yan.y.zhao@intel.com, pankaj.gupta@amd.com,
Kai Huang <kai.huang@intel.com>
Subject: Re: [PATCH v3 6/6] KVM: guest_memfd: GUP source pages prior to populating guest memory
Date: Tue, 13 Jan 2026 14:06:52 -0800 [thread overview]
Message-ID: <aWbB_Dd94rngPfgm@google.com> (raw)
In-Reply-To: <20260113213556.rwihf3v3ek3c5kwl@amd.com>
On Tue, Jan 13, 2026, Michael Roth wrote:
> On Tue, Jan 13, 2026 at 11:21:29AM -0800, Sean Christopherson wrote:
> > On Thu, Jan 08, 2026, Michael Roth wrote:
> > > @@ -842,47 +881,38 @@ long kvm_gmem_populate(struct kvm *kvm, gfn_t start_gfn, void __user *src, long
> > > if (!file)
> > > return -EFAULT;
> > >
> > > - filemap_invalidate_lock(file->f_mapping);
> > > -
> > > npages = min_t(ulong, slot->npages - (start_gfn - slot->base_gfn), npages);
> > > for (i = 0; i < npages; i++) {
> > > - struct folio *folio;
> > > - gfn_t gfn = start_gfn + i;
> > > - pgoff_t index = kvm_gmem_get_index(slot, gfn);
> > > - kvm_pfn_t pfn;
> > > + struct page *src_page = NULL;
> > > + void __user *p;
> > >
> > > if (signal_pending(current)) {
> > > ret = -EINTR;
> > > break;
> > > }
> > >
> > > - folio = __kvm_gmem_get_pfn(file, slot, index, &pfn, NULL);
> > > - if (IS_ERR(folio)) {
> > > - ret = PTR_ERR(folio);
> > > - break;
> > > - }
> > > + p = src ? src + i * PAGE_SIZE : NULL;
> > >
> > > - folio_unlock(folio);
> > > + if (p) {
> >
> > Computing 'p' when src==NULL is unnecessary and makes it hard to see that gup()
> > is done if and only if src!=NULL.
> >
> > Anyone object to this fixup?
>
> No objections here, and it does seem a bit more readable. Will include
> this if a new version is needed.
No need, I'll fixup when applying (already have, actually). If you want to double
check that I didn't fat finger anything, the patches are in kvm-x86/gmem.
Thanks!
prev parent reply other threads:[~2026-01-13 22:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 21:46 [PATCH v3 0/6] KVM: guest_memfd: Rework preparation/population flows in prep for in-place conversion Michael Roth
2026-01-08 21:46 ` [PATCH v3 1/6] KVM: SVM: Fix a missing kunmap_local() in sev_gmem_post_populate() Michael Roth
2026-01-08 21:46 ` [PATCH v3 2/6] KVM: guest_memfd: Remove partial hugepage handling from kvm_gmem_populate() Michael Roth
2026-01-12 9:39 ` Yan Zhao
2026-01-08 21:46 ` [PATCH v3 3/6] KVM: guest_memfd: Remove preparation tracking Michael Roth
2026-01-08 21:46 ` [PATCH v3 4/6] KVM: SEV: Document/enforce page-alignment for KVM_SEV_SNP_LAUNCH_UPDATE Michael Roth
2026-01-08 21:46 ` [PATCH v3 5/6] KVM: TDX: Document alignment requirements for KVM_TDX_INIT_MEM_REGION Michael Roth
2026-01-12 9:40 ` Yan Zhao
2026-01-08 21:46 ` [PATCH v3 6/6] KVM: guest_memfd: GUP source pages prior to populating guest memory Michael Roth
2026-01-12 9:41 ` Yan Zhao
2026-01-13 19:21 ` Sean Christopherson
2026-01-13 21:35 ` Michael Roth
2026-01-13 22:06 ` 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=aWbB_Dd94rngPfgm@google.com \
--to=seanjc@google.com \
--cc=ackerleytng@google.com \
--cc=aik@amd.com \
--cc=ashish.kalra@amd.com \
--cc=david@redhat.com \
--cc=ira.weiny@intel.com \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=liam.merwick@oracle.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=michael.roth@amd.com \
--cc=pankaj.gupta@amd.com \
--cc=pbonzini@redhat.com \
--cc=thomas.lendacky@amd.com \
--cc=vannapurve@google.com \
--cc=vbabka@suse.cz \
--cc=yan.y.zhao@intel.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