[RFC patch] powerpc: Add topology_ready to machdep calls

STALE6418d

5 messages, 2 authors, 2009-02-12 · open the first message on its own page

[RFC patch] powerpc: Add topology_ready to machdep calls

From: Geoff Levand <hidden>
Date: 2009-02-11 23:30:09

Add a new member topology_ready to the powerpc machdep_calls
structure.

The NUMA hot plug memory routines require the NUMA node to have
been registered via register_one_node() prior to adding memory
to the node.  The powerpc arch registers NUMA nodes during
startup in its topology_init() routine.

Currently, there is no mechanism for the platform code to know
when the nodes have been registered, and hence, when it is safe
to add hot plug memory.

Signed-off-by: Geoff Levand <redacted>
---
 arch/powerpc/include/asm/machdep.h |    1 +
 arch/powerpc/kernel/sysfs.c        |    3 +++
 2 files changed, 4 insertions(+)
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -106,6 +106,7 @@ struct machdep_calls {
 	void		(*setup_arch)(void); /* Optional, may be NULL */
 	void		(*init_early)(void);
 	/* Optional, may be NULL. */
+	void		(*topology_ready)(void); /* Optional, may be NULL */
 	void		(*show_cpuinfo)(struct seq_file *m);
 	void		(*show_percpuinfo)(struct seq_file *m, int i);
 
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -647,6 +647,9 @@ static int __init topology_init(void)
 			register_cpu_online(cpu);
 	}
 
+	if (ppc_md.topology_ready)
+		ppc_md.topology_ready();
+
 	return 0;
 }
 subsys_initcall(topology_init);

[RFC patch] powerpc/ps3: Add ps3_topology_ready routine

From: Geoff Levand <hidden>
Date: 2009-02-11 23:31:19

Switch the PS3 hotplug memory routine ps3_mm_add_memory() from
being a core_initcall routine to being called via the new
topology_ready powerpc machdep call.

core_initcall routines run before the powerpc topology_init()
startup routine, resulting in failure of ps3_mm_add_memory()
when CONFIG_NUMA=y.

Signed-off-by: Geoff Levand <redacted>
---
 arch/powerpc/platforms/ps3/mm.c       |    4 +---
 arch/powerpc/platforms/ps3/platform.h |    1 +
 arch/powerpc/platforms/ps3/setup.c    |    6 ++++++
 3 files changed, 8 insertions(+), 3 deletions(-)
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -289,7 +289,7 @@ static void ps3_mm_region_destroy(struct
  * ps3_mm_add_memory - hot add memory
  */
 
-static int __init ps3_mm_add_memory(void)
+int __init ps3_mm_add_memory(void)
 {
 	int result;
 	unsigned long start_addr;
@@ -328,8 +328,6 @@ static int __init ps3_mm_add_memory(void
 	return result;
 }
 
-core_initcall(ps3_mm_add_memory);
-
 /*============================================================================*/
 /* dma routines                                                               */
 /*============================================================================*/
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -37,6 +37,7 @@ void __init ps3_mm_init(void);
 void __init ps3_mm_vas_create(unsigned long* htab_size);
 void ps3_mm_vas_destroy(void);
 void ps3_mm_shutdown(void);
+int __init ps3_mm_add_memory(void);
 
 /* irq */
 
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -249,6 +249,11 @@ static int __init ps3_probe(void)
 	return 1;
 }
 
+static void __init ps3_topology_ready(void)
+{
+	ps3_mm_add_memory();
+}
+
 #if defined(CONFIG_KEXEC)
 static void ps3_kexec_cpu_down(int crash_shutdown, int secondary)
 {
@@ -267,6 +272,7 @@ define_machine(ps3) {
 	.name				= "PS3",
 	.probe				= ps3_probe,
 	.setup_arch			= ps3_setup_arch,
+	.topology_ready			= ps3_topology_ready,
 	.init_IRQ			= ps3_init_IRQ,
 	.panic				= ps3_panic,
 	.get_boot_time			= ps3_get_boot_time,

Re: [RFC patch] powerpc: Add topology_ready to machdep calls

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2009-02-12 04:21:09

On Wed, 2009-02-11 at 15:30 -0800, Geoff Levand wrote:
Add a new member topology_ready to the powerpc machdep_calls
structure.

The NUMA hot plug memory routines require the NUMA node to have
been registered via register_one_node() prior to adding memory
to the node.  The powerpc arch registers NUMA nodes during
startup in its topology_init() routine.

Currently, there is no mechanism for the platform code to know
when the nodes have been registered, and hence, when it is safe
to add hot plug memory.
No objection other than the confusion with the /* Optional may be NULL
*/ comment above the line you added that becomes weirdly placed since
it applies, I think, to show_cpuinfo.

Cheers,
Ben.
quoted hunk
Signed-off-by: Geoff Levand <redacted>
---
 arch/powerpc/include/asm/machdep.h |    1 +
 arch/powerpc/kernel/sysfs.c        |    3 +++
 2 files changed, 4 insertions(+)
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -106,6 +106,7 @@ struct machdep_calls {
 	void		(*setup_arch)(void); /* Optional, may be NULL */
 	void		(*init_early)(void);
 	/* Optional, may be NULL. */
+	void		(*topology_ready)(void); /* Optional, may be NULL */
 	void		(*show_cpuinfo)(struct seq_file *m);
 	void		(*show_percpuinfo)(struct seq_file *m, int i);
 
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -647,6 +647,9 @@ static int __init topology_init(void)
 			register_cpu_online(cpu);
 	}
 
+	if (ppc_md.topology_ready)
+		ppc_md.topology_ready();
+
 	return 0;
 }
 subsys_initcall(topology_init);

Re: [RFC patch] powerpc: Add topology_ready to machdep calls

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2009-02-12 04:21:59

On Wed, 2009-02-11 at 15:30 -0800, Geoff Levand wrote:
Add a new member topology_ready to the powerpc machdep_calls
structure.

The NUMA hot plug memory routines require the NUMA node to have
been registered via register_one_node() prior to adding memory
to the node.  The powerpc arch registers NUMA nodes during
startup in its topology_init() routine.
Just a question.. what's wrong with just using some later kind of
initcall ? You want to get the memory added as early as possible ?

Cheers,
Ben.

[patch] powerpc/ps3: Move ps3_mm_add_memory to device_initcall

From: Geoff Levand <hidden>
Date: 2009-02-12 22:36:16

Change the PS3 hotplug memory routine ps3_mm_add_memory() from
a core_initcall to a device_initcall.

core_initcall routines run before the powerpc topology_init()
startup routine, which is a subsys_initcall, resulting in
failure of ps3_mm_add_memory() when CONFIG_NUMA=y.  When
ps3_mm_add_memory() fails the system will boot with just the
128 MiB of boot memory 

Signed-off-by: Geoff Levand <redacted>
---
Ben,

Please send upstream for 2.6.29, as this effects the current
Fedora 11 development kernel, and maybe other distros which
are based on 2.6.29.

 arch/powerpc/platforms/ps3/mm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -328,7 +328,7 @@ static int __init ps3_mm_add_memory(void
 	return result;
 }
 
-core_initcall(ps3_mm_add_memory);
+device_initcall(ps3_mm_add_memory);
 
 /*============================================================================*/
 /* dma routines                                                               */
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help