WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Calling alloc_boot_pages() after end_boot_allocator() ca

To: xen-changelog@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Calling alloc_boot_pages() after end_boot_allocator() can result in
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Tue, 22 Mar 2005 09:38:46 +0000
Delivery-date: Tue, 22 Mar 2005 10:04:52 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-changelog>
List-help: <mailto:xen-changelog-request@lists.sourceforge.net?subject=help>
List-id: <xen-changelog.lists.sourceforge.net>
List-post: <mailto:xen-changelog@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-admin@xxxxxxxxxxxxxxxxxxxxx
ChangeSet 1.1343, 2005/03/22 09:38:46+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Calling alloc_boot_pages() after end_boot_allocator() can result in
        double allocation of the same page.
        Signed-off-by: Chengyuan Li <chengyuan.li@xxxxxxxxx>
        Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 mm.c |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)


diff -Nru a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  2005-03-22 05:03:59 -05:00
+++ b/xen/arch/x86/x86_64/mm.c  2005-03-22 05:03:59 -05:00
@@ -28,12 +28,26 @@
 #include <asm/fixmap.h>
 #include <asm/msr.h>
 
-void *safe_page_alloc(void)
+static void *safe_page_alloc(void)
 {
     extern int early_boot;
     if ( early_boot )
-        return __va(alloc_boot_pages(PAGE_SIZE, PAGE_SIZE));
-    return (void *)alloc_xenheap_page();
+    {
+        unsigned long p = alloc_boot_pages(PAGE_SIZE, PAGE_SIZE);
+        if ( p == 0 )
+            goto oom;
+        return phys_to_virt(p);
+    }
+    else
+    {
+        struct pfn_info *pg = alloc_domheap_page(NULL);
+        if ( pg == NULL )
+            goto oom;
+        return page_to_virt(pg);
+    }
+ oom:
+    panic("Out of memory");
+    return NULL;
 }
 
 /* Map physical byte range (@p, @p+@s) at virt address @v in pagetable @pt. */
@@ -118,6 +132,7 @@
 {
     unsigned long i, p, max;
     l3_pgentry_t *l3rw, *l3ro;
+    struct pfn_info *pg;
 
     /* Map all of physical memory. */
     max = ((max_page + L1_PAGETABLE_ENTRIES - 1) & 
@@ -130,10 +145,11 @@
      */
     for ( i = 0; i < max_page; i += ((1UL << L2_PAGETABLE_SHIFT) / 8) )
     {
-        p = alloc_boot_pages(1UL << L2_PAGETABLE_SHIFT,
-                             1UL << L2_PAGETABLE_SHIFT);
-        if ( p == 0 )
+        pg = alloc_domheap_pages(
+            NULL, L2_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT);
+        if ( pg == NULL )
             panic("Not enough memory for m2p table\n");
+        p = page_to_phys(pg);
         map_pages(idle_pg_table, RDWR_MPT_VIRT_START + i*8, p, 
                   1UL << L2_PAGETABLE_SHIFT, PAGE_HYPERVISOR | _PAGE_USER);
         memset((void *)(RDWR_MPT_VIRT_START + i*8), 0x55,


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Calling alloc_boot_pages() after end_boot_allocator() can result in, BitKeeper Bot <=