qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Andrew Jones <drjones@redhat.com>
Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org,
	peter.huangpeng@huawei.com, shannon.zhao@linaro.org,
	qemu-devel@nongnu.org, david.daney@cavium.com
Subject: Re: [Qemu-devel] [PATCH v5 3/5] ARM: Add numa-node-id for /memory node
Date: Sat, 23 Apr 2016 09:16:11 +0800	[thread overview]
Message-ID: <571ACCDB.20800@huawei.com> (raw)
In-Reply-To: <20160422124842.uhskszmlsn6v53c5@hawk.localdomain>



On 2016/4/22 20:48, Andrew Jones wrote:
> On Thu, Apr 21, 2016 at 02:23:52PM +0800, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> When specifying NUMA for ARM machine, generate /memory node according to
>> NUMA topology.
>>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>>  hw/arm/boot.c | 31 ++++++++++++++++++++++++++++++-
>>  1 file changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
>> index 5975fbf..3770235 100644
>> --- a/hw/arm/boot.c
>> +++ b/hw/arm/boot.c
>> @@ -14,6 +14,7 @@
>>  #include "hw/arm/linux-boot-if.h"
>>  #include "sysemu/kvm.h"
>>  #include "sysemu/sysemu.h"
>> +#include "sysemu/numa.h"
>>  #include "hw/boards.h"
>>  #include "hw/loader.h"
>>  #include "elf.h"
>> @@ -405,6 +406,9 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
>>      void *fdt = NULL;
>>      int size, rc;
>>      uint32_t acells, scells;
>> +    char *nodename;
>> +    unsigned int i;
>> +    hwaddr mem_base, mem_len;
>>  
>>      if (binfo->dtb_filename) {
>>          char *filename;
>> @@ -456,14 +460,39 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
>>          goto fail;
>>      }
>>  
>> +    mem_len = (nb_numa_nodes > 0) ? numa_info[0].node_mem : binfo->ram_size;
>>      rc = qemu_fdt_setprop_sized_cells(fdt, "/memory", "reg",
> 
> So node0's memory node will still be called '/memory' instead of
> '/memory@addr' like the other nodes? Shouldn't we change it too?
> 
Previously I deleted the /memory node creation codes in virt.c and
create here, but that will cause other boards booting fail since
load_dtb() is a common function. So to avoid more changes to other
files, I just use current way. So is there any way to change the node
name after it's created in qemu?

>>                                        acells, binfo->loader_start,
>> -                                      scells, binfo->ram_size);
>> +                                      scells, mem_len);
>>      if (rc < 0) {
>>          fprintf(stderr, "couldn't set /memory/reg\n");
>>          goto fail;
>>      }
>>  
>> +    if (nb_numa_nodes > 0) {
>> +        /* Set the numa-node-id for the first /memory node. */
>> +        qemu_fdt_setprop_cell(fdt, "/memory", "numa-node-id", 0);
>> +        /* create /memory node and set properties for other memory numa nodes */
>> +        mem_base = binfo->loader_start + mem_len;
>> +        for (i = 1; i < nb_numa_nodes; i++) {
>> +            mem_len = numa_info[i].node_mem;
>> +            nodename = g_strdup_printf("/memory@%" PRIx64, mem_base);
>> +            qemu_fdt_add_subnode(fdt, nodename);
>> +            qemu_fdt_setprop_string(fdt, nodename, "device_type", "memory");
>> +            rc = qemu_fdt_setprop_sized_cells(fdt, nodename, "reg",
>> +                                              acells, mem_base,
>> +                                              scells, mem_len);
>> +            if (rc < 0) {
>> +                fprintf(stderr, "couldn't set /memory/reg\n");
> 
> I'd extend this error message with either the full memory node name,
> i.e. '@addr', or something like "couldn't set... for node %d\n"
> 
Sure. Thanks.

-- 
Shannon

  reply	other threads:[~2016-04-23  1:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21  6:23 [Qemu-devel] [PATCH v5 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
2016-04-21  6:23 ` [Qemu-devel] [PATCH v5 1/5] ARM: Virt: Add /distance-map node for NUMA Shannon Zhao
2016-04-22 12:25   ` Andrew Jones
2016-04-23  1:17     ` Shannon Zhao
2016-04-23  7:03       ` Andrew Jones
2016-04-23  7:27         ` Shannon Zhao
2016-04-21  6:23 ` [Qemu-devel] [PATCH v5 2/5] ARM: Virt: Set numa-node-id for CPUs Shannon Zhao
2016-04-22 12:34   ` Andrew Jones
2016-04-21  6:23 ` [Qemu-devel] [PATCH v5 3/5] ARM: Add numa-node-id for /memory node Shannon Zhao
2016-04-22 12:48   ` Andrew Jones
2016-04-23  1:16     ` Shannon Zhao [this message]
2016-04-23  7:45       ` Andrew Jones
2016-04-23  8:02         ` Shannon Zhao
2016-04-21  6:23 ` [Qemu-devel] [PATCH v5 4/5] include/hw/acpi/acpi-defs: Add GICC Affinity Structure Shannon Zhao
2016-04-22 13:26   ` Andrew Jones
2016-04-21  6:23 ` [Qemu-devel] [PATCH v5 5/5] hw/arm/virt-acpi-build: Generate SRAT table Shannon Zhao
2016-04-22 13:26   ` Andrew Jones
2016-04-23  1:08     ` Shannon Zhao
2016-04-25 10:44     ` Igor Mammedov

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=571ACCDB.20800@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=david.daney@cavium.com \
    --cc=drjones@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).