Skip to contentSkip to conversation

PoD: Fix domain build populate-on-demand cache allocation

PATCH Applied George Dunlap 2 participants 2 messages Aug 9, 2010 – Aug 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PoD: Fix domain build populate-on-demand cache allocation

Rather than trying to count the number of PoD entries we're putting in, we simply pass the target # of pages - the vga hole, and let the hypervisor do the calculation.

tools/libxc/xc_hvm_build.c +4 -14
diff -r fe930e1b2ce8 -r c453b237894e tools/libxc/xc_hvm_build.c
@@ -123,7 +123,6 @@
     xen_pfn_t *page_array = NULL;
     unsigned long i, nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT);
     unsigned long target_pages = (unsigned long)target << (20 - PAGE_SHIFT);
-    unsigned long pod_pages = 0;
     unsigned long entry_eip, cur_pages;
     void *hvm_info_page;
     uint32_t *ident_pt;
@@ -237,11 +236,6 @@
             {
                 stat_1gb_pages += done;
                 done <<= SUPERPAGE_1GB_SHIFT;
-                if ( pod_mode && target_pages > cur_pages )
-                {
-                    int d = target_pages - cur_pages;
-                    pod_pages += ( done < d ) ? done : d;
-                }
                 cur_pages += done;
                 count -= done;
             }
@@ -284,11 +278,6 @@
                 {
                     stat_2mb_pages += done;
                     done <<= SUPERPAGE_2MB_SHIFT;
-                    if ( pod_mode && target_pages > cur_pages )
-                    {
-                        int d = target_pages - cur_pages;
-                        pod_pages += ( done < d ) ? done : d;
-                    }
                     cur_pages += done;
                     count -= done;
                 }
@@ -302,15 +291,16 @@
                 xch, dom, count, 0, 0, &page_array[cur_pages]);
             cur_pages += count;
             stat_normal_pages += count;
-            if ( pod_mode )
-                pod_pages -= count;
         }
     }
 
+    /* Subtract 0x20 from target_pages for the VGA "hole".  Xen will
+     * adjust the PoD cache size so that domain tot_pages will be
+     * target_pages - 0x20 after this call. */
     if ( pod_mode )
         rc = xc_domain_memory_set_pod_target(xch,
                                              dom,
-                                             pod_pages,
+                                             target_pages - 0x20,
                                              NULL, NULL, NULL);
 
     if ( rc != 0 )
#1 lore raw
Quoted 5 lines · George Dunlap

Rather than trying to count the number of PoD entries we're putting in, we simply pass the target # of pages - the vga hole, and let the hypervisor do the calculation.

applied, thanks