From: David Hildenbrand <david.hildenbrand@arm.com>
To: Alexandru Elisei <alexandru.elisei@arm.com>,
Sean Christopherson <seanjc@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
pbonzini@redhat.com, kvm@vger.kernel.org, maz@kernel.org,
oupton@kernel.org, joey.gouly@arm.com, seiden@linux.ibm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
fuad.tabba@linux.dev
Subject: Re: [RFC PATCH 0/3] KVM: Dirty page logging for guest_memfd-only memslots
Date: Wed, 19 Aug 2026 17:38:55 +0200 [thread overview]
Message-ID: <7f52191f-c6b5-4d27-8e11-2c00bd9de968@arm.com> (raw)
In-Reply-To: <an9JNUln8dKaidQc@raptor>
On 8/14/26 18:58, Alexandru Elisei wrote:
> Hi,
>
> On Fri, Aug 14, 2026 at 06:03:54AM -0700, Sean Christopherson wrote:
>> On Fri, Aug 14, 2026, David Hildenbrand wrote:
>>> We have a hardware feature that requires pages to always be mapped into S2. Some
>>> things I had in mind:
>>>
>>> 1) Page migration would not be a problem as long as hardware could be paused
>>> while migrating (e.g., kick all vCPUs). I doubt someone would implement that
>>> right now, but you could consider it an implementation detail that page
>>> migration cannot be supported right now.
>>>
>>> 2) Newer hardware could mitigate this problem, allowing the feature to support
>>> pages temporarily being unmapped from S2.
>>>
>>> 3) Disallowing page migration is really just one implication of "pages must
>>> always be mapped into S2".
>>>
>>> So what we really want is "if feature X is enabled and hardware requires it,
>>> always keep pages mapped into S2, which currently implies that page migration
>>> cannot be supported."
>>>
>>> Which isn't all that different to "if a confidential VM is run on current TDX
>>> hardware, always keep pages mapped into S2, which currently implies that page
>>> migration cannot be supported."
>>>
>>> So I was wondering whether the flow could be:
>>>
>>> User space enabled CPU feature for VM -> KVM knows that current hardware
>>> requires for that CPU feature to have S2 always mapped -> KVM tells guest_memfd
>>> that S2 must be always mapped / disables page migration.
>>
>> I'm a-ok with adding a flag to guest_memfd to communicate whether or not page
>> migration is allowed, because guest_memfd needs to actively support page migration.
>>
>> I'm not ok adding a flag telling guest_memfd that memory must always be mapped
>> in S2, because guest_memfd doesn't care. E.g. KVM doesn't yet support page
>> migration for SNP, but SNP tracks page ownership in an out-of-band table and so
>> KVM can map/unmap all guest memory from S2 at will.
>>
>>> That would be in contrast to user space having to guess that page migration on
>>> the current hardware with the current guest_memfd implementation does not
>>> support page migration, to then disable exactly that.
>>>
>>> Does that explanation makes sense? I don't know the exact mechanism to do that,
>>> but that's just my high-level thinking.
>>
>> Yes, I'm supportive of KVM expressing to guest_memfd that page migration isn't
>> supported by the VM. I'm only objecting to expressing that memory must stay
>> mapped in S2, because guest_memfd doesn't care *why* page migration is or isn't
>> supported/allowed by a particular VM.
>
> My naive contribution is this idea I had:
>
> 1. Userspace queries support in KVM for feature xyz by checking the
> capability KVM_CAP_xyz.
>
> 2. Userspace knows that for feature xyz to work correctly, it is required
> that memory remains mapped at stage 2.
>
> 3. Userspace creates a guest_memfd instance with the right combination of
> flags set and _unset_ for feature xyz to work correctly - i.e, to keep
> memory mapped at stage 2.
>
> For this to work, new guest_memfd features that might lead to memory being
> unmapped are enabled via a flag, and KVM keeps memory mapped at stage 2 by
> default, to maintain compatibility with an userspace not updated for the
> new features/flags.
I was wondering whether KVM could be driving that setting in guest_memfd, with
less userspace intervention.
1. Userspace enables support in KVM for feature xyz through
capability KVM_CAP_xyz.
2. KVM knows that the feature, on the current hardware requires permanent S2
mapping, so it instructs guest_memfd to disable any features that could lead to
a temporary unmapping (e.g.,migration support).
--
Cheers,
David
next prev parent reply other threads:[~2026-08-19 15:39 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 14:29 [RFC PATCH 0/3] KVM: Dirty page logging for guest_memfd-only memslots Alexandru Elisei
2026-07-02 14:29 ` [RFC PATCH 1/3] KVM: guest_memfd: Use memslot id to keep track of associated memslots Alexandru Elisei
2026-07-06 7:14 ` David Hildenbrand
2026-07-06 13:45 ` Alexandru Elisei
2026-07-06 21:46 ` Sean Christopherson
2026-07-07 17:05 ` Alexandru Elisei
2026-07-06 21:43 ` Sean Christopherson
2026-07-07 17:05 ` Alexandru Elisei
2026-07-13 14:03 ` David Hildenbrand
2026-07-13 16:13 ` Sean Christopherson
2026-07-13 13:42 ` David Hildenbrand
2026-07-02 14:29 ` [RFC PATCH 2/3] KVM: Implement dirty page logging for guest_memfd-only memslots Alexandru Elisei
2026-07-07 1:29 ` Sean Christopherson
2026-07-07 17:12 ` Alexandru Elisei
2026-07-14 5:39 ` Kishen Maloor
2026-07-02 14:29 ` [RFC PATCH 3/3] KVM: arm64: Allow " Alexandru Elisei
2026-07-07 0:56 ` [RFC PATCH 0/3] KVM: Dirty " Sean Christopherson
2026-07-07 16:58 ` Alexandru Elisei
2026-07-07 17:12 ` Sean Christopherson
2026-07-09 11:21 ` Mark Rutland
2026-07-09 19:01 ` Sean Christopherson
2026-07-10 10:26 ` Mark Rutland
2026-07-13 14:11 ` David Hildenbrand
2026-08-13 16:09 ` Alexandru Elisei
2026-08-13 20:01 ` David Hildenbrand
2026-08-13 23:32 ` Sean Christopherson
2026-08-14 7:51 ` David Hildenbrand
2026-08-14 13:03 ` Sean Christopherson
2026-08-14 15:56 ` Alexandru Elisei
2026-08-14 16:04 ` Sean Christopherson
2026-08-14 16:26 ` Alexandru Elisei
2026-08-14 16:58 ` Alexandru Elisei
2026-08-14 19:11 ` Sean Christopherson
2026-08-19 15:38 ` David Hildenbrand [this message]
2026-08-19 16:00 ` Sean Christopherson
2026-07-09 20:33 ` Oliver Upton
2026-07-10 10:44 ` Alexandru Elisei
2026-07-10 18:18 ` Oliver Upton
2026-07-13 13:48 ` Alexandru Elisei
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=7f52191f-c6b5-4d27-8e11-2c00bd9de968@arm.com \
--to=david.hildenbrand@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.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