From: Aravind Menon Subject: [PATCH] Fix balloon driver for auto_translated_physmap guests Date: Sun, 08 Oct 2006 05:11:37 +0200 Message-ID: <1160277096.17210.28.camel@labospc5.epfl.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-TNeCBhYFLwfDPlAloRLT" 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 List-Id: xen-devel@lists.xenproject.org --=-TNeCBhYFLwfDPlAloRLT Content-Type: text/plain Content-Transfer-Encoding: 7bit For guest domains running in auto_translated mode, the domain builder maps the guest grant table at the end of its physmap, i.e. from page frame 'nr_pages' to page frame 'nr_pages + NR_GRANT_FRAMES'. However, the balloon driver, on initialization, appends all page frames from 'nr_pages' to 'max_pfn' to its ballooned_pages list (this includes the grant table page frames). This ballooned_pages list is subsequently used for increasing memory reservation. Thus for auto_translated guests, the balloon driver remaps the grant table page frames when it tries to increase the memory reservation. The attached patch fixes the balloon driver for auto_translated mode. Signed-off-by: Aravind Menon --=-TNeCBhYFLwfDPlAloRLT Content-Disposition: attachment; filename=balloon.patch Content-Type: text/x-patch; name=balloon.patch; charset= Content-Transfer-Encoding: 7bit diff -r f071be18e85f linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Fri Oct 6 16:51:10 2006 +0100 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Sun Oct 8 04:57:23 2006 +0200 @@ -462,6 +462,7 @@ static int __init balloon_init(void) { unsigned long pfn; struct page *page; + unsigned long page_start; if (!is_running_on_xen()) return -ENODEV; @@ -489,9 +490,12 @@ static int __init balloon_init(void) balloon_pde->read_proc = balloon_read; balloon_pde->write_proc = balloon_write; #endif - + page_start = xen_start_info->nr_pages; + if (xen_feature(XENFEAT_auto_translated_physmap)) + page_start += NR_GRANT_FRAMES; + /* Initialise the balloon with excess memory space. */ - for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) { + for (pfn = page_start; pfn < max_pfn; pfn++) { page = pfn_to_page(pfn); if (!PageReserved(page)) balloon_append(page); --=-TNeCBhYFLwfDPlAloRLT Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-TNeCBhYFLwfDPlAloRLT--