]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mm/fake-numa: handle cases with no SRAT info
authorBruno Faccini <bfaccini@nvidia.com>
Mon, 27 Jan 2025 17:16:23 +0000 (09:16 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:18:52 +0000 (11:18 +0100)
commit 4c80187001d3e2876dfe7e011b9eac3b6270156f upstream.

Handle more gracefully cases where no SRAT information is available, like
in VMs with no Numa support, and allow fake-numa configuration to complete
successfully in these cases

Link: https://lkml.kernel.org/r/20250127171623.1523171-1-bfaccini@nvidia.com
Fixes: 63db8170bf34 (“mm/fake-numa: allow later numa node hotplug”)
Signed-off-by: Bruno Faccini <bfaccini@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hyeonggon Yoo <hyeonggon.yoo@sk.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Len Brown <lenb@kernel.org>
Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/numa/srat.c

index 76ad0f6758f57968d7c62ba379817d20e77ab2c7..abcd812be33d858cf4b4ad47a5a43e1ad2c9a9a5 100644 (file)
@@ -95,9 +95,13 @@ int __init fix_pxm_node_maps(int max_nid)
        int i, j, index = -1, count = 0;
        nodemask_t nodes_to_enable;
 
-       if (numa_off || srat_disabled())
+       if (numa_off)
                return -1;
 
+       /* no or incomplete node/PXM mapping set, nothing to do */
+       if (srat_disabled())
+               return 0;
+
        /* find fake nodes PXM mapping */
        for (i = 0; i < MAX_NUMNODES; i++) {
                if (node_to_pxm_map[i] != PXM_INVAL) {
@@ -117,6 +121,11 @@ int __init fix_pxm_node_maps(int max_nid)
                        }
                }
        }
+       if (index == -1) {
+               pr_debug("No node/PXM mapping has been set\n");
+               /* nothing more to be done */
+               return 0;
+       }
        if (WARN(index != max_nid, "%d max nid  when expected %d\n",
                      index, max_nid))
                return -1;