From: Peter Xu <peterx@redhat.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
Chenyi Qiang <chenyi.qiang@intel.com>,
David Hildenbrand <david@redhat.com>,
Alexey Kardashevskiy <aik@amd.com>,
Juraj Marcin <jmarcin@redhat.com>
Subject: Re: [PATCH 8/8] hostmem: Support in-place guest memfd to back a VM
Date: Thu, 13 Nov 2025 16:53:00 -0500 [thread overview]
Message-ID: <aRZTPBN9Nx2ykDWK@x1.local> (raw)
In-Reply-To: <ebb35318-5c02-469a-82bd-dc278cd583e9@intel.com>
On Mon, Oct 27, 2025 at 01:24:25PM +0800, Xiaoyao Li wrote:
> I was not authorized to do the QEMU upstream of gmem mmap support inside the
> company. So please keep your series and I'm happy to help review it and make
> it upstreamed.
Thank you, I'll definitely copy you for all future posts.
>
> > >
> > > Third, the intended usage of gmem with mmap from KVM/kernel's perspective is
> > > userspace configures the meomry slot by passing the gmem fd to @guest_memfd
> > > and @guest_memfd of struct kvm_userspace_memory_region2 instead of passing
> > > the user address returned by mmap of the fd to @userspace_addr return mmap()
> > > as this patch does. Surely the usage of this path works. But when QEMU is
> > > going to support in-place conversion of gmem, we has to pass the
> > > @guest_memfd.
> > > Well, this is no issue now and we can handle it in the future when needed.
> >
> > Yes, that's something the private guest-memfd would need. For completely
> > shared guest-memfd, IIUC we will use a lot of different code paths, the
> > goal is to make old APIs work not only for KVM_SET_USER_MEMORY_REGION, but
> > for all the rest modules like vhost-kernel, vhost-user, and so on.
>
> And if pass the @guest_memfd, we will need to handle the issue of aliased:
> https://lore.kernel.org/all/aH-0MdNJbH19Mhm3@google.com/
Note that it's intentional here I reuse userspace_addr, and I have no plan
to support gmem binding with fully shared gmems yet because my current
purpose doesn't need it (I want to ultimately enable postcopy 1G, hence I
want to move away from hugetlbfs but use gmem).
Hence as discussed, my goal is to make gmem work exactly like memfd here
and exactly like before, supporting all kinds of kernel modules. GUP must
work, hence HVA is needed.
So yes, I was aware of the issue discussed there on SMM aliasing, because I
also hit it at that time when testing against the very 1st kernel patchset
from Ackerley on supporting 1G.
That's also something I want to avoid when reusing userspace_addr rather
than using KVM_SET_USER_MEMORY_REGION2.
I plan to leave any form of kvm gmem binding support to others. Likely
this new interface is not needed by either the old approach (where
ramblocks need to duplicate memory consumption like right now), or when
in-place conversion is ready (hence no double mem consumption issue,
however guest-memfd as fd will still be privately created).
Thanks,
--
Peter Xu
prev parent reply other threads:[~2025-11-13 22:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 18:59 [PATCH 0/8] KVM/hostmem: Support in-place guest-memfd as VM backends Peter Xu
2025-10-23 18:59 ` [PATCH 1/8] linux-headers: Update to v6.18-rc2 Peter Xu
2025-10-23 18:59 ` [PATCH 2/8] kvm: Allow kvm_guest_memfd_supported for non-private use case Peter Xu
2025-10-24 2:30 ` Xiaoyao Li
2025-11-13 21:05 ` Peter Xu
2025-11-13 21:08 ` Peter Xu
2025-11-19 14:40 ` Xiaoyao Li
2025-10-23 18:59 ` [PATCH 3/8] kvm: Detect guest-memfd flags supported Peter Xu
2025-10-24 3:52 ` Xiaoyao Li
2025-11-13 21:15 ` Peter Xu
2025-11-13 21:19 ` Peter Xu
2025-11-19 14:44 ` Xiaoyao Li
2025-10-23 18:59 ` [PATCH 4/8] memory: Rename RAM_GUEST_MEMFD to RAM_GUEST_MEMFD_PRIVATE Peter Xu
2025-10-24 9:17 ` Xiaoyao Li
2025-11-13 21:25 ` Peter Xu
2025-11-19 14:45 ` Xiaoyao Li
2025-10-23 18:59 ` [PATCH 5/8] memory: Rename memory_region_has_guest_memfd() to *_private() Peter Xu
2025-10-23 18:59 ` [PATCH 6/8] ramblock: Rename guest_memfd to guest_memfd_private Peter Xu
2025-10-23 18:59 ` [PATCH 7/8] hostmem: " Peter Xu
2025-10-23 18:59 ` [PATCH 8/8] hostmem: Support in-place guest memfd to back a VM Peter Xu
2025-10-24 9:01 ` Xiaoyao Li
2025-10-24 15:22 ` Peter Xu
2025-10-27 5:24 ` Xiaoyao Li
2025-11-13 21:53 ` Peter Xu [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=aRZTPBN9Nx2ykDWK@x1.local \
--to=peterx@redhat.com \
--cc=aik@amd.com \
--cc=chenyi.qiang@intel.com \
--cc=david@redhat.com \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xiaoyao.li@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;
as well as URLs for NNTP newsgroup(s).