All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: Allow modules to read cpu_logical_map
@ 2013-02-08 12:19 Dave Martin
  2013-02-08 12:26 ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Martin @ 2013-02-08 12:19 UTC (permalink / raw)
  To: linux-arm-kernel

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

This patch exports a new function cpu_get_hwid(cpu) to provide
suitable read-only access outside vmlinux.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
Modules using this function will be arch-dependent and highly coupled to
the kernel, so cpu_get_hwid() shouldn't be considered a stable API,
especially while the details of kernel topology awareness are still
under discussion: therefore, export only to GPL code for now.

 arch/arm/include/asm/smp_plat.h |    3 +++
 arch/arm/kernel/setup.c         |    7 +++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index aaa61b6..518e466 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -66,4 +66,7 @@ static inline int get_logical_index(u32 mpidr)
 	return -EINVAL;
 }
 
+/* Read-only accessor for use by modules: */
+int cpu_get_hwid(int cpu);
+
 #endif
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 3f6cbb2..1ac5e8b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -429,6 +429,13 @@ void cpu_init(void)
 
 int __cpu_logical_map[NR_CPUS];
 
+/* Read-only accessor for use by modules: */
+int cpu_get_hwid(int cpu)
+{
+	return cpu_logical_map(cpu);
+}
+EXPORT_SYMBOL_GPL(cpu_get_hwid);
+
 void __init smp_setup_processor_id(void)
 {
 	int i;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] ARM: Allow modules to read cpu_logical_map
  2013-02-08 12:19 [PATCH] ARM: Allow modules to read cpu_logical_map Dave Martin
@ 2013-02-08 12:26 ` Russell King - ARM Linux
  2013-02-08 14:32   ` Dave Martin
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2013-02-08 12:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 08, 2013 at 12:19:40PM +0000, Dave Martin wrote:
> It is reasonable for loadable modules to be CPU topology aware
> (particular examples include cpufreq and cpuidle drivers).
> 
> This patch exports a new function cpu_get_hwid(cpu) to provide
> suitable read-only access outside vmlinux.

And we have an export with no user... where are the patches which
illustrate its usage?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ARM: Allow modules to read cpu_logical_map
  2013-02-08 12:26 ` Russell King - ARM Linux
@ 2013-02-08 14:32   ` Dave Martin
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Martin @ 2013-02-08 14:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 08, 2013 at 12:26:04PM +0000, Russell King - ARM Linux wrote:
> On Fri, Feb 08, 2013 at 12:19:40PM +0000, Dave Martin wrote:
> > It is reasonable for loadable modules to be CPU topology aware
> > (particular examples include cpufreq and cpuidle drivers).
> > 
> > This patch exports a new function cpu_get_hwid(cpu) to provide
> > suitable read-only access outside vmlinux.
> 
> And we have an export with no user... where are the patches which
> illustrate its usage?

That's a fair point.

The background is that ARM have an out-of-tree profiling driver,
which may need to look at cpu_logical_map in the presence of the
big.LITTLE in-kernel switcher code.

Although there is no in-tree code using this yet, the usage seems
legitimate.

If there are outstanding concerns about this, this patch could stay
out-of-tree too, but said driver would only work with a modified
kernel in that case.

If this is not considered relevant to the kernel proper yet, then
it could be posted via the big.LITTLE in-kernel switcher series
when those are finally published, since it is this that causes
cpu_logical_map to change in ways that a few specialised drivers
may need to respond to.  Without the switcher, no code should need
to look at cpu_logical_map (the present situation).

(Nico, please shout if you have any concerns about that approach.)

Cheers
---Dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-08 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08 12:19 [PATCH] ARM: Allow modules to read cpu_logical_map Dave Martin
2013-02-08 12:26 ` Russell King - ARM Linux
2013-02-08 14:32   ` Dave Martin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.