xen/x86: fix initial memory balloon target
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 14 May 2025 08:04:26 +0000 (10:04 +0200)
committerJuergen Gross <jgross@suse.com>
Fri, 23 May 2025 05:09:00 +0000 (07:09 +0200)
commit74287971dbb3fe322bb316afd9e7fb5807e23bee
tree62e737acba9df63b7bbf3414551ff38504500829
parentd24c6b78ac550072df359c17e6aadddf079257d0
xen/x86: fix initial memory balloon target

When adding extra memory regions as ballooned pages also adjust the balloon
target, otherwise when the balloon driver is started it will populate
memory to match the target value and consume all the extra memory regions
added.

This made the usage of the Xen `dom0_mem=,max:` command line parameter for
dom0 not work as expected, as the target won't be adjusted and when the
balloon is started it will populate memory straight to the 'max:' value.
It would equally affect domUs that have memory != maxmem.

Kernels built with CONFIG_XEN_UNPOPULATED_ALLOC are not affected, because
the extra memory regions are consumed by the unpopulated allocation driver,
and then balloon_add_regions() becomes a no-op.

Reported-by: John <jw@nuclearfallout.net>
Fixes: 87af633689ce ('x86/xen: fix balloon target initialization for PVH dom0')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Message-ID: <20250514080427.28129-1-roger.pau@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/xen/balloon.c