diff mbox series

hw/arm/virt-acpi-build: Add a check for memory-less NUMA nodes

Message ID 20180911112643.19296-1-shenglong.zsl@alibaba-inc.com (mailing list archive)
State New, archived
Headers show
Series hw/arm/virt-acpi-build: Add a check for memory-less NUMA nodes | expand

Commit Message

Shannon Zhao Sept. 11, 2018, 11:26 a.m. UTC
From: Shannon Zhao <shannon.zhaosl@gmail.com>

Like commit 16b4226(hw/acpi-build: Add a check for memory-less NUMA node
), it also needs to check memory length for NUMA nodes on ARM.

Signed-off-by: Shannon Zhao <shannon.zhaosl@gmail.com>
---
 hw/arm/virt-acpi-build.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Andrew Jones Sept. 13, 2018, 6:40 a.m. UTC | #1
On Tue, Sep 11, 2018 at 07:26:43PM +0800, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhaosl@gmail.com>
> 
> Like commit 16b4226(hw/acpi-build: Add a check for memory-less NUMA node
> ), it also needs to check memory length for NUMA nodes on ARM.
> 
> Signed-off-by: Shannon Zhao <shannon.zhaosl@gmail.com>
> ---
>  hw/arm/virt-acpi-build.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index ce31abd..5785fb6 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -562,10 +562,12 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>  
>      mem_base = vms->memmap[VIRT_MEM].base;
>      for (i = 0; i < nb_numa_nodes; ++i) {
> -        numamem = acpi_data_push(table_data, sizeof(*numamem));
> -        build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i,
> -                          MEM_AFFINITY_ENABLED);
> -        mem_base += numa_info[i].node_mem;
> +        if (numa_info[i].node_mem > 0) {
> +            numamem = acpi_data_push(table_data, sizeof(*numamem));
> +            build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i,
> +                              MEM_AFFINITY_ENABLED);
> +            mem_base += numa_info[i].node_mem;
> +        }
>      }
>  
>      build_header(linker, table_data, (void *)(table_data->data + srat_start),
> -- 
> 2.9.3.windows.1
>

Reviewed-by: Andrew Jones <drjones@redhat.com>
Peter Maydell Sept. 25, 2018, 8:54 a.m. UTC | #2
On 11 September 2018 at 12:26, Shannon Zhao <shannon.zhaosl@gmail.com> wrote:
> From: Shannon Zhao <shannon.zhaosl@gmail.com>
>
> Like commit 16b4226(hw/acpi-build: Add a check for memory-less NUMA node
> ), it also needs to check memory length for NUMA nodes on ARM.
>
> Signed-off-by: Shannon Zhao <shannon.zhaosl@gmail.com>
> ---
>  hw/arm/virt-acpi-build.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index ce31abd..5785fb6 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -562,10 +562,12 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>
>      mem_base = vms->memmap[VIRT_MEM].base;
>      for (i = 0; i < nb_numa_nodes; ++i) {
> -        numamem = acpi_data_push(table_data, sizeof(*numamem));
> -        build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i,
> -                          MEM_AFFINITY_ENABLED);
> -        mem_base += numa_info[i].node_mem;
> +        if (numa_info[i].node_mem > 0) {
> +            numamem = acpi_data_push(table_data, sizeof(*numamem));
> +            build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i,
> +                              MEM_AFFINITY_ENABLED);
> +            mem_base += numa_info[i].node_mem;
> +        }
>      }
>
>      build_header(linker, table_data, (void *)(table_data->data + srat_start),
> --
> 2.9.3.windows.1



Applied to target-arm.next, thanks.

-- PMM
diff mbox series

Patch

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index ce31abd..5785fb6 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -562,10 +562,12 @@  build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
 
     mem_base = vms->memmap[VIRT_MEM].base;
     for (i = 0; i < nb_numa_nodes; ++i) {
-        numamem = acpi_data_push(table_data, sizeof(*numamem));
-        build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i,
-                          MEM_AFFINITY_ENABLED);
-        mem_base += numa_info[i].node_mem;
+        if (numa_info[i].node_mem > 0) {
+            numamem = acpi_data_push(table_data, sizeof(*numamem));
+            build_srat_memory(numamem, mem_base, numa_info[i].node_mem, i,
+                              MEM_AFFINITY_ENABLED);
+            mem_base += numa_info[i].node_mem;
+        }
     }
 
     build_header(linker, table_data, (void *)(table_data->data + srat_start),