From: Peter Xu <peterx@redhat.com>
To: Michael Roth <michael.roth@amd.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org, jmarcin@redhat.com, david@kernel.org,
pbonzini@redhat.com, chenyi.qiang@intel.com, farosas@suse.de,
aik@amd.com, xiaoyao.li@intel.com
Subject: Re: [PATCH v4 08/12] hostmem: Support fully shared guest memfd to back a VM
Date: Mon, 24 Aug 2026 08:58:53 -0400 [thread overview]
Message-ID: <aoxADcqox7eUPEXT@x1.local> (raw)
In-Reply-To: <2k6hph3cnf4djvjd72g26sdgxluixhm2mpyf2emvgmkrfturvj@ctnctjaks7jq>
On Sun, Aug 23, 2026 at 10:33:36AM -0500, Michael Roth wrote:
> It seemed like the guest_memfd support for directmap removal[1] might be
> a good test for how this all look like once new features start coming
> along for confidential vs. non-confidential so I've been trying to get
> that up and running to see.
>
> If we keep everything in memory-backend-memfd, there's a little bit
> of awkwardness, but the following schema should cover discoverability of
> QEMU support at least, and then libvirt/management can branch into whatever
> routine is needed for probing actual kernel support:
Isn't that secretmem for generic memfd case? I'm not sure if it'll ever
need to be supported by QEMU at all, but it sounds like exactly that for
normal memfds..
>
> diff --git a/qapi/qom.json b/qapi/qom.json
> index ee981fc44c..4777f09ad1 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -774,6 +774,19 @@
> # @guest-memfd: if true, use guest-memfd to back the memory region.
> # (default: false, since: 11.2)
> #
> +# @no-directmap: if true, enable support for unmapping backend memory
> +# from the kernel directmap to better isolate it from
> +# host activity. This option is only available if a
> +# corresponding Features value advertises support for
> +# the intended use-case.
> +# (default: false, since: 11.2)
Shall we name the property to avoid "no-" prefixes ("kernel-map=on/off",
default on)? I used "kernel" instead of "direct" because any mmap() from
user can also be described, more or less.. to be direct.
> +#
> +# Features:
> +#
> +# @no-directmap-for-guest-memfd: If present (and if the hypervisor
> +# supports the feature), the corresponding option is available if
> +# @guest-memfd is true. (since 11.2)
> +#
> # Since: 2.12
> ##
> { 'struct': 'MemoryBackendMemfdProperties',
> @@ -781,8 +794,10 @@
> 'data': { '*hugetlb': 'bool',
> '*hugetlbsize': 'size',
> '*seal': 'bool',
> - '*guest-memfd': 'bool' },
> - 'if': 'CONFIG_LINUX' }
> + '*guest-memfd': 'bool',
> + '*no-directmap': 'bool' },
> + 'if': 'CONFIG_LINUX',
Nitpic: we could drop CONFIG_LINUX IMHO in QAPI if it'll fail properly on
non-linux in impl anyway.
> + 'features': ['no-directmap-for-guest-memfd'] }
>
> One notable thing there is the current code only enables it for
> non-confidential VM types, so that's where the KVM_CAP_* checks would
> need to come into play to distinguish between what's supported for
> specific VM types.
>
>
> On a side note:
>
> Ideally we'd be able to do something like the below so we can have one
> 'supported-for-guest-memfd' features that could be associated with
> multiple options, e.g.:
>
> +# Features:
> +#
> +# @supported-for-guest-memfd: If present (and if the hypervisor
> +# supports the feature), the corresponding option is available if
> +# @guest-memfd is true. (since 11.2)
> +#
> # Since: 2.12
> ##
> { 'struct': 'MemoryBackendMemfdProperties',
> @@ -781,7 +794,9 @@
> 'data': { '*hugetlb': 'bool',
> '*hugetlbsize': 'size',
> '*seal': 'bool',
> - '*guest-memfd': 'bool' },
> + '*guest-memfd': 'bool',
> + { 'name': 'no-directmap',
> + 'features': ['supported-for-guest-memfd'] } },
>
> But it doesn't seem like QAPI is wired up for that. I guess we could add
> that as part of enabling directmap support if it seems useful enough but
> the above should work as well.
Maybe we can still just fail it for normal memfds for now, considering
secretmem or anything like that might still be supported someday. In
general, for any memfd property (guest-memfd or memfd), if it conceptrally
apply to all (my bet is here..) then IMHO we can keep them around at least
from the interface level, and just fail them when we don't have support for
one of the two.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-08-24 12:59 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 20:16 [PATCH v4 00/12] KVM/hostmem: Support init-shared guest-memfd as VM backends Michael Roth
2026-08-12 20:16 ` [PATCH v4 01/12] kvm: Decouple memory attribute check from kvm_guest_memfd_supported Michael Roth
2026-08-12 20:16 ` [PATCH v4 02/12] kvm: Detect guest-memfd flags supported Michael Roth
2026-08-12 20:16 ` [PATCH v4 03/12] kvm: Provide explicit error for kvm_create_guest_memfd() Michael Roth
2026-08-14 5:56 ` Philippe Mathieu-Daudé
2026-08-14 12:44 ` Peter Xu
2026-08-17 4:05 ` Philippe Mathieu-Daudé
2026-08-17 12:44 ` Peter Xu
2026-08-17 15:05 ` Philippe Mathieu-Daudé
2026-08-12 20:16 ` [PATCH v4 04/12] ramblock: Rename guest_memfd to guest_memfd_private Michael Roth
2026-08-12 20:16 ` [PATCH v4 05/12] memory: Rename RAM_GUEST_MEMFD to RAM_GUEST_MEMFD_PRIVATE Michael Roth
2026-08-12 20:16 ` [PATCH v4 06/12] memory: Rename memory_region_has_guest_memfd() to *_private() Michael Roth
2026-08-12 20:16 ` [PATCH v4 07/12] hostmem: Rename guest_memfd to guest_memfd_private Michael Roth
2026-08-12 20:16 ` [PATCH v4 08/12] hostmem: Support fully shared guest memfd to back a VM Michael Roth
2026-08-13 8:24 ` Daniel P. Berrangé
2026-08-13 12:28 ` Peter Xu
2026-08-13 12:48 ` Daniel P. Berrangé
2026-08-13 14:06 ` Peter Xu
2026-08-14 15:19 ` Daniel P. Berrangé
2026-08-17 13:01 ` Peter Xu
2026-08-23 15:33 ` Michael Roth via qemu development
2026-08-24 12:58 ` Peter Xu [this message]
2026-08-25 2:04 ` Michael Roth
2026-08-13 22:10 ` Michael Roth via qemu development
2026-08-14 15:27 ` Daniel P. Berrangé
2026-08-17 13:43 ` Peter Xu
2026-08-12 20:16 ` [PATCH v4 09/12] machine: Rename machine_require_guest_memfd() to *_private() Michael Roth
2026-08-12 20:16 ` [PATCH v4 10/12] memory: Rename memory_region_init_ram_guest_memfd() " Michael Roth
2026-08-12 20:16 ` [PATCH v4 11/12] tests/migration-test: Support guest-memfd init shared mem type Michael Roth
2026-08-12 20:16 ` [PATCH v4 12/12] tests/migration-test: Add a precopy test for guest-memfd Michael Roth
2026-08-21 14:18 ` [PATCH v4 00/12] KVM/hostmem: Support init-shared guest-memfd as VM backends Peter Xu
2026-08-23 15:52 ` Michael Roth
2026-08-24 13:17 ` Peter Xu
2026-08-25 2:20 ` Michael Roth
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=aoxADcqox7eUPEXT@x1.local \
--to=peterx@redhat.com \
--cc=aik@amd.com \
--cc=berrange@redhat.com \
--cc=chenyi.qiang@intel.com \
--cc=david@kernel.org \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=michael.roth@amd.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