From: Michael Roth <michael.roth@amd.com>
To: Vishal Annapurve <vannapurve@google.com>
Cc: Yan Zhao <yan.y.zhao@intel.com>, <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>, <seanjc@google.com>, <vbabka@suse.cz>,
<ashish.kalra@amd.com>, <liam.merwick@oracle.com>,
<david@redhat.com>, <ackerleytng@google.com>, <aik@amd.com>,
<ira.weiny@intel.com>
Subject: Re: [PATCH 3/3] KVM: guest_memfd: GUP source pages prior to populating guest memory
Date: Wed, 3 Dec 2025 17:48:20 -0600 [thread overview]
Message-ID: <20251203234820.jzzmrqxjeyt5w6gf@amd.com> (raw)
In-Reply-To: <CAGtprH8gznGJ6VObk8aShBn_XnhwDoUzyzTkaDAe+MyiNsJ-NA@mail.gmail.com>
On Sun, Nov 30, 2025 at 05:44:31PM -0800, Vishal Annapurve wrote:
> On Fri, Nov 21, 2025 at 5:02 AM Michael Roth <michael.roth@amd.com> wrote:
> >
> > >
> > > Increasing GMEM_GUP_NPAGES to (1UL << PUD_ORDER) is probabaly not a good idea.
> > >
> > > Given both TDX/SNP map at 4KB granularity, why not just invoke post_populate()
> > > per 4KB while removing the max_order from post_populate() parameters, as done
> > > in Sean's sketch patch [1]?
> >
> > That's an option too, but SNP can make use of 2MB pages in the
> > post-populate callback so I don't want to shut the door on that option
> > just yet if it's not too much of a pain to work in. Given the guest BIOS
> > lives primarily in 1 or 2 of these 2MB regions the benefits might be
> > worthwhile, and SNP doesn't have a post-post-populate promotion path
> > like TDX (at least, not one that would help much for guest boot times)
>
> Given the small initial payload size, do you really think optimizing
> for setting up huge page-aligned RMP entries is worthwhile?
Missed this reply earlier.
It could be, but would probably be worthwhile to do some performance
analysis before considering that so we can simplify in the meantime.
> The code becomes somewhat complex when trying to get this scenario
> working and IIUC it depends on userspace-passed initial payload
> regions aligning to the huge page size. What happens if userspace
> tries to trigger snp_launch_update() for two unaligned regions within
> the same huge page?
We'd need to gate the order that we pass to post-populate callback
according to each individual call. For 2MB pages we'd end up with
4K behavior. For 1GB pages, there's some potential of using 2MB
order for each region if gpa/dst/len are aligned, but without the
buddy-style 1G->2M-4K splitting stuff, we'd likely need to split
to 4K at some point and then the 2MB RMP entry would get PSMASH'd
to 4K anyway. But maybe the 1GB could remain intact for long enough
to get through a decent portion of OVMF boot before we end up
creating a mixed range... not sure.
But yes, this also seems like functionality that's premature to
prep for, so just locking it in at 4K is probably best for now.
-Mike
>
> What Sean suggested earlier[1] seems relatively simpler to maintain.
>
> [1] https://lore.kernel.org/kvm/aHEwT4X0RcfZzHlt@google.com/
>
> >
> > Thanks,
> >
> > Mike
next prev parent reply other threads:[~2025-12-03 23:49 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 23:07 [PATCH RFC 0/3] KVM: guest_memfd: Rework preparation/population flows in prep for in-place conversion Michael Roth
2025-11-13 23:07 ` [PATCH 1/3] KVM: guest_memfd: Remove preparation tracking Michael Roth
2025-11-17 23:58 ` Ackerley Tng
2025-11-19 0:18 ` Michael Roth
2025-11-20 9:12 ` Yan Zhao
2025-11-21 12:43 ` Michael Roth
2025-11-25 3:13 ` Yan Zhao
2025-12-01 1:35 ` Vishal Annapurve
2025-12-01 2:51 ` Yan Zhao
2025-12-01 19:33 ` Vishal Annapurve
2025-12-02 9:16 ` Yan Zhao
2025-12-01 23:44 ` Michael Roth
2025-12-02 9:17 ` Yan Zhao
2025-12-03 13:47 ` Michael Roth
2025-12-05 3:54 ` Yan Zhao
2025-11-13 23:07 ` [PATCH 2/3] KVM: TDX: Document alignment requirements for KVM_TDX_INIT_MEM_REGION Michael Roth
2025-11-13 23:07 ` [PATCH 3/3] KVM: guest_memfd: GUP source pages prior to populating guest memory Michael Roth
2025-11-20 9:11 ` Yan Zhao
2025-11-21 13:01 ` Michael Roth
2025-11-24 9:31 ` Yan Zhao
2025-11-24 15:53 ` Ira Weiny
2025-11-25 3:12 ` Yan Zhao
2025-12-01 1:47 ` Vishal Annapurve
2025-12-01 21:03 ` Michael Roth
2025-12-01 22:13 ` Michael Roth
2025-12-03 2:46 ` Yan Zhao
2025-12-03 14:26 ` Michael Roth
2025-12-03 20:59 ` FirstName LastName
2025-12-03 23:12 ` Michael Roth
2025-12-03 21:01 ` Ira Weiny
2025-12-03 23:07 ` Michael Roth
2025-12-05 3:38 ` Yan Zhao
2025-12-01 1:44 ` Vishal Annapurve
2025-12-03 23:48 ` Michael Roth [this message]
2025-11-20 19:34 ` Ira Weiny
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=20251203234820.jzzmrqxjeyt5w6gf@amd.com \
--to=michael.roth@amd.com \
--cc=ackerleytng@google.com \
--cc=aik@amd.com \
--cc=ashish.kalra@amd.com \
--cc=david@redhat.com \
--cc=ira.weiny@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=pbonzini@redhat.com \
--cc=seanjc@google.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