Skip to contentSkip to conversation

ARM: Export the CPU logical map to modules

RFC PATCH New Dave Martin 2 participants 4 messages Jan 28, 2013 – Feb 8, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 ARM: Export the CPU logical map to modules

It is reasonable for loadable modules to be CPU topology aware (particular examples include cpufreq and cpuidle drivers).

This patch exports __cpu_logical_map, so that modules can use the cpu_logical_map() interface declared in <asm/smp_plat.h>.

---
If anyone has a strong view on whether this should be EXPORT_SYMBOL_GPL(), I don't have a problem with changing that. I'm not sure of the precise etiquette here. Certainly this does not feel like a very "public" interface.

Perhaps we should wrap this in a real function for export to modules, rather than encouraging them to poke the __cpu_logical_map[] array (albeit via a predefined macro).

 arch/arm/kernel/setup.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/kernel/setup.c +1 -0
index 3f6cbb2..1b9e5bf 100644
@@ -428,6 +428,7 @@ void cpu_init(void)
 }
 
 int __cpu_logical_map[NR_CPUS];
+EXPORT_SYMBOL(__cpu_logical_map);
 
 void __init smp_setup_processor_id(void)
 {
Signature · 1 line
1.7.4.1
#1 lore raw

RFC PATCH 1/1 ARM: Export the CPU logical map to modules

Hi,

Does anyone have a comment on this?

Cheers
---Dave

Quoted 36 lines · Dave Martin

It is reasonable for loadable modules to be CPU topology aware (particular examples include cpufreq and cpuidle drivers).

This patch exports __cpu_logical_map, so that modules can use the cpu_logical_map() interface declared in <asm/smp_plat.h>.

---
If anyone has a strong view on whether this should be EXPORT_SYMBOL_GPL(), I don't have a problem with changing that. I'm not sure of the precise etiquette here. Certainly this does not feel like a very "public" interface.

Perhaps we should wrap this in a real function for export to modules, rather than encouraging them to poke the __cpu_logical_map[] array (albeit via a predefined macro).

 arch/arm/kernel/setup.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/kernel/setup.c +1 -0
index 3f6cbb2..1b9e5bf 100644
@@ -428,6 +428,7 @@ void cpu_init(void)
 }
 
 int __cpu_logical_map[NR_CPUS];
+EXPORT_SYMBOL(__cpu_logical_map);
 
 void __init smp_setup_processor_id(void)
 {
Signature · 1 line
1.7.4.1
#2 lore raw

RFC PATCH 1/1 ARM: Export the CPU logical map to modules

Quoted 3 lines · Dave Martin

Hi,

Does anyone have a comment on this?

As you say, I'd be tempted to export some accessor with well defined semantic meaning instead.

Quoted 42 lines

Cheers
---Dave

Quoted 36 lines · Dave Martin

It is reasonable for loadable modules to be CPU topology aware (particular examples include cpufreq and cpuidle drivers).

This patch exports __cpu_logical_map, so that modules can use the cpu_logical_map() interface declared in <asm/smp_plat.h>.

---
If anyone has a strong view on whether this should be EXPORT_SYMBOL_GPL(), I don't have a problem with changing that. I'm not sure of the precise etiquette here. Certainly this does not feel like a very "public" interface.

Perhaps we should wrap this in a real function for export to modules, rather than encouraging them to poke the __cpu_logical_map[] array (albeit via a predefined macro).

 arch/arm/kernel/setup.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/kernel/setup.c +1 -0
index 3f6cbb2..1b9e5bf 100644
@@ -428,6 +428,7 @@ void cpu_init(void)
 }
 
 int __cpu_logical_map[NR_CPUS];
+EXPORT_SYMBOL(__cpu_logical_map);
 
 void __init smp_setup_processor_id(void)
 {
Signature · 1 line
1.7.4.1
#3 lore raw

RFC PATCH 1/1 ARM: Export the CPU logical map to modules

Quoted 8 lines · Nicolas Pitre
Quoted 3 lines · Dave Martin

Hi,

Does anyone have a comment on this?

As you say, I'd be tempted to export some accessor with well defined semantic meaning instead.

I think I agree...

Modules definitely shouldn't easily be able to write cpu_logical_map.

I'll rework something and repost.

Cheers
---Dave

Quoted 45 lines
Quoted 45 lines

Cheers
---Dave

Quoted 36 lines · Dave Martin

It is reasonable for loadable modules to be CPU topology aware (particular examples include cpufreq and cpuidle drivers).

This patch exports __cpu_logical_map, so that modules can use the cpu_logical_map() interface declared in <asm/smp_plat.h>.

---
If anyone has a strong view on whether this should be EXPORT_SYMBOL_GPL(), I don't have a problem with changing that. I'm not sure of the precise etiquette here. Certainly this does not feel like a very "public" interface.

Perhaps we should wrap this in a real function for export to modules, rather than encouraging them to poke the __cpu_logical_map[] array (albeit via a predefined macro).

 arch/arm/kernel/setup.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/kernel/setup.c +1 -0
index 3f6cbb2..1b9e5bf 100644
@@ -428,6 +428,7 @@ void cpu_init(void)
 }
 
 int __cpu_logical_map[NR_CPUS];
+EXPORT_SYMBOL(__cpu_logical_map);
 
 void __init smp_setup_processor_id(void)
 {
Signature · 1 line
1.7.4.1