From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: [PATCH] PoD: Fix domain build populate-on-demand cache allocation Date: Mon, 9 Aug 2010 14:18:10 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: george.dunlap@eu.citrix.com List-Id: xen-devel@lists.xenproject.org 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. Signed-off-by: George Dunlap diff -r fe930e1b2ce8 -r c453b237894e tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Fri Aug 06 18:35:02 2010 +0100 +++ b/tools/libxc/xc_hvm_build.c Mon Aug 09 14:18:02 2010 +0100 @@ -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 )