Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1354079 > unrolled thread

Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk()

Started byRobert Richter <robert.richter@caviumnetworks.com>
First post2016-03-09 13:30 +0100
Last post2016-03-10 11:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Robert Richter <robert.richter@caviumnetworks.com> - 2016-03-09 13:30 +0100
    Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk() Hanjun Guo <hanjun.guo@linaro.org> - 2016-03-10 11:20 +0100

#1354079 — Re: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk()

FromRobert Richter <robert.richter@caviumnetworks.com>
Date2016-03-09 13:30 +0100
SubjectRe: [PATCH v3 08/12] arm64, numa: rework numa_add_memblk()
Message-ID<raLpw-7PW-21@gated-at.bofh.it>
On 23.01.16 17:39:23, Hanjun Guo wrote:
> From: Hanjun Guo <hanjun.guo@linaro.org>
> 
> Rework numa_add_memblk() to update the parameter "u64 size"
> to "u64 end", this will make it consistent with x86 and
> can simplify the code later.
> 
> Updates for arch/arm64/mm/numa.c should squash to core NUMA
> patches from Ganapat.
> 
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  arch/arm64/kernel/acpi_numa.c |  2 +-
>  arch/arm64/kernel/of_numa.c   |  2 +-
>  arch/arm64/mm/numa.c          | 12 ++++++------
>  3 files changed, 8 insertions(+), 8 deletions(-)

> diff --git a/arch/arm64/kernel/of_numa.c b/arch/arm64/kernel/of_numa.c
> index 2f9e34b..aa6f3a3 100644
> --- a/arch/arm64/kernel/of_numa.c
> +++ b/arch/arm64/kernel/of_numa.c
> @@ -168,7 +168,7 @@ static int __init early_init_parse_memory_node(unsigned long node)
>  		pr_debug("NUMA-DT:  base = %llx , node = %u\n",
>  				base, nid);
>  
> -		if (numa_add_memblk(nid, base, size) < 0)
> +		if (numa_add_memblk(nid, base, base + size) < 0)
>  			return -EINVAL;
>  	}
>  
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index e974995..2b04b8a 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -137,25 +137,25 @@ void numa_store_cpu_info(unsigned int cpu)
>   * numa_add_memblk - Set node id to memblk
>   * @nid: NUMA node ID of the new memblk
>   * @start: Start address of the new memblk
> - * @size:  Size of the new memblk
> + * @end:  End address of the new memblk

Apart from my earlier comment, this is not exactly correct and may
cause confussion. The implementation here defines:

 size == end - start

which is different to struct resource, where:

 resource_size(res) == res->end - res->start + 1

Thus, @end here is the first address outside of memblk.

This is one more argument for keeping @size here.

-Robert

>   *
>   * RETURNS:
>   * 0 on success, -errno on failure.
>   */
> -int __init numa_add_memblk(int nid, u64 start, u64 size)
> +int __init numa_add_memblk(int nid, u64 start, u64 end)
>  {
>  	int ret;
>  
> -	ret = memblock_set_node(start, size, &memblock.memory, nid);
> +	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",
> -			start, (start + size - 1), nid);
> +			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",
> -			start, (start + size - 1), nid);
> +			start, (end - 1), nid);
>  	return ret;
>  }

[toc] | [next] | [standalone]


#1354981

FromHanjun Guo <hanjun.guo@linaro.org>
Date2016-03-10 11:20 +0100
Message-ID<rb5Rg-5xH-41@gated-at.bofh.it>
In reply to#1354079
Hi Robert,

On 03/09/2016 08:27 PM, Robert Richter wrote:
> On 23.01.16 17:39:23, Hanjun Guo wrote:
>> From: Hanjun Guo <hanjun.guo@linaro.org>
>>
>> Rework numa_add_memblk() to update the parameter "u64 size"
>> to "u64 end", this will make it consistent with x86 and
>> can simplify the code later.
>>
>> Updates for arch/arm64/mm/numa.c should squash to core NUMA
>> patches from Ganapat.
>>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> ---
>>   arch/arm64/kernel/acpi_numa.c |  2 +-
>>   arch/arm64/kernel/of_numa.c   |  2 +-
>>   arch/arm64/mm/numa.c          | 12 ++++++------
>>   3 files changed, 8 insertions(+), 8 deletions(-)
>
>> diff --git a/arch/arm64/kernel/of_numa.c b/arch/arm64/kernel/of_numa.c
>> index 2f9e34b..aa6f3a3 100644
>> --- a/arch/arm64/kernel/of_numa.c
>> +++ b/arch/arm64/kernel/of_numa.c
>> @@ -168,7 +168,7 @@ static int __init early_init_parse_memory_node(unsigned long node)
>>   		pr_debug("NUMA-DT:  base = %llx , node = %u\n",
>>   				base, nid);
>>
>> -		if (numa_add_memblk(nid, base, size) < 0)
>> +		if (numa_add_memblk(nid, base, base + size) < 0)
>>   			return -EINVAL;
>>   	}
>>
>> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
>> index e974995..2b04b8a 100644
>> --- a/arch/arm64/mm/numa.c
>> +++ b/arch/arm64/mm/numa.c
>> @@ -137,25 +137,25 @@ void numa_store_cpu_info(unsigned int cpu)
>>    * numa_add_memblk - Set node id to memblk
>>    * @nid: NUMA node ID of the new memblk
>>    * @start: Start address of the new memblk
>> - * @size:  Size of the new memblk
>> + * @end:  End address of the new memblk
>
> Apart from my earlier comment, this is not exactly correct and may
> cause confussion. The implementation here defines:
>
>   size == end - start
>
> which is different to struct resource, where:
>
>   resource_size(res) == res->end - res->start + 1
>
> Thus, @end here is the first address outside of memblk.
>
> This is one more argument for keeping @size here.

I agree :)

I'm working on the new version and met the problem of no
definition for numa_add_memblk() and numa_set_distance()
on IA64, numa_set_distance() seems to easy to add one for
IA64, but numa_add_memblk() is not, this will the blocker
for moving functions to common place, what's your opinion
here?

Also I'm thinking to move all the code in arch/arm64/kernel/acpi_numa.c
to the arch/arm64/kernel/acpi.c to make the ACPI code in ARM64
self-contained, what do you think?

Thanks
Hanjun

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web