Subject: Re: PS3: Fix memory hotplug

From: Geoff Levand <[email-masked]>
Date: Wed, 21 May 2008 11:31:36 -0700

Paul Mackerras wrote:
> Benjamin Herrenschmidt writes:
> 
>> When you do an lmb_add you should probably also do an lmb_analyze to
>> update the total memory count etc...
>> 
>> That leads to some interesting issues such as the LMB stuff wasn't
>> really meant to be dynamically modified after boot, and thus the kernel
>> has no locks in there. That can be an issue...
>> 
>> Paul, any thoughts here ? Should we add a lock ? That would mean being
>> careful as the LMB stuff can be called very early, and spinlock wants
>> things like PACA and possibly lockdep to be around.. 
> 
> Either that, or we give in and use iomem_resource to track where
> system RAM is, as well as the other things in the physical address
> space, like other architectures do...

The generic hot plug routines already use iomem_resource
(mm/memory_hotplug.c).  Both __add_pages() and add_memory()
add the new mem to iomem_resource, and so it seems there
is no need for the powerpc specific walk_memory_resource(),
since the generic one does its check with iomem_resource.

I need to look a little closer at how the pSeries does
its memory hot plug, but I think removing the powerpc
specific walk_memory_resource() won't effect pSeries since
it seems to have its own hot plug routines that do their
own thing entirely with lmb.

It doesn't seem that it would be difficult to make the
pSeries hot plug code to use iomem_resource, but some of the
generic hot plug routines cannot be called until fairly
late in the startup.

The other thing to do then would be to change the other
powerpc startup code to use iomem_resource instead of lmb.

-Geoff