Re: [PATCH v2] x86/xen: fix init of balloon stats again

Matthias Goergens <[email protected]> Wed, 5 Aug 2026 19:50:41 +0800
Newsgroups gmane.linux.kernel.stable,gmane.comp.emulators.xen.devel,gmane.linux.kernel
Message-ID <[email protected]>
Hi Roger,

v2 looks good to me.  Keying append on the source of the initial count
covers every case I can construct: by inspection, a domU always enters
the fallback branch (current_pages stays 0), so HVM/PVH domU and the
dom0 hypercall-failure path share the subtraction branch, while the PV
start_info path and a successful dom0 XENMEM_current_reservation append.

I also ran it on a nested-KVM Xen rig (Xen 4.23-unstable, Linux
11028ab62899e as dom0, static busybox initramfs):

- PV dom0, dom0_mem=2048M,max:4096M and 3072M,max:4096M,
  CONFIG_XEN_UNPOPULATED_ALLOC=n: no WARN, current_kb matches dom0_mem
  (2 and 3 GiB respectively).  Same with =y.
- PVH dom0, same two memory configurations, =n: v1 WARNed in
  balloon_init and returned -ERANGE in exactly these cases; v2
  completes cleanly and the balloon driver initialises.

(Scope note: PVH dom0 userspace stalls later in boot under nested KVM
for an unrelated reason, so the PVH evidence is boot-time dmesg and the
balloon sysfs state.)

Tested-by: Matthias Goergens <[email protected]>

Thanks,
Matthias