[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWbB_Dd94rngPfgm@google.com>
Date: Tue, 13 Jan 2026 14:06:52 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Michael Roth <michael.roth@....com>
Cc: kvm@...r.kernel.org, linux-coco@...ts.linux.dev, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, thomas.lendacky@....com, pbonzini@...hat.com,
vbabka@...e.cz, ashish.kalra@....com, liam.merwick@...cle.com,
david@...hat.com, vannapurve@...gle.com, ackerleytng@...gle.com, aik@....com,
ira.weiny@...el.com, yan.y.zhao@...el.com, pankaj.gupta@....com,
Kai Huang <kai.huang@...el.com>
Subject: Re: [PATCH v3 6/6] KVM: guest_memfd: GUP source pages prior to
populating guest memory
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!
Powered by blists - more mailing lists