From: sashiko-bot@kernel.org
To: "Shivank Garg" <shivankg@amd.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH RFC 3/3] KVM: selftests: exercise guest_memfd folio migration
Date: Thu, 11 Jun 2026 13:18:15 +0000 [thread overview]
Message-ID: <20260611131816.1F4B21F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260611-shivank-gmem-migrate-v1-3-2d266bfc6f95@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test `test_migrate_folio` hardcodes NUMA nodes 0 and 1, leading to false-positive test failures on systems with sparse NUMA topologies or restricted cgroups.
--
commit 857b251fdce0e2a9ddc74b27904d9c410d3010ca
Author: Shivank Garg <shivankg@amd.com>
KVM: selftests: exercise guest_memfd folio migration
This commit adds a migration test to guest_memfd_test for the
MMAP | INIT_SHARED configuration on multi-NUMA systems. It migrates folios
between node 0 and node 1 using move_pages(2) and verifies data integrity.
> diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c
> index 832ef4dfb99fa..04931d3add46c 100644
> --- a/tools/testing/selftests/kvm/guest_memfd_test.c
> +++ b/tools/testing/selftests/kvm/guest_memfd_test.c
[ ... ]
> @@ -76,6 +76,82 @@ static void test_mmap_supported(int fd, size_t total_size)
> kvm_munmap(mem, total_size);
> }
>
> +/*
> + * Each page is filled with a distinct byte (its index). Check every byte that
> + * data is intact after migration.
> + */
> +static void verify_page(const char *page, int page_idx, size_t size,
> + const char *when)
> +{
[ ... ]
> +static void test_migrate_folio(int fd, size_t total_size)
> +{
> + const unsigned long nodemask_0 = 1; /* nid: 0 */
> + unsigned long maxnode = BITS_PER_TYPE(nodemask_0);
> + int page_count = total_size / page_size;
> + void **addr;
> + int *status, *nodes;
> + char *mem;
> + int i;
> +
> + if (!is_multi_numa_node_system())
> + return;
[ ... ]
> + kvm_move_pages(0, page_count, addr, NULL, status, 0);
> + for (i = 0; i < page_count; i++)
> + TEST_ASSERT(status[i] == 0, "Page %d should be on node 0", i);
> +
> + /* Migrate node 0 -> 1, then check both the location and the data. */
> + for (i = 0; i < page_count; i++)
> + nodes[i] = 1;
> + kvm_move_pages(0, page_count, addr, nodes, status, MPOL_MF_MOVE);
[Severity: Medium]
Can this hardcoded target node cause false-positive test failures on
systems with sparse NUMA topologies or restricted cpusets?
is_multi_numa_node_system() verifies that get_max_numa_node() >= 1, but
it does not guarantee that nodes 0 and 1 specifically are online, have
memory, or are accessible within the current cpuset (for example, a system
might only have nodes 0 and 8).
If node 1 is unavailable, kvm_move_pages() or kvm_mbind() will fail with
-ENODEV or -EINVAL, triggering a test assertion failure.
Should this test dynamically discover available NUMA nodes instead of
hardcoding nodes 0 and 1?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611-shivank-gmem-migrate-v1-0-2d266bfc6f95@amd.com?part=3
next prev parent reply other threads:[~2026-06-11 13:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 13:05 [PATCH RFC 0/3] KVM: guest_memfd: folio migration for non-confidential VMs Shivank Garg
2026-06-11 13:05 ` [PATCH RFC 1/3] mm: split AS_UNMOVABLE back out of AS_INACCESSIBLE Shivank Garg
2026-06-11 13:05 ` [PATCH RFC 2/3] KVM: guest_memfd: support folio migration for non-confidential VMs Shivank Garg
2026-06-11 13:25 ` sashiko-bot
2026-06-11 13:05 ` [PATCH RFC 3/3] KVM: selftests: exercise guest_memfd folio migration Shivank Garg
2026-06-11 13:18 ` sashiko-bot [this message]
2026-06-15 10:43 ` [PATCH RFC 0/3] KVM: guest_memfd: folio migration for non-confidential VMs Alexandru Elisei
2026-06-15 11:04 ` Alexandru Elisei
2026-06-15 17:39 ` Sean Christopherson
2026-06-15 18:24 ` David Hildenbrand (Arm)
2026-06-15 18:30 ` David Hildenbrand (Arm)
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=20260611131816.1F4B21F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shivankg@amd.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