* [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa @ 2016-06-02 2:28 Zhen Lei 2016-06-02 2:28 ` [PATCH v3 1/5] of/numa: remove a duplicated pr_debug information Zhen Lei ` (5 more replies) 0 siblings, 6 replies; 14+ messages in thread From: Zhen Lei @ 2016-06-02 2:28 UTC (permalink / raw) To: linux-arm-kernel v2 -> v3: 1. Adjust patch2 and patch5 according to Matthias Brugger's advice, to make the patches looks more well. The final code have no change. v1 -> v2: 1. Base on https://lkml.org/lkml/2016/5/24/679 2. Rewrote of_numa_parse_memory_nodes according to Rob Herring's advice. So that it looks more clear. 3. Rewrote patch 5 because some scenes were not considered before. Zhen Lei (5): of/numa: remove a duplicated pr_debug information of/numa: fix a memory@ node can only contains one memory block arm64/numa: add nid check for memory block of/numa: remove a duplicated warning arm64/numa: avoid inconsistent information to be printed arch/arm64/mm/numa.c | 11 ++++++++--- drivers/of/of_numa.c | 42 ++++++++++++------------------------------ 2 files changed, 20 insertions(+), 33 deletions(-) -- 2.5.0 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 1/5] of/numa: remove a duplicated pr_debug information 2016-06-02 2:28 [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa Zhen Lei @ 2016-06-02 2:28 ` Zhen Lei 2016-06-02 2:28 ` [PATCH v3 2/5] of/numa: fix a memory@ node can only contains one memory block Zhen Lei ` (4 subsequent siblings) 5 siblings, 0 replies; 14+ messages in thread From: Zhen Lei @ 2016-06-02 2:28 UTC (permalink / raw) To: linux-arm-kernel This information will be printed in the subfunction numa_add_memblk. They are not the same, but very similar. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- drivers/of/of_numa.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c index ed5a097..fb71b4e 100644 --- a/drivers/of/of_numa.c +++ b/drivers/of/of_numa.c @@ -88,10 +88,6 @@ static int __init of_numa_parse_memory_nodes(void) break; } - pr_debug("NUMA: base = %llx len = %llx, node = %u\n", - rsrc.start, rsrc.end - rsrc.start + 1, nid); - - r = numa_add_memblk(nid, rsrc.start, rsrc.end + 1); if (r) break; -- 2.5.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 2/5] of/numa: fix a memory@ node can only contains one memory block 2016-06-02 2:28 [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa Zhen Lei 2016-06-02 2:28 ` [PATCH v3 1/5] of/numa: remove a duplicated pr_debug information Zhen Lei @ 2016-06-02 2:28 ` Zhen Lei 2016-06-02 2:28 ` [PATCH v3 3/5] arm64/numa: add nid check for " Zhen Lei ` (3 subsequent siblings) 5 siblings, 0 replies; 14+ messages in thread From: Zhen Lei @ 2016-06-02 2:28 UTC (permalink / raw) To: linux-arm-kernel For a normal memory@ devicetree node, its reg property can contains more memory blocks. Because we don't known how many memory blocks maybe contained, so we try from index=0, increase 1 until error returned(the end). Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- drivers/of/of_numa.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c index fb71b4e..7b3fbdc 100644 --- a/drivers/of/of_numa.c +++ b/drivers/of/of_numa.c @@ -63,13 +63,9 @@ static int __init of_numa_parse_memory_nodes(void) struct device_node *np = NULL; struct resource rsrc; u32 nid; - int r = 0; - - for (;;) { - np = of_find_node_by_type(np, "memory"); - if (!np) - break; + int i, r; + for_each_node_by_type(np, "memory") { r = of_property_read_u32(np, "numa-node-id", &nid); if (r == -EINVAL) /* @@ -78,23 +74,18 @@ static int __init of_numa_parse_memory_nodes(void) * "numa-node-id" property */ continue; - else if (r) - /* some other error */ - break; - r = of_address_to_resource(np, 0, &rsrc); - if (r) { - pr_err("NUMA: bad reg property in memory node\n"); - break; - } + for (i = 0; !r && !of_address_to_resource(np, i, &rsrc); i++) + r = numa_add_memblk(nid, rsrc.start, rsrc.end + 1); - r = numa_add_memblk(nid, rsrc.start, rsrc.end + 1); - if (r) - break; + if (!i || r) { + of_node_put(np); + pr_err("NUMA: bad property in memory node\n"); + return r ? : -EINVAL; + } } - of_node_put(np); - return r; + return 0; } static int __init of_numa_parse_distance_map_v1(struct device_node *map) -- 2.5.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 3/5] arm64/numa: add nid check for memory block 2016-06-02 2:28 [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa Zhen Lei 2016-06-02 2:28 ` [PATCH v3 1/5] of/numa: remove a duplicated pr_debug information Zhen Lei 2016-06-02 2:28 ` [PATCH v3 2/5] of/numa: fix a memory@ node can only contains one memory block Zhen Lei @ 2016-06-02 2:28 ` Zhen Lei 2016-06-03 9:52 ` Will Deacon 2016-06-02 2:28 ` [PATCH v3 4/5] of/numa: remove a duplicated warning Zhen Lei ` (2 subsequent siblings) 5 siblings, 1 reply; 14+ messages in thread From: Zhen Lei @ 2016-06-02 2:28 UTC (permalink / raw) To: linux-arm-kernel Use the same tactic to cpu and numa-distance nodes. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- arch/arm64/mm/numa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index c7fe3ec..2601660 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -141,6 +141,11 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) { int ret; + if (nid >= MAX_NUMNODES) { + pr_warn("NUMA: Node id %u exceeds maximum value\n", nid); + return -EINVAL; + } + ret = memblock_set_node(start, (end - start), &memblock.memory, nid); if (ret < 0) { pr_err("NUMA: memblock [0x%llx - 0x%llx] failed to add on node %d\n", -- 2.5.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 3/5] arm64/numa: add nid check for memory block 2016-06-02 2:28 ` [PATCH v3 3/5] arm64/numa: add nid check for " Zhen Lei @ 2016-06-03 9:52 ` Will Deacon 2016-06-06 1:43 ` Leizhen (ThunderTown) 0 siblings, 1 reply; 14+ messages in thread From: Will Deacon @ 2016-06-03 9:52 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jun 02, 2016 at 10:28:09AM +0800, Zhen Lei wrote: > Use the same tactic to cpu and numa-distance nodes. Sorry, I don't understand... :/ Will > > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > --- > arch/arm64/mm/numa.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > index c7fe3ec..2601660 100644 > --- a/arch/arm64/mm/numa.c > +++ b/arch/arm64/mm/numa.c > @@ -141,6 +141,11 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) > { > int ret; > > + if (nid >= MAX_NUMNODES) { > + pr_warn("NUMA: Node id %u exceeds maximum value\n", nid); > + return -EINVAL; > + } > + > ret = memblock_set_node(start, (end - start), &memblock.memory, nid); > if (ret < 0) { > pr_err("NUMA: memblock [0x%llx - 0x%llx] failed to add on node %d\n", > -- > 2.5.0 > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 3/5] arm64/numa: add nid check for memory block 2016-06-03 9:52 ` Will Deacon @ 2016-06-06 1:43 ` Leizhen (ThunderTown) 0 siblings, 0 replies; 14+ messages in thread From: Leizhen (ThunderTown) @ 2016-06-06 1:43 UTC (permalink / raw) To: linux-arm-kernel On 2016/6/3 17:52, Will Deacon wrote: > On Thu, Jun 02, 2016 at 10:28:09AM +0800, Zhen Lei wrote: >> Use the same tactic to cpu and numa-distance nodes. > > Sorry, I don't understand... :/ In function of_numa_parse_cpu_nodes: for_each_child_of_node(cpus, np) { ... r = of_property_read_u32(np, "numa-node-id", &nid); ... if (nid >= MAX_NUMNODES) //check nid pr_warn("NUMA: Node id %u exceeds maximum value\n", nid); //print warning info ... In function numa_set_distance: if (from >= numa_distance_cnt || to >= numa_distance_cnt || //check nid from < 0 || to < 0) { pr_warn_once("NUMA: Warning: node ids are out of bound, from=%d to=%d distance=%d\n", //print warning info from, to, distance); return; } Both these two functions will check that whether nid(configured in dts, the subnodes of cpus and distance-map) is right or not. So memory@ should also be checked. memory@c00000 { device_type = "memory"; reg = <0x0 0xc00000 0x0 0x80000000>; /* node 0 */ numa-node-id = <0>; //have not been checked yet. }; //suppose I configued a wrong nid, it will not print any warning info cpus { #address-cells = <2>; #size-cells = <0>; cpu at 0 { device_type = "cpu"; compatible = "arm,armv8"; reg = <0x0 0x0>; enable-method = "psci"; /* node 0 */ numa-node-id = <0>; //checked in of_numa_parse_cpu_nodes }; distance-map { compatible = "numa-distance-map-v1"; distance-matrix = <0 0 10>, //checked in of_numa_parse_distance_map_v1 --> numa_set_distance <0 1 20>, <1 1 10>; }; > > Will > >> >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> >> --- >> arch/arm64/mm/numa.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c >> index c7fe3ec..2601660 100644 >> --- a/arch/arm64/mm/numa.c >> +++ b/arch/arm64/mm/numa.c >> @@ -141,6 +141,11 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) >> { >> int ret; >> >> + if (nid >= MAX_NUMNODES) { >> + pr_warn("NUMA: Node id %u exceeds maximum value\n", nid); >> + return -EINVAL; >> + } >> + >> ret = memblock_set_node(start, (end - start), &memblock.memory, nid); >> if (ret < 0) { >> pr_err("NUMA: memblock [0x%llx - 0x%llx] failed to add on node %d\n", >> -- >> 2.5.0 >> >> > > . > ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 4/5] of/numa: remove a duplicated warning 2016-06-02 2:28 [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa Zhen Lei ` (2 preceding siblings ...) 2016-06-02 2:28 ` [PATCH v3 3/5] arm64/numa: add nid check for " Zhen Lei @ 2016-06-02 2:28 ` Zhen Lei 2016-06-02 2:28 ` [PATCH v3 5/5] arm64/numa: avoid inconsistent information to be printed Zhen Lei 2016-06-02 6:03 ` [PATCH 0/3] of: numa: cleanup Kefeng Wang 5 siblings, 0 replies; 14+ messages in thread From: Zhen Lei @ 2016-06-02 2:28 UTC (permalink / raw) To: linux-arm-kernel This warning has been printed in of_numa_parse_cpu_nodes before. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- drivers/of/of_numa.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c index 7b3fbdc..3157130 100644 --- a/drivers/of/of_numa.c +++ b/drivers/of/of_numa.c @@ -174,13 +174,8 @@ int of_node_to_nid(struct device_node *device) np->name); of_node_put(np); - if (!r) { - if (nid >= MAX_NUMNODES) - pr_warn("NUMA: Node id %u exceeds maximum value\n", - nid); - else - return nid; - } + if (!r) + return nid; return NUMA_NO_NODE; } -- 2.5.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 5/5] arm64/numa: avoid inconsistent information to be printed 2016-06-02 2:28 [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa Zhen Lei ` (3 preceding siblings ...) 2016-06-02 2:28 ` [PATCH v3 4/5] of/numa: remove a duplicated warning Zhen Lei @ 2016-06-02 2:28 ` Zhen Lei 2016-06-03 9:55 ` Will Deacon 2016-06-02 6:03 ` [PATCH 0/3] of: numa: cleanup Kefeng Wang 5 siblings, 1 reply; 14+ messages in thread From: Zhen Lei @ 2016-06-02 2:28 UTC (permalink / raw) To: linux-arm-kernel numa_init(of_numa_init) may returned error because of numa configuration error. So "No NUMA configuration found" is inaccurate. In fact, specific configuration error information should be immediately printed by the testing branch. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- arch/arm64/mm/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 2601660..1b9622c 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -338,8 +338,10 @@ static int __init numa_init(int (*init_func)(void)) if (ret < 0) return ret; - if (nodes_empty(numa_nodes_parsed)) + if (nodes_empty(numa_nodes_parsed)) { + pr_info("No NUMA configuration found\n"); return -EINVAL; + } ret = numa_register_nodes(); if (ret < 0) @@ -370,8 +372,6 @@ static int __init dummy_numa_init(void) if (numa_off) pr_info("NUMA disabled\n"); /* Forced off on command line. */ - else - pr_info("No NUMA configuration found\n"); pr_info("NUMA: Faking a node@[mem %#018Lx-%#018Lx]\n", 0LLU, PFN_PHYS(max_pfn) - 1); -- 2.5.0 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 5/5] arm64/numa: avoid inconsistent information to be printed 2016-06-02 2:28 ` [PATCH v3 5/5] arm64/numa: avoid inconsistent information to be printed Zhen Lei @ 2016-06-03 9:55 ` Will Deacon 2016-06-06 2:04 ` Leizhen (ThunderTown) 0 siblings, 1 reply; 14+ messages in thread From: Will Deacon @ 2016-06-03 9:55 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jun 02, 2016 at 10:28:11AM +0800, Zhen Lei wrote: > numa_init(of_numa_init) may returned error because of numa configuration > error. So "No NUMA configuration found" is inaccurate. In fact, specific > configuration error information should be immediately printed by the > testing branch. > > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > --- > arch/arm64/mm/numa.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Looks fine to me, but this doesn't apply against -rc1. Will > diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c > index 2601660..1b9622c 100644 > --- a/arch/arm64/mm/numa.c > +++ b/arch/arm64/mm/numa.c > @@ -338,8 +338,10 @@ static int __init numa_init(int (*init_func)(void)) > if (ret < 0) > return ret; > > - if (nodes_empty(numa_nodes_parsed)) > + if (nodes_empty(numa_nodes_parsed)) { > + pr_info("No NUMA configuration found\n"); > return -EINVAL; > + } > > ret = numa_register_nodes(); > if (ret < 0) > @@ -370,8 +372,6 @@ static int __init dummy_numa_init(void) > > if (numa_off) > pr_info("NUMA disabled\n"); /* Forced off on command line. */ > - else > - pr_info("No NUMA configuration found\n"); > pr_info("NUMA: Faking a node at [mem %#018Lx-%#018Lx]\n", > 0LLU, PFN_PHYS(max_pfn) - 1); > > -- > 2.5.0 > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 5/5] arm64/numa: avoid inconsistent information to be printed 2016-06-03 9:55 ` Will Deacon @ 2016-06-06 2:04 ` Leizhen (ThunderTown) 0 siblings, 0 replies; 14+ messages in thread From: Leizhen (ThunderTown) @ 2016-06-06 2:04 UTC (permalink / raw) To: linux-arm-kernel On 2016/6/3 17:55, Will Deacon wrote: > On Thu, Jun 02, 2016 at 10:28:11AM +0800, Zhen Lei wrote: >> numa_init(of_numa_init) may returned error because of numa configuration >> error. So "No NUMA configuration found" is inaccurate. In fact, specific >> configuration error information should be immediately printed by the >> testing branch. >> >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> >> --- >> arch/arm64/mm/numa.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) > > Looks fine to me, but this doesn't apply against -rc1. Oh, These patched based on https://lkml.org/lkml/2016/5/24/679 series. > > Will > >> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c >> index 2601660..1b9622c 100644 >> --- a/arch/arm64/mm/numa.c >> +++ b/arch/arm64/mm/numa.c >> @@ -338,8 +338,10 @@ static int __init numa_init(int (*init_func)(void)) >> if (ret < 0) >> return ret; >> >> - if (nodes_empty(numa_nodes_parsed)) >> + if (nodes_empty(numa_nodes_parsed)) { >> + pr_info("No NUMA configuration found\n"); >> return -EINVAL; >> + } >> >> ret = numa_register_nodes(); >> if (ret < 0) >> @@ -370,8 +372,6 @@ static int __init dummy_numa_init(void) >> >> if (numa_off) >> pr_info("NUMA disabled\n"); /* Forced off on command line. */ >> - else >> - pr_info("No NUMA configuration found\n"); >> pr_info("NUMA: Faking a node at [mem %#018Lx-%#018Lx]\n", >> 0LLU, PFN_PHYS(max_pfn) - 1); >> >> -- >> 2.5.0 >> >> > > . > ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 0/3] of: numa: cleanup 2016-06-02 2:28 [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa Zhen Lei ` (4 preceding siblings ...) 2016-06-02 2:28 ` [PATCH v3 5/5] arm64/numa: avoid inconsistent information to be printed Zhen Lei @ 2016-06-02 6:03 ` Kefeng Wang 2016-06-02 6:03 ` [PATCH 1/3] of_numa: Use of_get_next_parent to simplify code Kefeng Wang ` (2 more replies) 5 siblings, 3 replies; 14+ messages in thread From: Kefeng Wang @ 2016-06-02 6:03 UTC (permalink / raw) To: linux-arm-kernel 1) Use of_get_next_parent in of_node_to_nid. 2) Use pr_fmt to prefix kernel output. and drop duplicated message of NUMA turned off. Based of Zhen Lei 's patchset v3 "fix some type infos and bugs for arm64/of num" in http://www.spinics.net/lists/arm-kernel/msg507650.html. Kefeng Wang (3): of_numa: Use of_get_next_parent to simplify code of_numa: Use pr_fmt() arm64: numa: Use pr_fmt() arch/arm64/mm/numa.c | 42 +++++++++++++++++++++--------------------- drivers/of/of_numa.c | 25 +++++++++++-------------- 2 files changed, 32 insertions(+), 35 deletions(-) -- 1.7.12.4 ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/3] of_numa: Use of_get_next_parent to simplify code 2016-06-02 6:03 ` [PATCH 0/3] of: numa: cleanup Kefeng Wang @ 2016-06-02 6:03 ` Kefeng Wang 2016-06-02 6:03 ` [PATCH 2/3] of_numa: Use pr_fmt() Kefeng Wang 2016-06-02 6:03 ` [PATCH 3/3] arm64: numa: " Kefeng Wang 2 siblings, 0 replies; 14+ messages in thread From: Kefeng Wang @ 2016-06-02 6:03 UTC (permalink / raw) To: linux-arm-kernel Use of_get_next_parent() instead of open-code. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- drivers/of/of_numa.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c index 3157130..ed7bd22 100644 --- a/drivers/of/of_numa.c +++ b/drivers/of/of_numa.c @@ -153,8 +153,6 @@ int of_node_to_nid(struct device_node *device) np = of_node_get(device); while (np) { - struct device_node *parent; - r = of_property_read_u32(np, "numa-node-id", &nid); /* * -EINVAL indicates the property was not found, and @@ -165,9 +163,7 @@ int of_node_to_nid(struct device_node *device) if (r != -EINVAL) break; - parent = of_get_parent(np); - of_node_put(np); - np = parent; + np = of_get_next_parent(np); } if (np && r) pr_warn("NUMA: Invalid \"numa-node-id\" property in node %s\n", -- 1.7.12.4 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/3] of_numa: Use pr_fmt() 2016-06-02 6:03 ` [PATCH 0/3] of: numa: cleanup Kefeng Wang 2016-06-02 6:03 ` [PATCH 1/3] of_numa: Use of_get_next_parent to simplify code Kefeng Wang @ 2016-06-02 6:03 ` Kefeng Wang 2016-06-02 6:03 ` [PATCH 3/3] arm64: numa: " Kefeng Wang 2 siblings, 0 replies; 14+ messages in thread From: Kefeng Wang @ 2016-06-02 6:03 UTC (permalink / raw) To: linux-arm-kernel Use pr_fmt to prefix kernel output. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- drivers/of/of_numa.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c index ed7bd22..019738f 100644 --- a/drivers/of/of_numa.c +++ b/drivers/of/of_numa.c @@ -16,6 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#define pr_fmt(fmt) "OF: NUMA: " fmt + #include <linux/of.h> #include <linux/of_address.h> #include <linux/nodemask.h> @@ -49,10 +51,9 @@ static void __init of_numa_parse_cpu_nodes(void) if (r) continue; - pr_debug("NUMA: CPU on %u\n", nid); + pr_debug("CPU on %u\n", nid); if (nid >= MAX_NUMNODES) - pr_warn("NUMA: Node id %u exceeds maximum value\n", - nid); + pr_warn("Node id %u exceeds maximum value\n", nid); else node_set(nid, numa_nodes_parsed); } @@ -80,7 +81,7 @@ static int __init of_numa_parse_memory_nodes(void) if (!i || r) { of_node_put(np); - pr_err("NUMA: bad property in memory node\n"); + pr_err("bad property in memory node\n"); return r ? : -EINVAL; } } @@ -94,17 +95,17 @@ static int __init of_numa_parse_distance_map_v1(struct device_node *map) int entry_count; int i; - pr_info("NUMA: parsing numa-distance-map-v1\n"); + pr_info("parsing numa-distance-map-v1\n"); matrix = of_get_property(map, "distance-matrix", NULL); if (!matrix) { - pr_err("NUMA: No distance-matrix property in distance-map\n"); + pr_err("No distance-matrix property in distance-map\n"); return -EINVAL; } entry_count = of_property_count_u32_elems(map, "distance-matrix"); if (entry_count <= 0) { - pr_err("NUMA: Invalid distance-matrix\n"); + pr_err("Invalid distance-matrix\n"); return -EINVAL; } @@ -119,7 +120,7 @@ static int __init of_numa_parse_distance_map_v1(struct device_node *map) matrix++; numa_set_distance(nodea, nodeb, distance); - pr_debug("NUMA: distance[node%d -> node%d] = %d\n", + pr_debug("distance[node%d -> node%d] = %d\n", nodea, nodeb, distance); /* Set default distance of node B->A same as A->B */ @@ -166,7 +167,7 @@ int of_node_to_nid(struct device_node *device) np = of_get_next_parent(np); } if (np && r) - pr_warn("NUMA: Invalid \"numa-node-id\" property in node %s\n", + pr_warn("Invalid \"numa-node-id\" property in node %s\n", np->name); of_node_put(np); -- 1.7.12.4 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/3] arm64: numa: Use pr_fmt() 2016-06-02 6:03 ` [PATCH 0/3] of: numa: cleanup Kefeng Wang 2016-06-02 6:03 ` [PATCH 1/3] of_numa: Use of_get_next_parent to simplify code Kefeng Wang 2016-06-02 6:03 ` [PATCH 2/3] of_numa: Use pr_fmt() Kefeng Wang @ 2016-06-02 6:03 ` Kefeng Wang 2 siblings, 0 replies; 14+ messages in thread From: Kefeng Wang @ 2016-06-02 6:03 UTC (permalink / raw) To: linux-arm-kernel Use pr_fmt to prefix kernel output, and remove duplicated msg of NUMA turned off. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- arch/arm64/mm/numa.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 1b9622c..8be5ba3 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -17,6 +17,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#define pr_fmt(fmt) "numa: " fmt + #include <linux/acpi.h> #include <linux/bootmem.h> #include <linux/memblock.h> @@ -36,10 +38,9 @@ static __init int numa_parse_early_param(char *opt) { if (!opt) return -EINVAL; - if (!strncmp(opt, "off", 3)) { - pr_info("%s\n", "NUMA turned off"); + if (!strncmp(opt, "off", 3)) numa_off = true; - } + return 0; } early_param("numa", numa_parse_early_param); @@ -108,7 +109,7 @@ static void __init setup_node_to_cpumask_map(void) set_cpu_numa_node(cpu, NUMA_NO_NODE); /* cpumask_of_node() will now work */ - pr_debug("NUMA: Node to cpumask map for %d nodes\n", nr_node_ids); + pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids); } /* @@ -142,19 +143,19 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) int ret; if (nid >= MAX_NUMNODES) { - pr_warn("NUMA: Node id %u exceeds maximum value\n", nid); + pr_warn("Node id %u exceeds maximum value\n", nid); return -EINVAL; } ret = memblock_set_node(start, (end - start), &memblock.memory, nid); if (ret < 0) { - pr_err("NUMA: memblock [0x%llx - 0x%llx] failed to add on node %d\n", + pr_err("memblock [0x%llx - 0x%llx] failed to add on node %d\n", start, (end - 1), nid); return ret; } node_set(nid, numa_nodes_parsed); - pr_info("NUMA: Adding memblock [0x%llx - 0x%llx] on node %d\n", + pr_info("Adding memblock [0x%llx - 0x%llx] on node %d\n", start, (end - 1), nid); return ret; } @@ -169,19 +170,18 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) void *nd; int tnid; - pr_info("NUMA: Initmem setup node %d [mem %#010Lx-%#010Lx]\n", - nid, start_pfn << PAGE_SHIFT, - (end_pfn << PAGE_SHIFT) - 1); + pr_info("Initmem setup node %d [mem %#010Lx-%#010Lx]\n", + nid, start_pfn << PAGE_SHIFT, (end_pfn << PAGE_SHIFT) - 1); nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); nd = __va(nd_pa); /* report and initialize */ - pr_info("NUMA: NODE_DATA [mem %#010Lx-%#010Lx]\n", + pr_info(" NODE_DATA [mem %#010Lx-%#010Lx]\n", nd_pa, nd_pa + nd_size - 1); tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); if (tnid != nid) - pr_info("NUMA: NODE_DATA(%d) on node %d\n", nid, tnid); + pr_info(" NODE_DATA(%d) on node %d\n", nid, tnid); node_data[nid] = nd; memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); @@ -238,8 +238,7 @@ static int __init numa_alloc_distance(void) numa_distance[i * numa_distance_cnt + j] = i == j ? LOCAL_DISTANCE : REMOTE_DISTANCE; - pr_debug("NUMA: Initialized distance table, cnt=%d\n", - numa_distance_cnt); + pr_debug("Initialized distance table, cnt=%d\n", numa_distance_cnt); return 0; } @@ -260,20 +259,20 @@ static int __init numa_alloc_distance(void) void __init numa_set_distance(int from, int to, int distance) { if (!numa_distance) { - pr_warn_once("NUMA: Warning: distance table not allocated yet\n"); + pr_warn_once("Warning: distance table not allocated yet\n"); return; } if (from >= numa_distance_cnt || to >= numa_distance_cnt || from < 0 || to < 0) { - pr_warn_once("NUMA: Warning: node ids are out of bound, from=%d to=%d distance=%d\n", + pr_warn_once("Warning: node ids are out of bound, from=%d to=%d distance=%d\n", from, to, distance); return; } if ((u8)distance != distance || (from == to && distance != LOCAL_DISTANCE)) { - pr_warn_once("NUMA: Warning: invalid distance parameter, from=%d to=%d distance=%d\n", + pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n", from, to, distance); return; } @@ -300,7 +299,7 @@ static int __init numa_register_nodes(void) /* Check that valid nid is set to memblks */ for_each_memblock(memory, mblk) if (mblk->nid == NUMA_NO_NODE || mblk->nid >= MAX_NUMNODES) { - pr_warn("NUMA: Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", + pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", mblk->nid, mblk->base, mblk->base + mblk->size - 1); return -EINVAL; @@ -371,9 +370,10 @@ static int __init dummy_numa_init(void) struct memblock_region *mblk; if (numa_off) - pr_info("NUMA disabled\n"); /* Forced off on command line. */ - pr_info("NUMA: Faking a node at [mem %#018Lx-%#018Lx]\n", - 0LLU, PFN_PHYS(max_pfn) - 1); + pr_warn("NUMA turned off by user\n"); /* Forced off on command line. */ + + pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n", + 0LLU, PFN_PHYS(max_pfn) - 1); for_each_memblock(memory, mblk) { ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size); -- 1.7.12.4 ^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-06-06 2:04 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-02 2:28 [PATCH v3 0/5] fix some type infos and bugs for arm64/of numa Zhen Lei 2016-06-02 2:28 ` [PATCH v3 1/5] of/numa: remove a duplicated pr_debug information Zhen Lei 2016-06-02 2:28 ` [PATCH v3 2/5] of/numa: fix a memory@ node can only contains one memory block Zhen Lei 2016-06-02 2:28 ` [PATCH v3 3/5] arm64/numa: add nid check for " Zhen Lei 2016-06-03 9:52 ` Will Deacon 2016-06-06 1:43 ` Leizhen (ThunderTown) 2016-06-02 2:28 ` [PATCH v3 4/5] of/numa: remove a duplicated warning Zhen Lei 2016-06-02 2:28 ` [PATCH v3 5/5] arm64/numa: avoid inconsistent information to be printed Zhen Lei 2016-06-03 9:55 ` Will Deacon 2016-06-06 2:04 ` Leizhen (ThunderTown) 2016-06-02 6:03 ` [PATCH 0/3] of: numa: cleanup Kefeng Wang 2016-06-02 6:03 ` [PATCH 1/3] of_numa: Use of_get_next_parent to simplify code Kefeng Wang 2016-06-02 6:03 ` [PATCH 2/3] of_numa: Use pr_fmt() Kefeng Wang 2016-06-02 6:03 ` [PATCH 3/3] arm64: numa: " Kefeng Wang
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).