Re: Trying to make use of hotplug memory for xen balloon driver

From: KAMEZAWA Hiroyuki
Date: Wed Mar 26 2008 - 20:47:12 EST


On Wed, 26 Mar 2008 16:11:54 -0700
Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:

> Hi,
>
> I'm trying to make use of hotplug memory in the Xen balloon driver. If
> you want to expand a domain to be larger than its initial size, it must
> add new page structures to describe the new memory.
>
> The platform is x86-32, with CONFIG_SPARSEMEM and
> CONFIG_HOTPLUG_MEMORY. Because the new memory is only pseudo-physical,
> the physical address within the domain is arbitrary, and I added a
> add_memory_resource() function so I could use allocate_resource() to
> find an appropriate address to put the new memory at.
>
welcome to chaos of memory hotplug :)

> 1. the online_page() raises an error:
>
> Bad page state in process 'events/0'
> page:c16fa0cc flags:0x00000000 mapping:00000000 mapcount:1 count:0
> Trying to fix it up, but a reboot is needed

Hmm, this seems memmap is not initialized correctly...
page->flags == 0 means page is in ZONE_DMA.(it's only 16MB range on x86)
I think memmap is not initilalized.

Calling path to memmap initailization is.
==
add_memory()
-> arch_add_memory()
-> __add_page()
-> __add_section()
-> __add_zone()
-> memmap_init_zone()
==
Please check what arch_add_memory() is called, at first.



> 2. The new pages don't appear to be in the right zone. When I boot a
> 256M domain I get an initial setup of:
>
> Zone PFN ranges:
> DMA 0 -> 4096
> Normal 4096 -> 65536
> HighMem 65536 -> 65536
> Movable zone start PFN for each node
> early_node_map[1] active PFN ranges
> 0: 0 -> 65536
> On node 0 totalpages: 65536
> DMA zone: 52 pages used for memmap
> DMA zone: 0 pages reserved
> DMA zone: 4044 pages, LIFO batch:0
> Normal zone: 780 pages used for memmap
> Normal zone: 60660 pages, LIFO batch:15
> HighMem zone: 0 pages used for memmap
> Movable zone: 0 pages used for memmap
>
>
> which presumably means that new pages above pfn 65536 should be in
> the highmem zone? But PageHighMem() returns false for those pages.
>
See x86-32's arch_add_memory(). It's now designed that "all new memory will go into
ZONE_HIGHMEM".
(Because added memory is tend to be removed later.)

Thanks,
-Kame


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/