From: zhaoshenglong@huawei.com (Shannon Zhao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 3/4] arm64/arm, numa, dt: adding numa dt binding implementation for arm64 platforms.
Date: Sat, 28 Nov 2015 17:30:07 +0800 [thread overview]
Message-ID: <5659741F.9090606@huawei.com> (raw)
In-Reply-To: <1447780843-9223-4-git-send-email-gkulkarni@caviumnetworks.com>
On 2015/11/18 1:20, Ganapatrao Kulkarni wrote:
> +static int __init early_init_parse_memory_node(unsigned long node)
> +{
> + const __be32 *reg, *endp;
> + int length;
> + int nid;
> +
> + const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> +
> + /* We are scanning "memory" nodes only */
> + if (type == NULL)
> + return 0;
> + else if (strcmp(type, "memory") != 0)
> + return 0;
> +
> + nid = early_init_of_get_numa_nid(node);
> +
> + if (nid == NUMA_NO_NODE)
> + return -EINVAL;
> +
> + reg = of_get_flat_dt_prop(node, "reg", &length);
> + endp = reg + (length / sizeof(__be32));
> +
> + while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
> + u64 base, size;
> + struct memblock_region *mblk;
> +
> + base = dt_mem_next_cell(dt_root_addr_cells, ®);
> + size = dt_mem_next_cell(dt_root_size_cells, ®);
> + pr_debug("NUMA-DT: base = %llx , node = %u\n",
> + base, nid);
> +
> + for_each_memblock(memory, mblk) {
> + if (mblk->base == base) {
> + if (numa_add_memblk(nid,
> + mblk->base,
> + mblk->size) < 0)
> + return -EINVAL;
> + break;
> + }
> + }
Maybe this is not right. If the memory spaces of NUMA nodes are
continuous like below:
memory at 60000000 {
numa-node-id = <0x1>;
reg = <0x0 0x60000000 0x0 0x20000000>;
device_type = "memory";
};
memory at 40000000 {
numa-node-id = <0x0>;
reg = <0x0 0x40000000 0x0 0x20000000>;
device_type = "memory";
};
There is only one memory region [0x00000040000000-0x0000007fffffff] and
the mblk->base is 40000000, so it will not add the memory node 1.
I think this should do the same thing like ACPI_NUMA but add some codes
to check if the [base, base + size] is located in some memory region.
Or don't check because numa_add_memblk will fail if the [base, base +
size] is not located in some memory region.
Thanks,
--
Shannon
next prev parent reply other threads:[~2015-11-28 9:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 17:20 [PATCH v7 0/4] arm64, numa: Add numa support for arm64 platforms Ganapatrao Kulkarni
2015-11-17 17:20 ` [PATCH v7 1/4] arm64, numa: adding " Ganapatrao Kulkarni
2015-11-27 8:00 ` Shannon Zhao
2015-12-01 8:45 ` Ganapatrao Kulkarni
2015-12-17 17:11 ` Will Deacon
2015-12-17 18:30 ` Ganapatrao Kulkarni
2015-12-22 9:34 ` Ganapatrao Kulkarni
2015-12-22 9:55 ` Will Deacon
2015-12-22 13:43 ` Ganapatrao Kulkarni
2015-11-17 17:20 ` [PATCH v7 2/4] Documentation, dt, arm64/arm: dt bindings for numa Ganapatrao Kulkarni
2015-12-11 13:53 ` Mark Rutland
2015-12-11 14:41 ` Ganapatrao Kulkarni
2015-12-17 19:07 ` Mark Rutland
2015-12-18 3:10 ` Ganapatrao Kulkarni
2015-11-17 17:20 ` [PATCH v7 3/4] arm64/arm, numa, dt: adding numa dt binding implementation for arm64 platforms Ganapatrao Kulkarni
2015-11-28 9:30 ` Shannon Zhao [this message]
2015-12-01 8:43 ` Ganapatrao Kulkarni
2015-11-17 17:20 ` [PATCH v7 4/4] arm64, dt, thunderx: Add initial dts for Cavium Thunderx in 2 node topology Ganapatrao Kulkarni
2015-12-02 11:19 ` [PATCH v7 0/4] arm64, numa: Add numa support for arm64 platforms Ganapatrao Kulkarni
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=5659741F.9090606@huawei.com \
--to=zhaoshenglong@huawei.com \
--cc=linux-arm-kernel@lists.infradead.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).