On 6/9/2026 7:14 PM, Igor Mammedov wrote:
On Fri, 5 Jun 2026 18:46:07 +0800
fanhuang <[email protected]> wrote:

+static int collect_sp_mem_ranges_cb(Object *obj, void *opaque)
sp_mem_collect... maybe


Will rename to sp_mem_collect_ranges_cb.

+    uint64_t cursor, end;
region_start, region_end


Will rename.

+    int nb_nodes = ms->numa_state ? ms->numa_state->num_nodes : 0;
+    uint32_t hotplug_pxm = nb_nodes > 0 ? nb_nodes - 1 : 0;

when function is called ms->numa_state->num_nodes is always > 0, isn't it?


Correct — build_srat() already dereferences
machine->numa_state->num_nodes unconditionally, so the guard is dead.
Will simplify to ms->numa_state->num_nodes.

-    if (machine->device_memory) {
keep it here, and drop one in build_srat_device_memory()


Will guard the call in build_srat() with if (machine->device_memory)
and drop the check inside build_srat_device_memory(), so there is a
single guard at the call site.

-        build_srat_memory(table_data, machine->device_memory->base,
-                          memory_region_size(&machine->device_memory->mr),
-                          nb_numa_nodes - 1,
-                          MEM_AFFINITY_HOTPLUGGABLE | MEM_AFFINITY_ENABLED);
-    }
+    build_srat_device_memory(table_data, machine);
acpi_table_end(linker, &table);
  }



Reply via email to