NUMA selftests in guest_memfd_test assumes that node 0 and 1 exist and have memory. However, nodes can be sparse or memoryless which would break this selftest. Select the nodes from MPOL_F_MEMS_ALLOWED instead.
Based on KVM: selftests: Fix maxnodes bugs and cleanup related code [1] Tested on a 7.3-rc1+, AMD EPYC 7713. [1] https://lore.kernel.org/kvm/[email protected] Changes in v3: - Rebase on Sean's spin-off series [1] which picks up patch 1 and 2. - Drop Patch 3 as version in [1] is better. (Sean) - Split patch 4 of V2 into 4 patches. (Sean) - Use MAXNODE_FOR_MASK() for maxnode value. (Sean) - Link to v2: https://lore.kernel.org/r/[email protected] Changes in V2: - Split from unbind race fix. (Sean) - Include <linux/bits.h> that defines BITS_PER_TYPE for self-containment. (Sashiko) - Link to V1: https://lore.kernel.org/kvm/[email protected] Signed-off-by: Shivank Garg <[email protected]> --- Shivank Garg (4): KVM: selftests: Prepare guest_memfd_test for arbitrary NUMA nodes KVM: selftests: Use an allowed memory node in test_mbind() KVM: selftests: Use allowed memory nodes in test_numa_allocation() KVM: selftests: Drop unused sysfs NUMA helpers tools/testing/selftests/kvm/guest_memfd_test.c | 61 +++++++++++++++++--------- tools/testing/selftests/kvm/include/numaif.h | 52 ---------------------- 2 files changed, 40 insertions(+), 73 deletions(-) --- base-commit: 88405f0ad1d5c680afe3ea0ce9345fa9e1deaac8 change-id: 20260901-gmem-selftests-fix-2a5e94192f79 prerequisite-message-id: <[email protected]> prerequisite-patch-id: 6424a3d1e4b372d513b201984c97181a9fc2320d prerequisite-patch-id: 1d0e83e328934e90b0e8cb9e4c47f9c7c2d12f9b prerequisite-patch-id: 11bb6b35408a3f251ae7300aa6f1cde2f3ebfac1 prerequisite-patch-id: 7b68398ae0815a4892358359bd067b4cf84c4912 prerequisite-patch-id: 91a2873eeff8555ff7bc728e29a797a07247bdc6 prerequisite-patch-id: d068f85c63973f8bd7606cdb771a3d007b75ad02 prerequisite-patch-id: 26bcf27d961c67b4173bb418fda0a581a6c8a72c Best regards, -- Shivank Garg <[email protected]>

