All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yijun <zhuyijun@huawei.com>
To: Andrew Jones <drjones@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
	shameerali.kolothum.thodi@huawei.com, eric.auger@redhat.com,
	qemu-arm@nongnu.org, zhaoshenglong@huawei.com
Subject: Re: [Qemu-devel] [RFC 5/5] hw/arm/virt-acpi-build: Build srat table according to mem_list
Date: Mon, 20 Nov 2017 17:39:50 +0800	[thread overview]
Message-ID: <5A12A2E6.5070103@huawei.com> (raw)
In-Reply-To: <20171114145150.wydvirgrrcbicvz4@kamzik.brq.redhat.com>

On 2017/11/14 22:51, Andrew Jones wrote:
> On Tue, Nov 14, 2017 at 09:15:54AM +0800, zhuyijun@huawei.com wrote:
>> From: Zhu Yijun <zhuyijun@huawei.com>
>>
>> In case of accessing memory holes, we build srat table by
>> traversing mem_list.
>>
>> Signed-off-by: Zhu Yijun <zhuyijun@huawei.com>
>> ---
>>  hw/arm/virt-acpi-build.c | 40 +++++++++++++++++++++++++++++++++++-----
>>  1 file changed, 35 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
>> index 3d78ff6..e8dd7c9 100644
>> --- a/hw/arm/virt-acpi-build.c
>> +++ b/hw/arm/virt-acpi-build.c
>> @@ -487,7 +487,12 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>>      AcpiSratProcessorGiccAffinity *core;
>>      AcpiSratMemoryAffinity *numamem;
>>      int i, srat_start;
>> -    uint64_t mem_base;
>> +    hwaddr region_offset = 0;       /* region base addr offset */
>> +    hwaddr region_eat_size = 0;     /* region consumed size */
>> +    hwaddr node_mem_size = 0;
>> +    RAMRegion *begin_search_region = QLIST_FIRST(&vms->bootinfo.mem_list);
>> +    RAMRegion *reg;
>> +
>>      MachineClass *mc = MACHINE_GET_CLASS(vms);
>>      const CPUArchIdList *cpu_list = mc->possible_cpu_arch_ids(MACHINE(vms));
>>  
>> @@ -504,12 +509,37 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>>          core->flags = cpu_to_le32(1);
>>      }
>>  
>> -    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;
>> +        node_mem_size = numa_info[i].node_mem;
>> +        QLIST_FOREACH(reg, &vms->bootinfo.mem_list, next) {
>> +            if (reg->base != begin_search_region->base) {
>> +                continue;
>> +            }
>> +
>> +            if (node_mem_size >= (reg->size - region_offset)) {
>> +                region_eat_size = reg->size - region_offset;
>> +            } else {
>> +                region_eat_size = node_mem_size;
>> +            }
>> +
>> +            build_srat_memory(numamem, reg->base + region_offset,
>> +                              region_eat_size, i, MEM_AFFINITY_ENABLED);
>> +
>> +            node_mem_size -= region_eat_size;
>> +            region_offset += region_eat_size;
>> +            begin_search_region = reg;
>> +
>> +            /* The region is depleted */
>> +            if (reg->size == region_offset) {
>> +                region_offset = 0;
>> +                begin_search_region = QLIST_NEXT(reg, next);
>> +            }
>> +
>> +            if (node_mem_size == 0) {
>> +                break;
>> +            }
>> +        }
>>      }
>>  
>>      build_header(linker, table_data, (void *)srat, "SRAT",
>> -- 
>> 1.8.3.1
>>
>>
>>
> Same pc-dimm assigning to NUMA node comment from last patch applies to this
> one.

ok, thanks!

> Thanks,
> drew 
>
> .
>



WARNING: multiple messages have this Message-ID (diff)
From: Zhu Yijun <zhuyijun@huawei.com>
To: Andrew Jones <drjones@redhat.com>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	eric.auger@redhat.com, peter.maydell@linaro.org,
	shameerali.kolothum.thodi@huawei.com, zhaoshenglong@huawei.com
Subject: Re: [Qemu-devel] [RFC 5/5] hw/arm/virt-acpi-build: Build srat table according to mem_list
Date: Mon, 20 Nov 2017 17:39:50 +0800	[thread overview]
Message-ID: <5A12A2E6.5070103@huawei.com> (raw)
In-Reply-To: <20171114145150.wydvirgrrcbicvz4@kamzik.brq.redhat.com>

On 2017/11/14 22:51, Andrew Jones wrote:
> On Tue, Nov 14, 2017 at 09:15:54AM +0800, zhuyijun@huawei.com wrote:
>> From: Zhu Yijun <zhuyijun@huawei.com>
>>
>> In case of accessing memory holes, we build srat table by
>> traversing mem_list.
>>
>> Signed-off-by: Zhu Yijun <zhuyijun@huawei.com>
>> ---
>>  hw/arm/virt-acpi-build.c | 40 +++++++++++++++++++++++++++++++++++-----
>>  1 file changed, 35 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
>> index 3d78ff6..e8dd7c9 100644
>> --- a/hw/arm/virt-acpi-build.c
>> +++ b/hw/arm/virt-acpi-build.c
>> @@ -487,7 +487,12 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>>      AcpiSratProcessorGiccAffinity *core;
>>      AcpiSratMemoryAffinity *numamem;
>>      int i, srat_start;
>> -    uint64_t mem_base;
>> +    hwaddr region_offset = 0;       /* region base addr offset */
>> +    hwaddr region_eat_size = 0;     /* region consumed size */
>> +    hwaddr node_mem_size = 0;
>> +    RAMRegion *begin_search_region = QLIST_FIRST(&vms->bootinfo.mem_list);
>> +    RAMRegion *reg;
>> +
>>      MachineClass *mc = MACHINE_GET_CLASS(vms);
>>      const CPUArchIdList *cpu_list = mc->possible_cpu_arch_ids(MACHINE(vms));
>>  
>> @@ -504,12 +509,37 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>>          core->flags = cpu_to_le32(1);
>>      }
>>  
>> -    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;
>> +        node_mem_size = numa_info[i].node_mem;
>> +        QLIST_FOREACH(reg, &vms->bootinfo.mem_list, next) {
>> +            if (reg->base != begin_search_region->base) {
>> +                continue;
>> +            }
>> +
>> +            if (node_mem_size >= (reg->size - region_offset)) {
>> +                region_eat_size = reg->size - region_offset;
>> +            } else {
>> +                region_eat_size = node_mem_size;
>> +            }
>> +
>> +            build_srat_memory(numamem, reg->base + region_offset,
>> +                              region_eat_size, i, MEM_AFFINITY_ENABLED);
>> +
>> +            node_mem_size -= region_eat_size;
>> +            region_offset += region_eat_size;
>> +            begin_search_region = reg;
>> +
>> +            /* The region is depleted */
>> +            if (reg->size == region_offset) {
>> +                region_offset = 0;
>> +                begin_search_region = QLIST_NEXT(reg, next);
>> +            }
>> +
>> +            if (node_mem_size == 0) {
>> +                break;
>> +            }
>> +        }
>>      }
>>  
>>      build_header(linker, table_data, (void *)srat, "SRAT",
>> -- 
>> 1.8.3.1
>>
>>
>>
> Same pc-dimm assigning to NUMA node comment from last patch applies to this
> one.

ok, thanks!

> Thanks,
> drew 
>
> .
>

  reply	other threads:[~2017-11-20  9:42 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14  1:15 [Qemu-arm] [RFC 0/5] arm: Exclude reserved memory regions of iommu to avoid zhuyijun
2017-11-14  1:15 ` [Qemu-devel] " zhuyijun
2017-11-14  1:15 ` [Qemu-devel] [RFC 1/5] hw/vfio: Add function for getting reserved_region of device iommu group zhuyijun
2017-11-14  1:15   ` zhuyijun
2017-11-14 15:47   ` [Qemu-arm] " Alex Williamson
2017-11-14 15:47     ` Alex Williamson
2017-11-15  9:49     ` [Qemu-arm] " Shameerali Kolothum Thodi
2017-11-15  9:49       ` Shameerali Kolothum Thodi
2017-11-15 18:25       ` [Qemu-arm] " Alex Williamson
2017-11-15 18:25         ` Alex Williamson
2017-11-20 11:58         ` [Qemu-arm] " Shameerali Kolothum Thodi
2017-11-20 11:58           ` Shameerali Kolothum Thodi
2017-11-20 15:57           ` [Qemu-arm] " Alex Williamson
2017-11-20 15:57             ` Alex Williamson
2017-11-20 16:31             ` [Qemu-arm] " Shameerali Kolothum Thodi
2017-11-20 16:31               ` Shameerali Kolothum Thodi
2017-12-06 10:30             ` [Qemu-arm] " Shameerali Kolothum Thodi
2017-12-06 10:30               ` Shameerali Kolothum Thodi
2017-12-06 14:01               ` [Qemu-arm] " Auger Eric
2017-12-06 14:01                 ` Auger Eric
2017-12-06 14:38                 ` [Qemu-arm] " Shameerali Kolothum Thodi
2017-12-06 14:38                   ` Shameerali Kolothum Thodi
2017-12-06 14:59                   ` [Qemu-arm] " Auger Eric
2017-12-06 14:59                     ` Auger Eric
2017-12-06 15:19                     ` [Qemu-arm] " Shameerali Kolothum Thodi
2017-12-06 15:19                       ` Shameerali Kolothum Thodi
2017-11-14  1:15 ` [Qemu-arm] [RFC 2/5] hw/arm/virt: Enable dynamic generation of guest RAM memory regions zhuyijun
2017-11-14  1:15   ` [Qemu-devel] " zhuyijun
2017-11-14 14:47   ` [Qemu-arm] " Andrew Jones
2017-11-14 14:47     ` Andrew Jones
2017-11-20  9:22     ` [Qemu-arm] " Zhu Yijun
2017-11-20  9:22       ` Zhu Yijun
2017-11-14  1:15 ` [Qemu-devel] [RFC 3/5] hw/arm: add scattered RAM memory region support zhuyijun
2017-11-14  1:15   ` zhuyijun
2017-11-14 14:50   ` [Qemu-arm] " Andrew Jones
2017-11-14 14:50     ` Andrew Jones
2017-11-20  9:54     ` [Qemu-arm] " Zhu Yijun
2017-11-20  9:54       ` Zhu Yijun
2018-04-19  9:06     ` [Qemu-arm] " Shameerali Kolothum Thodi
2018-04-19  9:06       ` Shameerali Kolothum Thodi
2018-04-24 15:29       ` [Qemu-arm] " Andrew Jones
2018-04-24 15:29         ` Andrew Jones
2018-04-25 13:24         ` [Qemu-arm] " Shameerali Kolothum Thodi
2018-04-25 13:24           ` Shameerali Kolothum Thodi
2017-11-14  1:15 ` [Qemu-devel] [RFC 4/5] hw/arm/boot: set fdt size cell of memory node from mem_list zhuyijun
2017-11-14  1:15   ` zhuyijun
2017-11-14 14:51   ` [Qemu-arm] " Andrew Jones
2017-11-14 14:51     ` Andrew Jones
2017-11-20  9:38     ` [Qemu-arm] " Zhu Yijun
2017-11-20  9:38       ` Zhu Yijun
2017-11-14  1:15 ` [Qemu-devel] [RFC 5/5] hw/arm/virt-acpi-build: Build srat table according to mem_list zhuyijun
2017-11-14  1:15   ` zhuyijun
2017-11-14 14:51   ` Andrew Jones
2017-11-14 14:51     ` Andrew Jones
2017-11-20  9:39     ` Zhu Yijun [this message]
2017-11-20  9:39       ` Zhu Yijun
2017-11-14  1:42 ` [Qemu-devel] [RFC 0/5] arm: Exclude reserved memory regions of iommu to avoid no-reply
2017-11-14  1:42   ` no-reply

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=5A12A2E6.5070103@huawei.com \
    --to=zhuyijun@huawei.com \
    --cc=drjones@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=zhaoshenglong@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.