Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Garg, Shivank" <shivankg@amd.com>,
	"Gupta, Pankaj" <Pankaj.Gupta@amd.com>,
	"Sampat, Pratik Rajesh" <PratikRajesh.Sampat@amd.com>,
	"nikita.kalyazin@linux.dev" <nikita.kalyazin@linux.dev>,
	"ying.huang@linux.alibaba.com" <ying.huang@linux.alibaba.com>,
	"patrick.roy@linux.dev" <patrick.roy@linux.dev>,
	"joshua.hahnjy@gmail.com" <joshua.hahnjy@gmail.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"jmattson@google.com" <jmattson@google.com>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"jack@suse.cz" <jack@suse.cz>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"Dadhania, Nikunj" <nikunj.dadhania@amd.com>,
	"Roth, Michael" <Michael.Roth@amd.com>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"mhocko@suse.com" <mhocko@suse.com>,
	"gourry@gourry.net" <gourry@gourry.net>,
	"iweiny@kernel.org" <iweiny@kernel.org>,
	"chao.p.peng@linux.intel.com" <chao.p.peng@linux.intel.com>,
	"byungchul@sk.com" <byungchul@sk.com>,
	"x86@kernel.org" <x86@kernel.org>, "bp@alien8.de" <bp@alien8.de>,
	"ricarkol@google.com" <ricarkol@google.com>,
	"vannapurve@google.com" <vannapurve@google.com>,
	"shuah@kernel.org" <shuah@kernel.org>,
	"seanjc@google.com" <seanjc@google.com>,
	"jackmanb@google.com" <jackmanb@google.com>,
	"Kalra, Ashish" <Ashish.Kalra@amd.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"surenb@google.com" <surenb@google.com>,
	"pshier@google.com" <pshier@google.com>,
	"matthew.brost@intel.com" <matthew.brost@intel.com>,
	"fuad.tabba@linux.dev" <fuad.tabba@linux.dev>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"rakie.kim@sk.com" <rakie.kim@sk.com>,
	"ackerleytng@google.com" <ackerleytng@google.com>,
	"apopple@nvidia.com" <apopple@nvidia.com>,
	"ziy@nvidia.com" <ziy@nvidia.com>,
	"vbabka@kernel.org" <vbabka@kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
Cc: "linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"sashiko-bot@kernel.org" <sashiko-bot@kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v3 0/9] KVM: guest_memfd: folio migration for non-confidential VMs
Date: Fri, 21 Aug 2026 15:39:04 +0200	[thread overview]
Message-ID: <3cdf9ac0-b77c-4624-ad8e-68c10af648ac@kernel.org> (raw)
In-Reply-To: <0a02a6c4f0ee50ca596c4a2673b2ae6c80d4569b.camel@amd.com>

On 8/21/26 14:34, Garg, Shivank wrote:
> On Wed, 2026-08-05 at 06:40 +0000, Shivank Garg wrote:
>> guest_memfd folios are currently always marked unmovable, so the kernel cannot
>> perform memory compaction, offlining, etc. This is unavoidable for
>> confidential VMs (SEV-SNP, TDX), since memory is encrypted and copying it
>> needs firmware assistance. However, for non-confidential VMs (like
>> Firecracker), we can migrate the folios.
>>
>> This series enables folio migration for non-confidential guest_memfd and
>> also lays the groundwork for migrating confidential guest_memfd later.
>> Once firmware-assisted copying support is available, those VMs can be
>> made movable, the confidential folio content can be copied separately,
>> and the destination folio marked with FOLIO_CONTENT_COPIED[4] so
>> __migrate_folio() skips the host-side folio_mc_copy().
>>
>> Testing
>> -------
>> Host: 7.2-rc6+(c21bb419386) + this, AMD EPYC ZEN 3, 2 NUMA nodes
>>
>> - KVM selftest: allocate folios on node 0, migrate them to node 1 and
>>   back and verify resulting NUMA node and the folio contents at each
>>   step.
>>
>> - Firecracker [1]: booted a microVM backed by guest_memfd. While the
>>   guest was running, forced host-side migration of its folios via
>>   migratepages(8) and explicit move_pages(2) of guest_memfd
>>   pages. Verify with /proc/firecracker_pid/numa_maps.
>>
>> Notes
>> -----
>> - Sashiko pointed out a pre-existing ABBA deadlock between
>>   kvm_gmem_error_folio() and truncation. It's being addressed separately
>>   by Hao Zhang. [2][3]
>>
>> [1] https://github.com/firecracker-microvm/firecracker/tree/feature/secret-hiding
>>     In builder.rs, add GUEST_MEMFD_FLAG_MIGRATABLE to bit-2 and pass it instead
>>     of GUEST_MEMFD_FLAG_NO_DIRECT_MAP to vm.create_guest_memfd().
>> [2] https://lore.kernel.org/all/ambEdSPjerZIVN0b@192.168.1.215/
>> [3] https://sashiko.dev/#/patchset/20260611-shivank-gmem-migrate-v1-0-2d266bfc6f95%40amd.com
>> [4] https://lore.kernel.org/all/20260630-shivank-batch-migrate-offload-v6-1-da95d7e8b8a2@amd.com
>>
>> Signed-off-by: Shivank Garg <shivankg@amd.com>
>> ---
>> Changes in v3:
>> - Fix unbalanced mmu_invalidate_in_progress count unbinding dying guest_memfd. (Sashiko)
>> - Fix maxnode handling in xapic_ipi_test selftest.
>> - Add GUEST_MEMFD_FLAG_MIGRATABLE documentation
>> - Replace open-coded sizeof() * 8 calculation with BITS_PER_TYPE()
>> - Add get_numa_mem_nodes() and use  MPOL_F_MEMS_ALLOWED for allowed NUMA ndoes
>>   instead of hardcoded NUMA node IDs. (Sashiko)
>> - Extend migration selftest to verify rejection without MIGRATABLE flag and
>>   move repeated checks into common helpers.
>> - Drop RFC tag.
>> - Link to v2: https://lore.kernel.org/r/20260728-shivank-gmem-migrate-v2-0-269ac1f84e2b@amd.com
>>
>> Changes in v2:
>> - Make folio migration opt-in through GUEST_MEMFD_FLAG_MIGRATABLE,
>>   preserving unmovable behavior if userspace don't explictly ask. (Alexandru, David, Sean)
>> - Add kvm_arch_supports_gmem_migration() so arch can control whether
>>   GUEST_MEMFD_FLAG_MIGRATABLE is advertised.
>> - Allocate movable folios with GFP_HIGHUSER_MOVABLE. (David)
>> - Keep guest_memfd unevictable. (David, Sashiko, Sean)
>> - Split migrate_folio() implementation and enablement as separate patches.
>> - Update selftest with new flag.
>> - Link to v1: https://lore.kernel.org/r/20260611-shivank-gmem-migrate-v1-0-2d266bfc6f95@amd.com
>>
>> ---
>> Shivank Garg (9):
>>       KVM: guest_memfd: take the invalidate lock when unbinding a dying file
>>       mm: split AS_UNMOVABLE back out of AS_INACCESSIBLE
>>       KVM: guest_memfd: implement folio migration for non-confidential VMs
>>       KVM: guest_memfd: add GUEST_MEMFD_FLAG_MIGRATABLE
>>       KVM: selftests: fix maxnode arguments in xapic_ipi_test
>>       KVM: selftests: use BITS_PER_TYPE() for NUMA masks
>>       KVM: selftests: add get_numa_mem_nodes()
>>       KVM: selftests: use allowed NUMA nodes in guest_memfd_test
>>       KVM: selftests: exercise guest_memfd folio migration
>>
>>
> 
> Should I spin the independent patches out of this series for next cycle?

