All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC patch] powerpc: Add topology_ready to machdep calls
@ 2009-02-11 23:30 Geoff Levand
  2009-02-11 23:31 ` [RFC patch] powerpc/ps3: Add ps3_topology_ready routine Geoff Levand
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Geoff Levand @ 2009-02-11 23:30 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linuxppc-dev

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 <geoffrey.levand@am.sony.com>
---
 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);

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

* [RFC patch] powerpc/ps3: Add ps3_topology_ready routine
  2009-02-11 23:30 [RFC patch] powerpc: Add topology_ready to machdep calls Geoff Levand
@ 2009-02-11 23:31 ` Geoff Levand
  2009-02-12  4:21 ` [RFC patch] powerpc: Add topology_ready to machdep calls Benjamin Herrenschmidt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Geoff Levand @ 2009-02-11 23:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linuxppc-dev

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 <geoffrey.levand@am.sony.com>
---
 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,

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

* Re: [RFC patch] powerpc: Add topology_ready to machdep calls
  2009-02-11 23:30 [RFC patch] powerpc: Add topology_ready to machdep calls Geoff Levand
  2009-02-11 23:31 ` [RFC patch] powerpc/ps3: Add ps3_topology_ready routine Geoff Levand
@ 2009-02-12  4:21 ` Benjamin Herrenschmidt
  2009-02-12  4:21 ` Benjamin Herrenschmidt
  2009-02-12 22:36 ` [patch] powerpc/ps3: Move ps3_mm_add_memory to device_initcall Geoff Levand
  3 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2009-02-12  4:21 UTC (permalink / raw)
  To: Geoff Levand; +Cc: Linuxppc-dev

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.

> Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
> ---
>  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);
> 

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

* Re: [RFC patch] powerpc: Add topology_ready to machdep calls
  2009-02-11 23:30 [RFC patch] powerpc: Add topology_ready to machdep calls Geoff Levand
  2009-02-11 23:31 ` [RFC patch] powerpc/ps3: Add ps3_topology_ready routine Geoff Levand
  2009-02-12  4:21 ` [RFC patch] powerpc: Add topology_ready to machdep calls Benjamin Herrenschmidt
@ 2009-02-12  4:21 ` Benjamin Herrenschmidt
  2009-02-12 22:36 ` [patch] powerpc/ps3: Move ps3_mm_add_memory to device_initcall Geoff Levand
  3 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2009-02-12  4:21 UTC (permalink / raw)
  To: Geoff Levand; +Cc: Linuxppc-dev

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.

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

* [patch] powerpc/ps3: Move ps3_mm_add_memory to device_initcall
  2009-02-11 23:30 [RFC patch] powerpc: Add topology_ready to machdep calls Geoff Levand
                   ` (2 preceding siblings ...)
  2009-02-12  4:21 ` Benjamin Herrenschmidt
@ 2009-02-12 22:36 ` Geoff Levand
  3 siblings, 0 replies; 5+ messages in thread
From: Geoff Levand @ 2009-02-12 22:36 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Linuxppc-dev

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 <geoffrey.levand@am.sony.com>
---
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                                                               */

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

end of thread, other threads:[~2009-02-12 22:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11 23:30 [RFC patch] powerpc: Add topology_ready to machdep calls Geoff Levand
2009-02-11 23:31 ` [RFC patch] powerpc/ps3: Add ps3_topology_ready routine Geoff Levand
2009-02-12  4:21 ` [RFC patch] powerpc: Add topology_ready to machdep calls Benjamin Herrenschmidt
2009-02-12  4:21 ` Benjamin Herrenschmidt
2009-02-12 22:36 ` [patch] powerpc/ps3: Move ps3_mm_add_memory to device_initcall Geoff Levand

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.