[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aUClcGHzJK7PyutH@google.com>
Date: Mon, 15 Dec 2025 16:18:56 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Vishal Annapurve <vannapurve@...gle.com>
Cc: Michael Roth <michael.roth@....com>, 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, ackerleytng@...gle.com,
aik@....com, ira.weiny@...el.com, yan.y.zhao@...el.com
Subject: Re: [PATCH v2 1/5] KVM: guest_memfd: Remove partial hugepage handling
from kvm_gmem_populate()
On Mon, Dec 15, 2025, Vishal Annapurve wrote:
> On Mon, Dec 15, 2025 at 7:35 AM Michael Roth <michael.roth@....com> wrote:
> > diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> > index fdaea3422c30..9dafa44838fe 100644
> > --- a/virt/kvm/guest_memfd.c
> > +++ b/virt/kvm/guest_memfd.c
> > @@ -151,6 +151,15 @@ static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index)
> > mapping_gfp_mask(inode->i_mapping), policy);
> > mpol_cond_put(policy);
> >
> > + /*
> > + * External interfaces like kvm_gmem_get_pfn() support dealing
> > + * with hugepages to a degree, but internally, guest_memfd currently
> > + * assumes that all folios are order-0 and handling would need
> > + * to be updated for anything otherwise (e.g. page-clearing
> > + * operations).
> > + */
> > + WARN_ON_ONCE(folio_order(folio));
>
> I am not sure if this WARN_ON adds any value. i.e. The current code
> can't hit it.
The current code _shouldn't_ hit it.
> This note concerns future efforts to add hugepage support and could be
> omitted altogether from the current implementation.
IMO, this is a good use of WARN_ON_ONCE(). It documents guest_memfd's assumptions
and/or limitations, which is extremely helpful to readers/contributors that aren't
familiar with guest_memfd and/or its history of hugepage support.
Powered by blists - more mailing lists