Re: [regression] Bug 221745 - PV DomU ballooning driver init issue
Yannick Martin <[email protected]>
| Newsgroups | org.xenproject.lists.xen-devel |
|---|---|
| Message-ID | <[email protected]> |
Hello I will try this tomorrow ! Regards Le 27 juillet 2026 18:51:15 GMT+02:00, "Roger Pau Monné" <[email protected]> a écrit : >On Mon, Jul 27, 2026 at 10:42:25AM +0200, Thorsten Leemhuis wrote: >> Hi Roger! FYI, it seems your change 0949c646d64697 ("Partial revert >> "x86/xen: fix balloon target initialization for PVH dom0"") [v7.0-rc1] >> caued a regression. For details see >> https://bugzilla.kernel.org/show_bug.cgi?id=221745 >> >> To quote the initial comment: >> >> > Since commit db8c4b1 (Partial revert "x86/xen: fix balloon target initialization for PVH dom0"), xen ballooning fails to init correctly on domU (on amd64 arch) with the following configuration: >> > >> > -- xl.cfg >> > ... >> > memory = '2048' >> > maxmem = '4096' >> > ... >> > -- >> > >> > -- domU balloon dmesg (init fails) >> > [ 0.908337] xen:balloon: Initialising balloon driver >> > [ 0.940721] Extra pages underflow current target > >Yeah, I'm afraid the original fix commit didn't fully fix the issues, >so there's the following change (chunk below) that's needed >additionally to cope with memory != maxmem on PV guests. > >I've done some basic testing and it seems to solve the issue, could >you give it a spin also? (just to make sure I'm not missing anything >else). > >Thanks, Roger. >--- >diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c >index e7f1d4ca6d75..c20a1ff8292d 100644 >--- a/drivers/xen/balloon.c >+++ b/drivers/xen/balloon.c >@@ -703,19 +703,26 @@ static int __init balloon_add_regions(void) > balloon_append(pfn_to_page(pfn)); > > /* >- * Extra regions are accounted for in the physmap, but need >- * decreasing from current_pages and target_pages to balloon >- * down the initial allocation, because they are already >- * accounted for in total_pages. >+ * For HVM domains: extra regions are accounted for in the >+ * physmap, but need decreasing from current_pages and >+ * target_pages to balloon down the initial allocation, because >+ * they are already accounted for in total_pages. >+ * >+ * For PV domains: extra regions are not accounted for in the >+ * initial memory target, and hence need adding to the stats as >+ * additional unpopulated regions. > */ > pages = extra_pfn_end - start_pfn; >- if (pages >= balloon_stats.current_pages || >- pages >= balloon_stats.target_pages) { >+ if (xen_pv_domain()) { >+ balloon_stats.total_pages += pages; >+ } else if (pages >= balloon_stats.current_pages || >+ pages >= balloon_stats.target_pages) { > WARN(1, "Extra pages underflow current target"); > return -ERANGE; >+ } else { >+ balloon_stats.current_pages -= pages; >+ balloon_stats.target_pages -= pages; > } >- balloon_stats.current_pages -= pages; >- balloon_stats.target_pages -= pages; > } > > return 0;