Hi KAME, As I mentioned while ago, ppc64 does not export information about "system RAM" in /proc/iomem. Looking at the code and usage scenerios I am not sure what its really serving. Could you explain what its purpose & how the range can be invalid ?
At least on ppc64, all the memory ranges we get passed comes from /sysfs memblock information and they are guaranteed to match device-tree entries. On ppc64, each 16MB chunk has a /sysfs entry and it will be part of the /proc/device-tree entry. Since we do "online" or "offline" to /sysfs entries to add/remove pages - these ranges are guaranteed to be valid. Since this check is redundant for ppc64, I propose following patch. Is this acceptable ? If some one really really wants, I can code up this to walk lmb or /proc/device-tree and verify the range & adjust the entries for overlap (I don't see how that can happen). Paul & Kame, please comment. Thanks, Badari --- arch/powerpc/Kconfig | 3 +++ arch/powerpc/mm/mem.c | 13 +++++++++++++ kernel/resource.c | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) Index: linux-2.6.24-rc1/arch/powerpc/mm/mem.c =================================================================== --- linux-2.6.24-rc1.orig/arch/powerpc/mm/mem.c 2007-10-30 07:39:16.000000000 -0800 +++ linux-2.6.24-rc1/arch/powerpc/mm/mem.c 2007-10-30 10:05:09.000000000 -0800 @@ -129,6 +129,19 @@ int __devinit arch_add_memory(int nid, u return __add_pages(zone, start_pfn, nr_pages); } +/* + * I don't think we really need to do anything here to validate the memory + * range or walk the memory resource in lmb or device-tree. Only way we get + * the memory range here is through /sysfs in 16MB chunks and we are guaranteed + * to have a corresponding device-tree entry. + */ +int +walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg, + int (*func)(unsigned long, unsigned long, void *)) +{ + return (*func)(start_pfn, nr_pages, arg); +} + #endif /* CONFIG_MEMORY_HOTPLUG */ #ifdef CONFIG_MEMORY_HOTREMOVE Index: linux-2.6.24-rc1/kernel/resource.c =================================================================== --- linux-2.6.24-rc1.orig/kernel/resource.c 2007-10-23 20:50:57.000000000 -0700 +++ linux-2.6.24-rc1/kernel/resource.c 2007-10-30 08:58:41.000000000 -0800 @@ -228,7 +228,7 @@ int release_resource(struct resource *ol EXPORT_SYMBOL(release_resource); -#ifdef CONFIG_MEMORY_HOTPLUG +#if defined(CONFIG_MEMORY_HOTPLUG) && !defined(CONFIG_ARCH_HAS_WALK_MEMORY) /* * Finds the lowest memory reosurce exists within [res->start.res->end) * the caller must specify res->start, res->end, res->flags. Index: linux-2.6.24-rc1/arch/powerpc/Kconfig =================================================================== --- linux-2.6.24-rc1.orig/arch/powerpc/Kconfig 2007-10-30 07:39:17.000000000 -0800 +++ linux-2.6.24-rc1/arch/powerpc/Kconfig 2007-10-30 08:54:57.000000000 -0800 @@ -234,6 +234,9 @@ config HOTPLUG_CPU config ARCH_ENABLE_MEMORY_HOTPLUG def_bool y +config ARCH_HAS_WALK_MEMORY + def_bool y + config ARCH_ENABLE_MEMORY_HOTREMOVE def_bool y _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev