Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1233721 > unrolled thread
| Started by | Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> |
|---|---|
| First post | 2015-09-27 20:30 +0200 |
| Last post | 2015-10-06 12:40 +0200 |
| Articles | 4 — 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.
[PATCH RFC 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> - 2015-09-27 20:30 +0200
Re: [PATCH RFC 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> - 2015-09-27 20:50 +0200
Re: [RFC, 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table Michael Ellerman <mpe@ellerman.id.au> - 2015-10-06 12:20 +0200
Re: [RFC, 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> - 2015-10-06 12:40 +0200
| From | Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-09-27 20:30 +0200 |
| Subject | [PATCH RFC 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table |
| Message-ID | <qdoRX-6G6-11@gated-at.bofh.it> |
We access numa_cpu_lookup_table array directly in all the places
to read/update numa cpu lookup information. Instead use a helper
function to update.
This is helpful in changing the way numa<-->cpu mapping in single
place when needed.
This is a cosmetic change, no change in functionality.
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.inet.ibm.com>
---
arch/powerpc/include/asm/mmzone.h | 2 +-
arch/powerpc/kernel/smp.c | 10 +++++-----
arch/powerpc/mm/numa.c | 28 +++++++++++++++++-----------
3 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index 7b58917..c24a5f4 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -29,7 +29,7 @@ extern struct pglist_data *node_data[];
* Following are specific to this numa platform.
*/
-extern int numa_cpu_lookup_table[];
+extern int numa_cpu_lookup(int cpu);
extern cpumask_var_t node_to_cpumask_map[];
#ifdef CONFIG_MEMORY_HOTPLUG
extern unsigned long max_pfn;
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index ec9ec20..56fbe9e 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -381,9 +381,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
* numa_node_id() works after this.
*/
if (cpu_present(cpu)) {
- set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
+ set_cpu_numa_node(cpu, numa_cpu_lookup(cpu));
set_cpu_numa_mem(cpu,
- local_memory_node(numa_cpu_lookup_table[cpu]));
+ local_memory_node(numa_cpu_lookup(cpu)));
}
}
@@ -400,7 +400,7 @@ void smp_prepare_boot_cpu(void)
#ifdef CONFIG_PPC64
paca[boot_cpuid].__current = current;
#endif
- set_numa_node(numa_cpu_lookup_table[boot_cpuid]);
+ set_numa_node(numa_cpu_lookup(boot_cpuid));
current_set[boot_cpuid] = task_thread_info(current);
}
@@ -718,8 +718,8 @@ void start_secondary(void *unused)
}
traverse_core_siblings(cpu, true);
- set_numa_node(numa_cpu_lookup_table[cpu]);
- set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
+ set_numa_node(numa_cpu_lookup(cpu));
+ set_numa_mem(local_memory_node(numa_cpu_lookup(cpu)));
smp_wmb();
notify_cpu_starting(cpu);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 8b9502a..d5e6eee 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -52,7 +52,6 @@ int numa_cpu_lookup_table[NR_CPUS];
cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
struct pglist_data *node_data[MAX_NUMNODES];
-EXPORT_SYMBOL(numa_cpu_lookup_table);
EXPORT_SYMBOL(node_to_cpumask_map);
EXPORT_SYMBOL(node_data);
@@ -134,19 +133,25 @@ static int __init fake_numa_create_new_node(unsigned long end_pfn,
return 0;
}
-static void reset_numa_cpu_lookup_table(void)
+int numa_cpu_lookup(int cpu)
{
- unsigned int cpu;
-
- for_each_possible_cpu(cpu)
- numa_cpu_lookup_table[cpu] = -1;
+ return numa_cpu_lookup_table[cpu];
}
+EXPORT_SYMBOL(numa_cpu_lookup);
-static void update_numa_cpu_lookup_table(unsigned int cpu, int node)
+static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node)
{
numa_cpu_lookup_table[cpu] = node;
}
+static void reset_numa_cpu_lookup_table(void)
+{
+ unsigned int cpu;
+
+ for_each_possible_cpu(cpu)
+ update_numa_cpu_lookup_table(cpu, -1);
+}
+
static void map_cpu_to_node(int cpu, int node)
{
update_numa_cpu_lookup_table(cpu, node);
@@ -160,7 +165,7 @@ static void map_cpu_to_node(int cpu, int node)
#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
static void unmap_cpu_from_node(unsigned long cpu)
{
- int node = numa_cpu_lookup_table[cpu];
+ int node = numa_cpu_lookup(cpu);
dbg("removing cpu %lu from node %d\n", cpu, node);
@@ -536,7 +541,8 @@ static int numa_setup_cpu(unsigned long lcpu)
* directly instead of querying the firmware, since it represents
* the most recent mapping notified to us by the platform (eg: VPHN).
*/
- if ((nid = numa_cpu_lookup_table[lcpu]) >= 0) {
+ nid = numa_cpu_lookup(lcpu);
+ if (nid >= 0) {
map_cpu_to_node(lcpu, nid);
return nid;
}
@@ -1413,7 +1419,7 @@ int arch_update_cpu_topology(void)
if (new_nid < 0 || !node_online(new_nid))
new_nid = first_online_node;
- if (new_nid == numa_cpu_lookup_table[cpu]) {
+ if (new_nid == numa_cpu_lookup(cpu)) {
cpumask_andnot(&cpu_associativity_changes_mask,
&cpu_associativity_changes_mask,
cpu_sibling_mask(cpu));
@@ -1425,7 +1431,7 @@ int arch_update_cpu_topology(void)
ud = &updates[i++];
ud->cpu = sibling;
ud->new_nid = new_nid;
- ud->old_nid = numa_cpu_lookup_table[sibling];
+ ud->old_nid = numa_cpu_lookup(sibling);
cpumask_set_cpu(sibling, &updated_cpus);
if (i < weight)
ud->next = &updates[i];
--
1.7.11.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-09-27 20:50 +0200 |
| Subject | Re: [PATCH RFC 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table |
| Message-ID | <qdpbj-73i-9@gated-at.bofh.it> |
| In reply to | #1233721 |
On 09/27/2015 11:59 PM, Raghavendra K T wrote:
> We access numa_cpu_lookup_table array directly in all the places
> to read/update numa cpu lookup information. Instead use a helper
> function to update.
>
> This is helpful in changing the way numa<-->cpu mapping in single
> place when needed.
>
> This is a cosmetic change, no change in functionality.
>
> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.inet.ibm.com>
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
> ---
Sorry: changelog edit messed it.. :(
> arch/powerpc/include/asm/mmzone.h | 2 +-
> arch/powerpc/kernel/smp.c | 10 +++++-----
> arch/powerpc/mm/numa.c | 28 +++++++++++++++++-----------
> 3 files changed, 23 insertions(+), 17 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
> index 7b58917..c24a5f4 100644
> --- a/arch/powerpc/include/asm/mmzone.h
> +++ b/arch/powerpc/include/asm/mmzone.h
> @@ -29,7 +29,7 @@ extern struct pglist_data *node_data[];
> * Following are specific to this numa platform.
> */
>
> -extern int numa_cpu_lookup_table[];
> +extern int numa_cpu_lookup(int cpu);
> extern cpumask_var_t node_to_cpumask_map[];
> #ifdef CONFIG_MEMORY_HOTPLUG
> extern unsigned long max_pfn;
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index ec9ec20..56fbe9e 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -381,9 +381,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
> * numa_node_id() works after this.
> */
> if (cpu_present(cpu)) {
> - set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
> + set_cpu_numa_node(cpu, numa_cpu_lookup(cpu));
> set_cpu_numa_mem(cpu,
> - local_memory_node(numa_cpu_lookup_table[cpu]));
> + local_memory_node(numa_cpu_lookup(cpu)));
> }
> }
>
> @@ -400,7 +400,7 @@ void smp_prepare_boot_cpu(void)
> #ifdef CONFIG_PPC64
> paca[boot_cpuid].__current = current;
> #endif
> - set_numa_node(numa_cpu_lookup_table[boot_cpuid]);
> + set_numa_node(numa_cpu_lookup(boot_cpuid));
> current_set[boot_cpuid] = task_thread_info(current);
> }
>
> @@ -718,8 +718,8 @@ void start_secondary(void *unused)
> }
> traverse_core_siblings(cpu, true);
>
> - set_numa_node(numa_cpu_lookup_table[cpu]);
> - set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
> + set_numa_node(numa_cpu_lookup(cpu));
> + set_numa_mem(local_memory_node(numa_cpu_lookup(cpu)));
>
> smp_wmb();
> notify_cpu_starting(cpu);
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 8b9502a..d5e6eee 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -52,7 +52,6 @@ int numa_cpu_lookup_table[NR_CPUS];
> cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
> struct pglist_data *node_data[MAX_NUMNODES];
>
> -EXPORT_SYMBOL(numa_cpu_lookup_table);
> EXPORT_SYMBOL(node_to_cpumask_map);
> EXPORT_SYMBOL(node_data);
>
> @@ -134,19 +133,25 @@ static int __init fake_numa_create_new_node(unsigned long end_pfn,
> return 0;
> }
>
> -static void reset_numa_cpu_lookup_table(void)
> +int numa_cpu_lookup(int cpu)
> {
> - unsigned int cpu;
> -
> - for_each_possible_cpu(cpu)
> - numa_cpu_lookup_table[cpu] = -1;
> + return numa_cpu_lookup_table[cpu];
> }
> +EXPORT_SYMBOL(numa_cpu_lookup);
>
> -static void update_numa_cpu_lookup_table(unsigned int cpu, int node)
> +static inline void update_numa_cpu_lookup_table(unsigned int cpu, int node)
> {
> numa_cpu_lookup_table[cpu] = node;
> }
>
> +static void reset_numa_cpu_lookup_table(void)
> +{
> + unsigned int cpu;
> +
> + for_each_possible_cpu(cpu)
> + update_numa_cpu_lookup_table(cpu, -1);
> +}
> +
> static void map_cpu_to_node(int cpu, int node)
> {
> update_numa_cpu_lookup_table(cpu, node);
> @@ -160,7 +165,7 @@ static void map_cpu_to_node(int cpu, int node)
> #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
> static void unmap_cpu_from_node(unsigned long cpu)
> {
> - int node = numa_cpu_lookup_table[cpu];
> + int node = numa_cpu_lookup(cpu);
>
> dbg("removing cpu %lu from node %d\n", cpu, node);
>
> @@ -536,7 +541,8 @@ static int numa_setup_cpu(unsigned long lcpu)
> * directly instead of querying the firmware, since it represents
> * the most recent mapping notified to us by the platform (eg: VPHN).
> */
> - if ((nid = numa_cpu_lookup_table[lcpu]) >= 0) {
> + nid = numa_cpu_lookup(lcpu);
> + if (nid >= 0) {
> map_cpu_to_node(lcpu, nid);
> return nid;
> }
> @@ -1413,7 +1419,7 @@ int arch_update_cpu_topology(void)
> if (new_nid < 0 || !node_online(new_nid))
> new_nid = first_online_node;
>
> - if (new_nid == numa_cpu_lookup_table[cpu]) {
> + if (new_nid == numa_cpu_lookup(cpu)) {
> cpumask_andnot(&cpu_associativity_changes_mask,
> &cpu_associativity_changes_mask,
> cpu_sibling_mask(cpu));
> @@ -1425,7 +1431,7 @@ int arch_update_cpu_topology(void)
> ud = &updates[i++];
> ud->cpu = sibling;
> ud->new_nid = new_nid;
> - ud->old_nid = numa_cpu_lookup_table[sibling];
> + ud->old_nid = numa_cpu_lookup(sibling);
> cpumask_set_cpu(sibling, &updated_cpus);
> if (i < weight)
> ud->next = &updates[i];
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2015-10-06 12:20 +0200 |
| Subject | Re: [RFC, 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table |
| Message-ID | <qgxvH-3bO-7@gated-at.bofh.it> |
| In reply to | #1233721 |
On Sun, 2015-27-09 at 18:29:09 UTC, Raghavendra K T wrote:
> We access numa_cpu_lookup_table array directly in all the places
> to read/update numa cpu lookup information. Instead use a helper
> function to update.
>
> This is helpful in changing the way numa<-->cpu mapping in single
> place when needed.
>
> This is a cosmetic change, no change in functionality.
>
> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.inet.ibm.com>
> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
> ---
> arch/powerpc/include/asm/mmzone.h | 2 +-
> arch/powerpc/kernel/smp.c | 10 +++++-----
> arch/powerpc/mm/numa.c | 28 +++++++++++++++++-----------
> 3 files changed, 23 insertions(+), 17 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
> index 7b58917..c24a5f4 100644
> --- a/arch/powerpc/include/asm/mmzone.h
> +++ b/arch/powerpc/include/asm/mmzone.h
> @@ -29,7 +29,7 @@ extern struct pglist_data *node_data[];
> * Following are specific to this numa platform.
> */
>
> -extern int numa_cpu_lookup_table[];
> +extern int numa_cpu_lookup(int cpu);
Can you rename it better :)
Something like cpu_to_nid().
Although maybe nid is wrong given the rest of the series.
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 8b9502a..d5e6eee 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -52,7 +52,6 @@ int numa_cpu_lookup_table[NR_CPUS];
> cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
> struct pglist_data *node_data[MAX_NUMNODES];
>
> -EXPORT_SYMBOL(numa_cpu_lookup_table);
> EXPORT_SYMBOL(node_to_cpumask_map);
> EXPORT_SYMBOL(node_data);
>
> @@ -134,19 +133,25 @@ static int __init fake_numa_create_new_node(unsigned long end_pfn,
> return 0;
> }
>
> -static void reset_numa_cpu_lookup_table(void)
> +int numa_cpu_lookup(int cpu)
> {
> - unsigned int cpu;
> -
> - for_each_possible_cpu(cpu)
> - numa_cpu_lookup_table[cpu] = -1;
> + return numa_cpu_lookup_table[cpu];
> }
> +EXPORT_SYMBOL(numa_cpu_lookup);
I don't see you changing any modular code that uses this, or any macros that
might be used by modules, so I don't see why this needs to be exported?
I think you just added it because num_cpu_lookup_table was exported?
cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-10-06 12:40 +0200 |
| Subject | Re: [RFC, 1/5] powerpc:numa Add numa_cpu_lookup function to update lookup table |
| Message-ID | <qgxP4-3ym-19@gated-at.bofh.it> |
| In reply to | #1240341 |
On 10/06/2015 03:47 PM, Michael Ellerman wrote:
> On Sun, 2015-27-09 at 18:29:09 UTC, Raghavendra K T wrote:
>> We access numa_cpu_lookup_table array directly in all the places
>> to read/update numa cpu lookup information. Instead use a helper
>> function to update.
>>
>> This is helpful in changing the way numa<-->cpu mapping in single
>> place when needed.
>>
>> This is a cosmetic change, no change in functionality.
>>
>> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.inet.ibm.com>
>> Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/include/asm/mmzone.h | 2 +-
>> arch/powerpc/kernel/smp.c | 10 +++++-----
>> arch/powerpc/mm/numa.c | 28 +++++++++++++++++-----------
>> 3 files changed, 23 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
>> index 7b58917..c24a5f4 100644
>> --- a/arch/powerpc/include/asm/mmzone.h
>> +++ b/arch/powerpc/include/asm/mmzone.h
>> @@ -29,7 +29,7 @@ extern struct pglist_data *node_data[];
>> * Following are specific to this numa platform.
>> */
>>
>> -extern int numa_cpu_lookup_table[];
>> +extern int numa_cpu_lookup(int cpu);
>
> Can you rename it better :)
>
> Something like cpu_to_nid().
Good name. sure.
>
> Although maybe nid is wrong given the rest of the series.
May be not. The current plan is to rename (after discussing with Nish)
chipid to pnid (physical nid)
and nid to vnid (virtual nid)
within powerpc numa.c
[reasoning chipid is applicable only to OPAL, since we want to handle
powerkvm, powervm and baremetal we need a generic name ]
But 'nid' naming will be retained which is applicable for generic
kernel interactions.
>
>> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
>> index 8b9502a..d5e6eee 100644
>> --- a/arch/powerpc/mm/numa.c
>> +++ b/arch/powerpc/mm/numa.c
>> @@ -52,7 +52,6 @@ int numa_cpu_lookup_table[NR_CPUS];
>> cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
>> struct pglist_data *node_data[MAX_NUMNODES];
>>
>> -EXPORT_SYMBOL(numa_cpu_lookup_table);
>> EXPORT_SYMBOL(node_to_cpumask_map);
>> EXPORT_SYMBOL(node_data);
>>
>> @@ -134,19 +133,25 @@ static int __init fake_numa_create_new_node(unsigned long end_pfn,
>> return 0;
>> }
>>
>> -static void reset_numa_cpu_lookup_table(void)
>> +int numa_cpu_lookup(int cpu)
>> {
>> - unsigned int cpu;
>> -
>> - for_each_possible_cpu(cpu)
>> - numa_cpu_lookup_table[cpu] = -1;
>> + return numa_cpu_lookup_table[cpu];
>> }
>> +EXPORT_SYMBOL(numa_cpu_lookup);
>
> I don't see you changing any modular code that uses this, or any macros that
> might be used by modules, so I don't see why this needs to be exported?
>
> I think you just added it because num_cpu_lookup_table was exported?
>
arch/powerpc/kernel/smp.c uses it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web