Thread (12 messages) flat view 12 messages, 6 authors, 2016-05-27

[PATCH 2/3] of/numa: fix a memory@ dt node can only contains one memory block

From: David Daney <hidden>
Date: 2016-05-27 16:22:29
Also in: linux-devicetree, lkml

On 05/26/2016 08:36 PM, Leizhen (ThunderTown) wrote:
[...]		continue;
Hi, everybody:
     If some "memory" node contains "numa-node-id", but some others missed. Can we simply ignored it?
I think we should break out too, and faking to only have node0.

I think if some "memory" nodes contain "numa-node-id" and others do not, 
then you have a defective device tree.  In this case I think we must 
continue with the existing behavior, and indicate failure.  This will 
cause the architecture specific NUMA code to disable NUMA and force 
everything onto a singl pseudo-NUMA-node.

I doubt there is anything to be gained by guessing which NUMA node 
orphaned "memory" nodes belong to.
quoted
		else if (r)
			/* some other error */
			break;

		r = of_address_to_resource(np, 0, &rsrc);
		for (i = 0; !r; i++, r = of_address_to_resource(np, i,
But r(non-zero) is just break this loop, the original is break the outer for (;;) loop

How about as below?

	for_each_node_by_type(np, "memory") {
		... ...

		for (i = 0; !of_address_to_resource(np, i, &rsrc); i++) {
                         r = numa_add_memblk(nid, rsrc.start,
                                             rsrc.end - rsrc.start + 1);
                         if (r)
                                 goto finished;
                 }

		if (!i)
			pr_err("NUMA: bad reg property in memory node\n");
	}

finished:
	
quoted
&rsrc)) {
			r = numa_add_memblk(nid, rsrc.start,
				    rsrc.end - rsrc.start + 1);
		}
	}
	of_node_put(np);

	return r;


Perhaps with a "if (!i && r) pr_err()" for an error message at the end.

Rob

.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help