I'd say, yes :)

-- 
Cheers,

David

      reply	other threads:[~2026-08-21 13:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  6:40 [PATCH v3 0/9] KVM: guest_memfd: folio migration for non-confidential VMs Shivank Garg
2026-08-05  6:40 ` [PATCH v3 1/9] KVM: guest_memfd: take the invalidate lock when unbinding a dying file Shivank Garg
2026-08-05  6:40 ` [PATCH v3 2/9] mm: split AS_UNMOVABLE back out of AS_INACCESSIBLE Shivank Garg
2026-08-05  6:40 ` [PATCH v3 3/9] KVM: guest_memfd: implement folio migration for non-confidential VMs Shivank Garg
2026-08-05  6:40 ` [PATCH v3 4/9] KVM: guest_memfd: add GUEST_MEMFD_FLAG_MIGRATABLE Shivank Garg
2026-08-05  6:40 ` [PATCH v3 5/9] KVM: selftests: fix maxnode arguments in xapic_ipi_test Shivank Garg
2026-08-05  6:40 ` [PATCH v3 6/9] KVM: selftests: use BITS_PER_TYPE() for NUMA masks Shivank Garg
2026-08-05  6:40 ` [PATCH v3 7/9] KVM: selftests: add get_numa_mem_nodes() Shivank Garg
2026-08-05  6:40 ` [PATCH v3 8/9] KVM: selftests: use allowed NUMA nodes in guest_memfd_test Shivank Garg
2026-08-21 12:34 ` [PATCH v3 0/9] KVM: guest_memfd: folio migration for non-confidential VMs Garg, Shivank
2026-08-21 13:39   ` David Hildenbrand (Arm) [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=3cdf9ac0-b77c-4624-ad8e-68c10af648ac@kernel.org \
    --to=david@kernel.org \
    --cc=Ashish.Kalra@amd.com \
    --cc=Michael.Roth@amd.com \
    --cc=Pankaj.Gupta@amd.com \
    --cc=PratikRajesh.Sampat@amd.com \
    --cc=ackerleytng@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=bp@alien8.de \
    --cc=byungchul@sk.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=fuad.tabba@linux.dev \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=hpa@zytor.com \
    --cc=iweiny@kernel.org \
    --cc=jack@suse.cz \
    --cc=jackmanb@google.com \
    --cc=jmattson@google.com \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=nikita.kalyazin@linux.dev \
    --cc=nikunj.dadhania@amd.com \
    --cc=patrick.roy@linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --cc=rakie.kim@sk.com \
    --cc=ricarkol@google.com \
    --cc=sashiko-bot@kernel.org \
    --cc=seanjc@google.com \
    --cc=shivankg@amd.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=tglx@kernel.org \
    --cc=vannapurve@google.com \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    --cc=x86@kernel.org \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.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