Re: [regression] Bug 221745 - PV DomU ballooning driver init issue
Yannick Martin <[email protected]> Thu, 30 Jul 2026 11:36:58 +0200
| Newsgroups | gmane.comp.emulators.xen.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello It works !!! uname -a Linux status 7.2.0-rc3-xendomu #1 SMP PREEMPT Thu Jul 30 10:39:13 CEST 2026 x86_64 GNU/Linux # ps auxwwwf | grep -i ball root 48 0.0 0.0 0 0 ? S 11:33 0:00 \_ [xen-balloon] dmesg | grep -i ballo [ 0.436657] xen:balloon: Initialising balloon driver domU memory resize works, tested 1024m -> 1200m -> 1000m. Regards Le 27/07/2026 à 19:10, Yannick Martin a écrit : > 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; >