Hi,
cr3 is 32bit wide only, so we'll have to take care that our PAE
pgd is located below the 4GB border in physical memory. The
patch below does just that, using the new dma memory zone:
* adds a check to alloc_l3_page to make sure xen doesn't
triple-fault due to an attempt to stick a value into
cr3 which doesn't fit in.
* make xenlinux allocate a dma page for the pgd.
* make the dom0 builder allocate the first chunk of memory
(where the page tables are in) from the dma zone as well.
With that patch in place my 6GB test machine boots to the login
prompt with dom0_mem=512m.
Trying to boot with dom0_mem=3g (parts of memory allocated above
4GB) doesn't work though, the machine fails to exec init and
I'll get this in the log:
request_module: runaway loop modprobe binfmt-0000
Not investigated yet, but could be block I/O to pages above
4GB not working ...
Have fun,
Gerd
---
test-build-32pae-2caa8e1e211140942e46a301d778a49f1473e645/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c.pae
2005-08-11 10:42:46.863937068 +0200
+++
test-build-32pae-2caa8e1e211140942e46a301d778a49f1473e645/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c
2005-08-11 10:52:39.429908027 +0200
@@ -25,6 +25,7 @@
#include <asm/mmu_context.h>
#include <asm-xen/foreign_page.h>
+#include <asm-xen/hypervisor.h>
void show_mem(void)
{
@@ -274,6 +275,11 @@
{
unsigned long flags;
+#ifdef CONFIG_X86_PAE
+ /* this gives us a page below 4GB */
+ xen_contig_memory((unsigned long)pgd, 0);
+#endif
+
if (!HAVE_SHARED_KERNEL_PMD)
spin_lock_irqsave(&pgd_lock, flags);
---
test-build-32pae-2caa8e1e211140942e46a301d778a49f1473e645/xen/arch/x86/domain_build.c.pae
2005-08-11 10:37:41.818167027 +0200
+++
test-build-32pae-2caa8e1e211140942e46a301d778a49f1473e645/xen/arch/x86/domain_build.c
2005-08-11 10:39:48.264437425 +0200
@@ -57,13 +57,14 @@
#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
#define round_pgdown(_p) ((_p)&PAGE_MASK)
-static struct pfn_info *alloc_largest(struct domain *d, unsigned long max)
+static struct pfn_info *alloc_largest(struct domain *d, unsigned long
+ max, unsigned long flags)
{
struct pfn_info *page;
unsigned int order = get_order(max * PAGE_SIZE);
if ( (max & (max-1)) != 0 )
order--;
- while ( (page = alloc_domheap_pages(d, order, 0)) == NULL )
+ while ( (page = alloc_domheap_pages(d, order, flags)) == NULL )
if ( order-- == 0 )
break;
return page;
@@ -143,7 +144,7 @@
nr_pages = avail_domheap_pages() +
((initrd_len + PAGE_SIZE - 1) >> PAGE_SHIFT) +
((image_len + PAGE_SIZE - 1) >> PAGE_SHIFT);
- if ( (page = alloc_largest(d, nr_pages)) == NULL )
+ if ( (page = alloc_largest(d, nr_pages, ALLOC_DOM_DMA)) == NULL )
panic("Not enough RAM for DOM0 reservation.\n");
alloc_spfn = page_to_pfn(page);
alloc_epfn = alloc_spfn + d->tot_pages;
@@ -575,7 +576,7 @@
}
while ( pfn < nr_pages )
{
- if ( (page = alloc_largest(d, nr_pages - d->tot_pages)) == NULL )
+ if ( (page = alloc_largest(d, nr_pages - d->tot_pages, 0)) == NULL )
panic("Not enough RAM for DOM0 reservation.\n");
while ( pfn < d->tot_pages )
{
---
test-build-32pae-2caa8e1e211140942e46a301d778a49f1473e645/xen/arch/x86/mm.c.pae
2005-08-11 10:47:59.851297625 +0200
+++ test-build-32pae-2caa8e1e211140942e46a301d778a49f1473e645/xen/arch/x86/mm.c
2005-08-11 10:49:39.368650275 +0200
@@ -854,6 +854,15 @@
l3_pgentry_t *pl3e;
int i;
+#ifdef CONFIG_X86_PAE
+ if (page_to_pfn(page) > 0xfffff) {
+ /* PAE pgd must be below 4GB */
+ MEM_LOG("PAE pgd must be below 4GB (0x%lx > 0xfffff)",
+ page_to_pfn(page));
+ return 0;
+ }
+#endif
+
ASSERT(!shadow_mode_refcounts(d));
pl3e = map_domain_page(pfn);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|